Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ NEXT_PUBLIC_ACTIVITY_TABLE_ID = tblREEMxDOECZZrK
NEXT_PUBLIC_PROJECT_TABLE_ID = tblGnY6Hm0nTSBR9
NEXT_PUBLIC_AWARD_TABLE_ID = tblmYd5V5BMngAp2

NEXT_PUBLIC_STRAPI_API_HOST = https://china-ngo-db.onrender.com/api/
NEXT_PUBLIC_STRAPI_API_HOST = https://test.nomad-home.cn/api/Lark/
NEXT_PUBLIC_NGO_BASE_ID = Kfs0bHJZhaKtJLs3uBTcnynnnNf
NEXT_PUBLIC_NGO_TABLE_ID = tbl3eTvwgMGukhqL
NEXT_PUBLIC_NGO_YEAR_STATISTIC_TABLE_ID = tblNWHacXaiEYC50
NEXT_PUBLIC_NGO_CITY_STATISTIC_TABLE_ID = tblFFyaTEpGAaZNl
NEXT_PUBLIC_NGO_TYPE_STATISTIC_TABLE_ID = tblZeAOFqH6zX6Tr

SMTP_HOST = smtp.feishu.cn
SMTP_PORT = 465
Expand Down
2 changes: 0 additions & 2 deletions .npmrc
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
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@
## 开始

```bash
npm install
npm run dev
# or
yarn install
yarn dev
pnpm install
pnpm dev
```
Comment on lines 22 to 27
Copy link

Copilot AI Apr 5, 2026

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 install doesn’t fail unexpectedly for contributors on older 20.x minors.

Copilot uses AI. Check for mistakes.

可访问 http://localhost:3000.
Expand Down
4 changes: 2 additions & 2 deletions components/Map/CityStatisticMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import systemStore from '../../models/System';
const ChinaMap = dynamic(() => import('./ChinaMap'), { ssr: false });

export interface CityStatisticMapProps {
data: OrganizationStatistic['coverageArea'];
data: OrganizationStatistic['city'];
onChange?: (city: string) => any;
}

Expand All @@ -27,7 +27,7 @@ export class CityStatisticMap extends ObservedComponent<CityStatisticMapProps> {

return Object.entries(data)
.map(([city, count]) => {
const point = cityCoordinate[city];
const point = cityCoordinate[city.replace(/(市|自治州|特别行政区)$/, '')];

if (point)
return {
Expand Down
22 changes: 11 additions & 11 deletions components/Organization/Card.tsx
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';
Expand All @@ -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;
Expand All @@ -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">
Expand All @@ -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>
)}
Expand All @@ -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
Expand All @@ -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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

字符串强制转换可能产生 "undefined" 或 "null" 文本

使用 + '' 进行字符串转换时,如果 nameentityTypeundefinednull,会渲染出字面量字符串 "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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{name + ''}
<BadgeBar className="ms-2" list={[{ text: entityType + '' }]} />
<Card.Title>
{name?.toString() ?? ''}
<BadgeBar className="ms-2" list={[{ text: entityType?.toString() ?? '' }]} />
</Card.Title>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/Organization/Card.tsx` around lines 77 - 78, Replace the unsafe
string coercion using "+ ''" for name and entityType with a null-safe fallback
like the nullish coalescing used elsewhere (e.g., use name ?? '' and entityType
?? '') so that the display and the BadgeBar list item do not render literal
"undefined" or "null"; update the occurrences around the JSX where name and the
BadgeBar list use entityType to use the null-safe fallback.

</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>

Expand All @@ -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
/>
)}
Expand Down
4 changes: 2 additions & 2 deletions components/Organization/Charts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { OrganizationStatistic, sortStatistic } from '../../models/Organization'
import { I18nContext } from '../../models/Translation';

const OrganizationCharts: FC<OrganizationStatistic> = observer(
({ entityType, serviceCategory, coverageArea }) => {
({ entityType, serviceCategory, city }) => {
const { t } = useContext(I18nContext);

const typeList = sortStatistic(entityType),
categoryList = sortStatistic(serviceCategory),
areaList = sortStatistic(coverageArea);
areaList = sortStatistic(city);

return (
<div style={{ minHeight: '70vh' }}>
Expand Down
7 changes: 3 additions & 4 deletions components/Organization/Landscape.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Organization } from '@open-source-bazaar/china-ngo-database';
import { Dialog } from 'idea-react';
import { observable } from 'mobx';
import { observer } from 'mobx-react';
import { Component } from 'react';
import { Modal } from 'react-bootstrap';
import { splitArray } from 'web-utility';

import { OrganizationModel } from '../../models/Organization';
import { Organization, OrganizationModel } from '../../models/Organization';
import systemStore from '../../models/System';
import { OrganizationCard } from './Card';
import styles from './LandScape.module.less';
Expand Down Expand Up @@ -46,9 +45,9 @@ export class OpenCollaborationLandscape extends Component<OpenCollaborationLands
onClick={() => this.modal.open({ name: name as string })}
>
<div className="text-nowrap" style={{ fontSize: this.itemSize + 'rem' }}>
{name.slice(0, 2)}
{(name + '').slice(0, 2)}
<br />
{name.slice(2, 4)}
{(name + '').slice(2, 4)}
</div>
</li>
);
Expand Down
Loading
Loading