1- import { Organization } from '@open-source-bazaar/china-ngo-database' ;
21import { Icon } from 'idea-react' ;
32import { observable } from 'mobx' ;
43import { observer } from 'mobx-react' ;
@@ -8,9 +7,11 @@ import { HTMLAttributes } from 'react';
87import { Button , Card , CardProps , Image } from 'react-bootstrap' ;
98
109import { i18n , I18nContext } from '../../models/Translation' ;
10+ import { Organization } from '../../models/Organization' ;
1111
1212export interface OrganizationCardProps
13- extends Pick < HTMLAttributes < HTMLDivElement > , 'className' | 'style' > ,
13+ extends
14+ Pick < HTMLAttributes < HTMLDivElement > , 'className' | 'style' > ,
1415 Omit < Organization , 'id' > ,
1516 CardProps {
1617 onSwitch ?: ( filter : Partial < Pick < Organization , 'entityType' | 'coverageArea' > > ) => any ;
@@ -24,7 +25,7 @@ export class OrganizationCard extends ObservedComponent<OrganizationCardProps, t
2425 accessor showQRC = false ;
2526
2627 renderIcon ( ) {
27- const { website, wechatPublic } = this . observedProps . internetContact || { } ;
28+ const { website, wechatPublic } = this . observedProps ;
2829
2930 return (
3031 < div className = "d-flex justify-content-around" >
@@ -34,7 +35,7 @@ export class OrganizationCard extends ObservedComponent<OrganizationCardProps, t
3435 </Button>
3536 )} */ }
3637 { website && (
37- < Button title = "WWW" size = "sm" target = "_blank" href = { website } >
38+ < Button title = "WWW" size = "sm" target = "_blank" href = { website ?. toString ( ) } >
3839 < Icon name = "globe2" />
3940 </ Button >
4041 ) }
@@ -53,9 +54,8 @@ export class OrganizationCard extends ObservedComponent<OrganizationCardProps, t
5354 }
5455
5556 render ( ) {
56- const { name, entityType, services, description, internetContact , onSwitch, ...props } =
57+ const { name, entityType, services, description, wechatPublic , onSwitch, ...props } =
5758 this . props ;
58- const { wechatPublic } = internetContact || { } ;
5959
6060 return (
6161 < Card
@@ -74,21 +74,21 @@ export class OrganizationCard extends ObservedComponent<OrganizationCardProps, t
7474 /> */ }
7575 < Card . Body >
7676 < Card . Title >
77- { name }
78- < BadgeBar className = "ms-2" list = { [ { text : entityType ! } ] } />
77+ { name + '' }
78+ < BadgeBar className = "ms-2" list = { [ { text : entityType + '' } ] } />
7979 </ Card . Title >
8080
8181 { services && (
8282 < BadgeBar
8383 className = "justify-content-end"
84- list = { services . map ( ( { serviceCategory } ) => ( { text : serviceCategory ! } ) ) }
84+ list = { ( services as string [ ] ) . map ( text => ( { text } ) ) }
8585 />
8686 ) }
8787 < Card . Text
8888 className = "d-none d-sm-block text-wrap overflow-auto"
8989 style = { { minHeight : '5rem' , maxHeight : '10rem' } }
9090 >
91- { description }
91+ { description ?. toString ( ) }
9292 </ Card . Text >
9393 </ Card . Body >
9494
@@ -99,7 +99,7 @@ export class OrganizationCard extends ObservedComponent<OrganizationCardProps, t
9999 < Image
100100 className = "mt-2"
101101 src = { `https://open.weixin.qq.com/qr/code?username=${ wechatPublic } ` }
102- alt = { wechatPublic }
102+ alt = { wechatPublic ?. toString ( ) }
103103 fluid
104104 />
105105 ) }
0 commit comments