@@ -7,9 +7,9 @@ import { Accordion, Button, Nav } from 'react-bootstrap';
77import { sum } from 'web-utility' ;
88
99import { OrganizationModel , OrganizationStatistic } from '../../models/Organization' ;
10- import { i18n , I18nContext } from '../../models/Translation' ;
10+ import { i18n , I18nContext } from '../../models/Translation' ;
1111import { TagNav } from '../Base/TagNav' ;
12- import { CityStatisticMap } from '../Map/index ' ;
12+ import { CityStatisticMap } from '../Map/CityStatisticMap ' ;
1313import { OrganizationCardProps } from './Card' ;
1414import { OrganizationListLayout } from './List' ;
1515
@@ -40,38 +40,39 @@ export class ChinaPublicInterestMap extends ObservedComponent<
4040 } ;
4141
4242 renderFilter ( ) {
43- const { type, tag } = this . props ,
43+ const { t } = this . observedContext ,
44+ { type, tag } = this . props ,
4445 { filter, totalCount } = this . props . store ;
4546 const count =
4647 totalCount != null && totalCount !== Infinity
4748 ? totalCount
48- : sum ( ... type . map ( t => t . count ) ) || 0 ;
49+ : ( type [ filter . type + '' ] ?? tag [ filter . tags + '' ] ?? sum ( ... Object . values ( type ) ) ) ;
4950
5051 return (
5152 < Accordion as = "header" className = "sticky-top bg-white" style = { { top : '5rem' } } >
5253 < Accordion . Item eventKey = "0" >
5354 < Accordion . Header >
5455 < div className = "w-100 d-flex justify-content-between align-items-center" >
55- Filter
56+ { t ( 'filter' ) }
5657
5758 < TagNav list = { Object . values ( filter ) as string [ ] } />
5859
59- Total Organizations: { count }
60+ { ` ${ t ( 'total' ) } $ {count } ${ t ( 'organizations' ) } ` }
6061 </ div >
6162 </ Accordion . Header >
6263 < Accordion . Body as = "form" onReset = { ( ) => this . switchFilter ( { } ) } >
6364 < fieldset className = "mb-3" >
64- < legend > Type </ legend >
65+ < legend > { t ( 'type' ) } </ legend >
6566
66- < TagNav list = { type . map ( t => t . label ) } onCheck = { type => this . switchFilter ( { type } ) } />
67+ < TagNav list = { Object . keys ( type ) } onCheck = { type => this . switchFilter ( { type } ) } />
6768 </ fieldset >
6869 < fieldset className = "mb-3" >
69- < legend > Tag </ legend >
70+ < legend > { t ( 'tag' ) } </ legend >
7071
71- < TagNav list = { tag . map ( t => t . label ) } onCheck = { tags => this . switchFilter ( { tags } ) } />
72+ < TagNav list = { Object . keys ( tag ) } onCheck = { tags => this . switchFilter ( { tags } ) } />
7273 </ fieldset >
7374 < Button type = "reset" variant = "warning" size = "sm" >
74- Reset
75+ { t ( 'reset' ) }
7576 </ Button >
7677 </ Accordion . Body >
7778 </ Accordion . Item >
@@ -80,7 +81,8 @@ export class ChinaPublicInterestMap extends ObservedComponent<
8081 }
8182
8283 renderTab ( ) {
83- const { props, tabKey } = this ;
84+ const { t } = this . observedContext ,
85+ { props, tabKey } = this ;
8486
8587 return (
8688 < div >
@@ -91,10 +93,10 @@ export class ChinaPublicInterestMap extends ObservedComponent<
9193 onSelect = { key => key && ( this . tabKey = key as ChinaPublicInterestMap [ 'tabKey' ] ) }
9294 >
9395 < Nav . Item >
94- < Nav . Link eventKey = "map" > Map </ Nav . Link >
96+ < Nav . Link eventKey = "map" > { t ( 'map' ) } </ Nav . Link >
9597 </ Nav . Item >
9698 < Nav . Item >
97- < Nav . Link eventKey = "chart" > Chart </ Nav . Link >
99+ < Nav . Link eventKey = "chart" > { t ( 'chart' ) } </ Nav . Link >
98100 </ Nav . Item >
99101 </ Nav >
100102
0 commit comments