-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathChinaPublicInterestMap.tsx
More file actions
129 lines (120 loc) · 3.93 KB
/
ChinaPublicInterestMap.tsx
File metadata and controls
129 lines (120 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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>
<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>
);
});