|
| 1 | +import { Contributor } from 'mobx-github'; |
| 2 | +import { observer } from 'mobx-react'; |
| 3 | +import { cache, compose, errorLogger } from 'next-ssr-middleware'; |
| 4 | +import { FC, useContext } from 'react'; |
| 5 | +import { Container, Row } from 'react-bootstrap'; |
| 6 | + |
| 7 | +import { PageHead } from '../components/Layout/PageHead'; |
| 8 | +import { SectionTitle } from '../components/Layout/SectionTitle'; |
| 9 | +import { PersonCard } from '../components/PersonCard'; |
| 10 | +import { repositoryStore } from '../models/Repository'; |
| 11 | +import { I18nContext } from '../models/Translation'; |
| 12 | + |
| 13 | +export const getServerSideProps = compose(cache(), errorLogger, async () => { |
| 14 | + const contributors: Contributor[] = await repositoryStore.getAllContributors(); |
| 15 | + |
| 16 | + return { props: { contributors } }; |
| 17 | +}); |
| 18 | + |
| 19 | +const Organizer: FC<{ contributors: Contributor[] }> = observer(({ contributors }) => { |
| 20 | + const { t } = useContext(I18nContext); |
| 21 | + |
| 22 | + return ( |
| 23 | + <Container> |
| 24 | + <PageHead title={t('volunteer')} /> |
| 25 | + <h1 className="py-5 text-center text-md-start ps-md-4">{t('volunteer')}</h1> |
| 26 | + |
| 27 | + <section className="d-flex justify-content-around align-items-center gap-3 flex-wrap mb-5"> |
| 28 | + <a |
| 29 | + className="d-block" |
| 30 | + href="https://next.ossinsight.io/widgets/official/compose-org-participants-roles-ratio?owner_id=73477979&period=past_28_days" |
| 31 | + target="_blank" |
| 32 | + rel="noreferrer" |
| 33 | + > |
| 34 | + <picture> |
| 35 | + <source |
| 36 | + media="(prefers-color-scheme: dark)" |
| 37 | + srcSet="https://next.ossinsight.io/widgets/official/compose-org-participants-roles-ratio/thumbnail.png?owner_id=73477979&period=past_28_days&image_size=5x5&color_scheme=dark" |
| 38 | + width="465" |
| 39 | + /> |
| 40 | + <img |
| 41 | + alt="Participants roles of Open Source Bazaar" |
| 42 | + src="https://next.ossinsight.io/widgets/official/compose-org-participants-roles-ratio/thumbnail.png?owner_id=73477979&period=past_28_days&image_size=5x5&color_scheme=light" |
| 43 | + width="465" |
| 44 | + /> |
| 45 | + </picture> |
| 46 | + </a> |
| 47 | + <a |
| 48 | + className="d-block" |
| 49 | + href="https://next.ossinsight.io/widgets/official/compose-org-engagement-scatter?owner_id=73477979&period=past_28_days" |
| 50 | + target="_blank" |
| 51 | + rel="noreferrer" |
| 52 | + > |
| 53 | + <picture> |
| 54 | + <source |
| 55 | + media="(prefers-color-scheme: dark)" |
| 56 | + srcSet="https://next.ossinsight.io/widgets/official/compose-org-engagement-scatter/thumbnail.png?owner_id=73477979&period=past_28_days&image_size=5x5&color_scheme=dark" |
| 57 | + width="465" |
| 58 | + /> |
| 59 | + <img |
| 60 | + alt="Most engaged people of Open Source Bazaar" |
| 61 | + src="https://next.ossinsight.io/widgets/official/compose-org-engagement-scatter/thumbnail.png?owner_id=73477979&period=past_28_days&image_size=5x5&color_scheme=light" |
| 62 | + width="465" |
| 63 | + /> |
| 64 | + </picture> |
| 65 | + </a> |
| 66 | + </section> |
| 67 | + |
| 68 | + <SectionTitle count={contributors.length}>{t('online_volunteer')}</SectionTitle> |
| 69 | + <Row |
| 70 | + as="ul" |
| 71 | + className="list-unstyled justify-content-center text-center" |
| 72 | + xs={2} |
| 73 | + sm={5} |
| 74 | + md={6} |
| 75 | + > |
| 76 | + {contributors.map(({ login, html_url, contributions }) => ( |
| 77 | + <PersonCard |
| 78 | + key={login} |
| 79 | + name={login!} |
| 80 | + avatar={`https://github.com/${login}.png`} |
| 81 | + link={html_url} |
| 82 | + count={contributions} |
| 83 | + /> |
| 84 | + ))} |
| 85 | + </Row> |
| 86 | + </Container> |
| 87 | + ); |
| 88 | +}); |
| 89 | + |
| 90 | +export default Organizer; |
0 commit comments