-
Notifications
You must be signed in to change notification settings - Fork 9
[refactor] migrate NGO models to BI Table API based on MobX-Lark 2.8 #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1 @@ | ||
| auto-install-peers = false | ||
| //npm.pkg.github.com/:_authToken=${GH_PAT} | ||
| @open-source-bazaar:registry=https://npm.pkg.github.com |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,3 @@ | ||||||||||||||
| import { Organization } from '@open-source-bazaar/china-ngo-database'; | ||||||||||||||
| import { Icon } from 'idea-react'; | ||||||||||||||
| import { observable } from 'mobx'; | ||||||||||||||
| import { observer } from 'mobx-react'; | ||||||||||||||
|
|
@@ -8,9 +7,11 @@ import { HTMLAttributes } from 'react'; | |||||||||||||
| import { Button, Card, CardProps, Image } from 'react-bootstrap'; | ||||||||||||||
|
|
||||||||||||||
| import { i18n, I18nContext } from '../../models/Translation'; | ||||||||||||||
| import { Organization } from '../../models/Organization'; | ||||||||||||||
|
|
||||||||||||||
| export interface OrganizationCardProps | ||||||||||||||
| extends Pick<HTMLAttributes<HTMLDivElement>, 'className' | 'style'>, | ||||||||||||||
| extends | ||||||||||||||
| Pick<HTMLAttributes<HTMLDivElement>, 'className' | 'style'>, | ||||||||||||||
| Omit<Organization, 'id'>, | ||||||||||||||
| CardProps { | ||||||||||||||
| onSwitch?: (filter: Partial<Pick<Organization, 'entityType' | 'coverageArea'>>) => any; | ||||||||||||||
|
|
@@ -24,7 +25,7 @@ export class OrganizationCard extends ObservedComponent<OrganizationCardProps, t | |||||||||||||
| accessor showQRC = false; | ||||||||||||||
|
|
||||||||||||||
| renderIcon() { | ||||||||||||||
| const { website, wechatPublic } = this.observedProps.internetContact || {}; | ||||||||||||||
| const { website, wechatPublic } = this.observedProps; | ||||||||||||||
|
|
||||||||||||||
| return ( | ||||||||||||||
| <div className="d-flex justify-content-around"> | ||||||||||||||
|
|
@@ -34,7 +35,7 @@ export class OrganizationCard extends ObservedComponent<OrganizationCardProps, t | |||||||||||||
| </Button> | ||||||||||||||
| )} */} | ||||||||||||||
| {website && ( | ||||||||||||||
| <Button title="WWW" size="sm" target="_blank" href={website}> | ||||||||||||||
| <Button title="WWW" size="sm" target="_blank" href={website?.toString()}> | ||||||||||||||
| <Icon name="globe2" /> | ||||||||||||||
| </Button> | ||||||||||||||
| )} | ||||||||||||||
|
|
@@ -53,9 +54,8 @@ export class OrganizationCard extends ObservedComponent<OrganizationCardProps, t | |||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| render() { | ||||||||||||||
| const { name, entityType, services, description, internetContact, onSwitch, ...props } = | ||||||||||||||
| const { name, entityType, services, description, wechatPublic, onSwitch, ...props } = | ||||||||||||||
| this.props; | ||||||||||||||
| const { wechatPublic } = internetContact || {}; | ||||||||||||||
|
|
||||||||||||||
| return ( | ||||||||||||||
| <Card | ||||||||||||||
|
|
@@ -74,21 +74,21 @@ export class OrganizationCard extends ObservedComponent<OrganizationCardProps, t | |||||||||||||
| /> */} | ||||||||||||||
| <Card.Body> | ||||||||||||||
| <Card.Title> | ||||||||||||||
| {name} | ||||||||||||||
| <BadgeBar className="ms-2" list={[{ text: entityType! }]} /> | ||||||||||||||
| {name + ''} | ||||||||||||||
| <BadgeBar className="ms-2" list={[{ text: entityType + '' }]} /> | ||||||||||||||
|
Comment on lines
+77
to
+78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 字符串强制转换可能产生 "undefined" 或 "null" 文本 使用 建议使用与第 91 行一致的安全写法: 🛡️ 建议修改 <Card.Title>
- {name + ''}
- <BadgeBar className="ms-2" list={[{ text: entityType + '' }]} />
+ {name?.toString() ?? ''}
+ <BadgeBar className="ms-2" list={[{ text: entityType?.toString() ?? '' }]} />
</Card.Title>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| </Card.Title> | ||||||||||||||
|
|
||||||||||||||
| {services && ( | ||||||||||||||
| <BadgeBar | ||||||||||||||
| className="justify-content-end" | ||||||||||||||
| list={services.map(({ serviceCategory }) => ({ text: serviceCategory! }))} | ||||||||||||||
| list={(services as string[]).map(text => ({ text }))} | ||||||||||||||
| /> | ||||||||||||||
| )} | ||||||||||||||
| <Card.Text | ||||||||||||||
| className="d-none d-sm-block text-wrap overflow-auto" | ||||||||||||||
| style={{ minHeight: '5rem', maxHeight: '10rem' }} | ||||||||||||||
| > | ||||||||||||||
| {description} | ||||||||||||||
| {description?.toString()} | ||||||||||||||
| </Card.Text> | ||||||||||||||
| </Card.Body> | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -99,7 +99,7 @@ export class OrganizationCard extends ObservedComponent<OrganizationCardProps, t | |||||||||||||
| <Image | ||||||||||||||
| className="mt-2" | ||||||||||||||
| src={`https://open.weixin.qq.com/qr/code?username=${wechatPublic}`} | ||||||||||||||
| alt={wechatPublic} | ||||||||||||||
| alt={wechatPublic?.toString()} | ||||||||||||||
| fluid | ||||||||||||||
| /> | ||||||||||||||
| )} | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updated deps/tooling (e.g., Next.js 16.2.2 / ESLint 10.2.x) have stricter Node engine requirements than just “Node 20+” in some cases. It would help to document the minimum supported Node.js version here (and that pnpm is required), so
pnpm installdoesn’t fail unexpectedly for contributors on older 20.x minors.