|
| 1 | +import { Grid } from '@mui/material'; |
| 2 | +import { Issue } from 'mobx-github'; |
| 3 | +import { observer } from 'mobx-react'; |
| 4 | +import { cache, compose, errorLogger, translator } from 'next-ssr-middleware'; |
| 5 | +import { FC } from 'react'; |
| 6 | + |
| 7 | +import { IssueCard } from '../../../components/Git/Issue/Card'; |
| 8 | +import { PageHead } from '../../../components/PageHead'; |
| 9 | +import { ScrollList } from '../../../components/ScrollList'; |
| 10 | +import issueStore, { IssueFilter, IssueModel } from '../../../models/Issue'; |
| 11 | +import { i18n } from '../../../models/Translation'; |
| 12 | + |
| 13 | +const issueFilter: IssueFilter = { |
| 14 | + repository_url: 'https://github.com/idea2app', |
| 15 | + state: 'open', |
| 16 | + title: 'reward', |
| 17 | +}; |
| 18 | + |
| 19 | +export const getServerSideProps = compose(cache(), errorLogger, translator(i18n), async () => { |
| 20 | + const list = await new IssueModel().getList(issueFilter); |
| 21 | + |
| 22 | + return { props: JSON.parse(JSON.stringify({ list })) }; |
| 23 | +}); |
| 24 | + |
| 25 | +const IssuesPage: FC<{ list: Issue[] }> = observer(({ list }) => ( |
| 26 | + <Grid container className="px-4 py-20"> |
| 27 | + <PageHead title="GitHub-reward issues" /> |
| 28 | + |
| 29 | + <h1>GitHub-reward issues</h1> |
| 30 | + |
| 31 | + <ScrollList |
| 32 | + translator={i18n} |
| 33 | + store={issueStore} |
| 34 | + filter={issueFilter} |
| 35 | + defaultData={list} |
| 36 | + renderList={allItems => ( |
| 37 | + <Grid container spacing={2}> |
| 38 | + {allItems.map(issue => ( |
| 39 | + <Grid key={issue.id} size={{ xs: 12, sm: 6, md: 4 }}> |
| 40 | + <IssueCard className="h-full" {...issue} /> |
| 41 | + </Grid> |
| 42 | + ))} |
| 43 | + </Grid> |
| 44 | + )} |
| 45 | + /> |
| 46 | + </Grid> |
| 47 | +)); |
| 48 | + |
| 49 | +export default IssuesPage; |
0 commit comments