generated from idea2app/Next-Bootstrap-ts
-
Notifications
You must be signed in to change notification settings - Fork 6
[add] China NGO Database 2.0 pages #36
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
234b008
Initial plan
Copilot ca30930
Add China Public Interest Map foundation with mobx-strapi integration
Copilot 20db4cc
Complete China Public Interest Map implementation with working naviga…
Copilot 81a83e0
Address PR review feedback: Fix .npmrc, restore Base.ts, update navig…
Copilot 0d6041b
Fix major TypeScript issues and implement class-based components as r…
Copilot 0ab732e
Fix getStaticProps serialization and add error handling for API failures
Copilot 11201fc
新增中国公益地图页面 - Add China Public Interest Map Pages
Copilot 23feba1
Complete rewrite of China Public Interest Map components according to…
Copilot 56ffc8a
[refactor] replace Scroll List with Search List for NGO index page
TechQuery 4a83fd2
[add] Organization Charts component
TechQuery e07c205
[optimize] update Upstream packages
TechQuery 68bd527
[refactor] load NGO data by year
TechQuery 69787fd
Translate all hardcoded text and clean up unused i18n keys
Copilot e35e3b5
[fix] some SSG & i18n bugs
TechQuery 6445ea9
[fix] NGO routes compatibility
TechQuery File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
auto-install-peers = false | ||
auto-install-peers = false | ||
//npm.pkg.github.com/:_authToken=${GH_PAT} | ||
@open-source-bazaar:registry=https://npm.pkg.github.com | ||
TechQuery marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { FC, useEffect, useRef } from 'react'; | ||
import { Card, Col, Container, Row, Spinner } from 'react-bootstrap'; | ||
|
||
export interface MapProps { | ||
data?: { name: string; city?: string; province?: string; latitude?: number; longitude?: number }[]; | ||
loading?: boolean; | ||
} | ||
|
||
export const Map: FC<MapProps> = ({ data = [], loading = false }) => { | ||
const mapRef = useRef<HTMLDivElement>(null); | ||
|
||
useEffect(() => { | ||
// Placeholder for actual map implementation | ||
// This would integrate with a mapping library like Leaflet, AMap, or MapBox | ||
}, []); | ||
TechQuery marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
if (loading) { | ||
return ( | ||
<Container className="d-flex justify-content-center align-items-center" style={{ minHeight: '400px' }}> | ||
<Spinner animation="border" role="status"> | ||
<span className="visually-hidden">Loading...</span> | ||
</Spinner> | ||
</Container> | ||
); | ||
} | ||
|
||
return ( | ||
<Container> | ||
<Row> | ||
<Col> | ||
<Card> | ||
<Card.Body> | ||
<div | ||
ref={mapRef} | ||
style={{ | ||
width: '100%', | ||
height: '500px', | ||
backgroundColor: '#f8f9fa', | ||
border: '1px solid #dee2e6', | ||
borderRadius: '0.375rem', | ||
position: 'relative', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}} | ||
> | ||
<div className="text-center text-muted"> | ||
<h5>Interactive Map Coming Soon</h5> | ||
<p>Geographic visualization of {data.length} organizations</p> | ||
{data.length > 0 && ( | ||
<small> | ||
Data includes organizations from{' '} | ||
{[...new Set(data.map(item => item.province || item.city).filter(Boolean))].length}{' '} | ||
locations | ||
</small> | ||
)} | ||
</div> | ||
</div> | ||
</Card.Body> | ||
</Card> | ||
</Col> | ||
</Row> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default Map; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
components/Organization/ChinaPublicInterestLandscape.tsx
TechQuery marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import { observer } from 'mobx-react'; | ||
import { FC, useContext, useEffect, useState } from 'react'; | ||
import { Badge, Card, Col, Container, Row } from 'react-bootstrap'; | ||
|
||
import { Organization, OrganizationModel } from '../../models/Organization'; | ||
import { I18nContext } from '../../models/Translation'; | ||
|
||
const organizationModel = new OrganizationModel(); | ||
|
||
export const ChinaPublicInterestLandscape: FC = observer(() => { | ||
const { t } = useContext(I18nContext); | ||
const [tagMap, setTagMap] = useState<Record<string, Organization[]>>({}); | ||
const [loading, setLoading] = useState(false); | ||
|
||
useEffect(() => { | ||
const loadData = async () => { | ||
setLoading(true); | ||
try { | ||
const groupedData = await organizationModel.groupAllByTags(); | ||
setTagMap(groupedData); | ||
} finally { | ||
setLoading(false); | ||
} | ||
}; | ||
|
||
loadData(); | ||
}, []); | ||
|
||
const tagEntries = Object.entries(tagMap).sort(([, a], [, b]) => b.length - a.length); | ||
|
||
return ( | ||
<Container className="py-4"> | ||
<Row className="mb-4"> | ||
<Col> | ||
<h1>{t('china_public_interest_landscape')}</h1> | ||
</Col> | ||
</Row> | ||
|
||
{loading && ( | ||
<Row> | ||
<Col className="text-center"> | ||
<div className="spinner-border" role="status"> | ||
<span className="visually-hidden">Loading...</span> | ||
</div> | ||
</Col> | ||
</Row> | ||
)} | ||
|
||
{!loading && tagEntries.length === 0 && ( | ||
<Row> | ||
<Col> | ||
<Card> | ||
<Card.Body className="text-center py-5"> | ||
<Card.Title>{t('no_data_available')}</Card.Title> | ||
<Card.Text>{t('landscape_data_loading_message')}</Card.Text> | ||
</Card.Body> | ||
</Card> | ||
</Col> | ||
</Row> | ||
)} | ||
|
||
{!loading && tagEntries.map(([tag, organizations]) => ( | ||
<Row key={tag} className="mb-4"> | ||
<Col> | ||
<Card> | ||
<Card.Header className="d-flex justify-content-between align-items-center"> | ||
<h5 className="mb-0">{tag}</h5> | ||
<Badge bg="primary">{organizations.length} {t('organizations')}</Badge> | ||
</Card.Header> | ||
<Card.Body> | ||
<Row className="g-3"> | ||
{organizations.map(org => ( | ||
<Col key={org.id} md={6} lg={4}> | ||
<Card className="h-100"> | ||
<Card.Body> | ||
<Card.Title className="h6">{org.name}</Card.Title> | ||
{org.description && ( | ||
<Card.Text className="small text-muted"> | ||
{org.description.length > 100 | ||
? `${org.description.substring(0, 100)}...` | ||
: org.description} | ||
</Card.Text> | ||
)} | ||
<div className="mt-2"> | ||
{org.city && ( | ||
<Badge bg="secondary" className="me-1"> | ||
{org.city} | ||
</Badge> | ||
)} | ||
{org.type && ( | ||
<Badge bg="info" className="me-1"> | ||
{org.type} | ||
</Badge> | ||
)} | ||
</div> | ||
{org.website && ( | ||
<Card.Link | ||
href={org.website} | ||
target="_blank" | ||
className="small" | ||
> | ||
{t('visit_website')} | ||
</Card.Link> | ||
)} | ||
</Card.Body> | ||
</Card> | ||
</Col> | ||
))} | ||
</Row> | ||
</Card.Body> | ||
</Card> | ||
</Col> | ||
</Row> | ||
))} | ||
</Container> | ||
); | ||
}); |
TechQuery marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import { observer } from 'mobx-react'; | ||
import { FC, useContext, useEffect, useState } from 'react'; | ||
import { Card, Col, Container, Nav, Row } from 'react-bootstrap'; | ||
|
||
import { Organization, OrganizationModel } from '../../models/Organization'; | ||
import { I18nContext } from '../../models/Translation'; | ||
import { Map } from '../Map'; | ||
|
||
const organizationModel = new OrganizationModel(); | ||
|
||
export const ChinaPublicInterestMap: FC = observer(() => { | ||
const { t } = useContext(I18nContext); | ||
const [loading, setLoading] = useState(false); | ||
const [organizations, setOrganizations] = useState<Organization[]>([]); | ||
|
||
useEffect(() => { | ||
const loadData = async () => { | ||
setLoading(true); | ||
try { | ||
const orgs = await organizationModel.getAll(); | ||
setOrganizations(orgs); | ||
} catch (error) { | ||
console.error('Failed to load organizations:', error); | ||
} finally { | ||
setLoading(false); | ||
} | ||
}; | ||
|
||
loadData(); | ||
}, []); | ||
|
||
return ( | ||
<Container className="py-4"> | ||
<Row className="mb-4"> | ||
<Col> | ||
<h1>{t('china_public_interest_map')}</h1> | ||
<Nav className="mb-3"> | ||
<Nav.Link href="/ngo/landscape">{t('landscape')}</Nav.Link> | ||
<Nav.Link href="/ngo">{t('join_the_public_interest_map')}</Nav.Link> | ||
</Nav> | ||
</Col> | ||
</Row> | ||
TechQuery marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
<Row className="mb-4"> | ||
<Col> | ||
<Map data={organizations} loading={loading} /> | ||
</Col> | ||
</Row> | ||
|
||
<Row> | ||
<Col md={3}> | ||
<Card> | ||
<Card.Header>{t('by_year')}</Card.Header> | ||
<Card.Body> | ||
{loading ? ( | ||
<div className="text-center"> | ||
<div className="spinner-border spinner-border-sm" role="status"> | ||
<span className="visually-hidden">Loading...</span> | ||
</div> | ||
</div> | ||
) : ( | ||
<p className="text-muted">{t('no_data_available')}</p> | ||
)} | ||
</Card.Body> | ||
</Card> | ||
</Col> | ||
<Col md={3}> | ||
<Card> | ||
<Card.Header>{t('by_city')}</Card.Header> | ||
<Card.Body> | ||
{loading ? ( | ||
<div className="text-center"> | ||
<div className="spinner-border spinner-border-sm" role="status"> | ||
<span className="visually-hidden">Loading...</span> | ||
</div> | ||
</div> | ||
) : ( | ||
<p className="text-muted">{t('no_data_available')}</p> | ||
)} | ||
</Card.Body> | ||
</Card> | ||
</Col> | ||
<Col md={3}> | ||
<Card> | ||
<Card.Header>{t('by_type')}</Card.Header> | ||
<Card.Body> | ||
{loading ? ( | ||
<div className="text-center"> | ||
<div className="spinner-border spinner-border-sm" role="status"> | ||
<span className="visually-hidden">Loading...</span> | ||
</div> | ||
</div> | ||
) : ( | ||
<p className="text-muted">{t('no_data_available')}</p> | ||
)} | ||
</Card.Body> | ||
</Card> | ||
</Col> | ||
<Col md={3}> | ||
<Card> | ||
<Card.Header>{t('by_tag')}</Card.Header> | ||
<Card.Body> | ||
{loading ? ( | ||
<div className="text-center"> | ||
<div className="spinner-border spinner-border-sm" role="status"> | ||
<span className="visually-hidden">Loading...</span> | ||
</div> | ||
</div> | ||
) : ( | ||
<p className="text-muted">{t('no_data_available')}</p> | ||
)} | ||
</Card.Body> | ||
</Card> | ||
</Col> | ||
</Row> | ||
|
||
<Row className="mt-4"> | ||
<Col> | ||
<Card> | ||
<Card.Body> | ||
<h5>{t('about_china_public_interest_map')}</h5> | ||
<p>{t('china_public_interest_map_description')}</p> | ||
</Card.Body> | ||
</Card> | ||
</Col> | ||
</Row> | ||
</Container> | ||
); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.