generated from idea2app/Next-Bootstrap-ts
-
Notifications
You must be signed in to change notification settings - Fork 2
/
issue.tsx
63 lines (56 loc) · 1.8 KB
/
issue.tsx
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
import { Loading } from 'idea-react';
import { GitRepository, RepositoryModel } from 'mobx-github';
import { observer } from 'mobx-react';
import { ScrollList } from 'mobx-restful-table';
import { cache, compose, errorLogger, translator } from 'next-ssr-middleware';
import { FC } from 'react';
import { Breadcrumb, Container, Row } from 'react-bootstrap';
import { IssueModule } from '../components/Git/Issue/IssueModule';
import { PageHead } from '../components/PageHead';
import { repositoryStore } from '../models/Repository';
import { i18n } from '../models/Translation';
export const getServerSideProps = compose(
cache(),
errorLogger,
translator(i18n),
async () => {
const list = await new RepositoryModel('kaiyuanshe').getList({
relation: ['issues'],
});
return { props: JSON.parse(JSON.stringify({ list })) };
},
);
const { t } = i18n;
const IssuesPage: FC<{ list: GitRepository[] }> = observer(({ list }) => (
<Container className="py-5">
<PageHead title="GitHub issues" />
<Breadcrumb>
<Breadcrumb.Item href="/">
{t('open_source_treasure_box')}
</Breadcrumb.Item>
<Breadcrumb.Item active>GitHub issues</Breadcrumb.Item>
</Breadcrumb>
<h1>GitHub issues</h1>
{repositoryStore.downloading > 0 && <Loading />}
<ScrollList
translator={i18n}
store={repositoryStore}
filter={{
relation: ['issues'],
}}
defaultData={list}
renderList={allItems => (
<Row as="ul" className="list-unstyled g-4">
{allItems.map(
repository =>
!repository.archived &&
repository.issues?.[0] && (
<IssueModule key={repository.name} {...repository} />
),
)}
</Row>
)}
/>
</Container>
));
export default IssuesPage;