Skip to content

Commit babc91a

Browse files
committed
[add] Lark form buttons in Hackathon home page
[optimize] upgrade to File-Type 22 & other latest Upstream packagesw
1 parent d84dddc commit babc91a

7 files changed

Lines changed: 784 additions & 756 deletions

File tree

package.json

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@
1515
},
1616
"dependencies": {
1717
"@giscus/react": "^3.1.0",
18-
"@koa/router": "^15.3.0",
18+
"@koa/router": "^15.4.0",
1919
"@mdx-js/loader": "^3.1.1",
2020
"@mdx-js/react": "^3.1.1",
21-
"@next/mdx": "^16.1.6",
22-
"core-js": "^3.48.0",
21+
"@next/mdx": "^16.2.1",
22+
"core-js": "^3.49.0",
2323
"echarts-jsx": "^0.6.0",
24-
"file-type": "^21.3.0",
24+
"file-type": "^22.0.0",
2525
"idea-react": "^2.0.0-rc.13",
2626
"jsonwebtoken": "^9.0.3",
27-
"koa": "^3.1.1",
27+
"koa": "^3.2.0",
2828
"koa-jwt": "^4.0.4",
29-
"koajax": "^3.1.2",
29+
"koajax": "^3.3.0",
3030
"license-filter": "^0.2.5",
31-
"marked": "^17.0.3",
31+
"marked": "^17.0.5",
3232
"mime": "^4.1.0",
3333
"mobx": "^6.15.0",
3434
"mobx-github": "^0.6.2",
@@ -39,10 +39,10 @@
3939
"mobx-restful": "^2.1.4",
4040
"mobx-restful-table": "^2.6.3",
4141
"mobx-strapi": "^0.8.1",
42-
"next": "^16.1.6",
42+
"next": "^16.2.1",
4343
"next-pwa": "^5.6.0",
4444
"next-ssr-middleware": "^1.1.0",
45-
"nodemailer": "^8.0.1",
45+
"nodemailer": "^8.0.4",
4646
"open-react-map": "^0.9.1",
4747
"react": "^19.2.4",
4848
"react-bootstrap": "^2.10.10",
@@ -51,43 +51,43 @@
5151
"remark-frontmatter": "^5.0.0",
5252
"remark-mdx-frontmatter": "^5.2.0",
5353
"web-utility": "^4.6.4",
54-
"yaml": "^2.8.2"
54+
"yaml": "^2.8.3"
5555
},
5656
"devDependencies": {
5757
"@babel/plugin-proposal-decorators": "^7.29.0",
5858
"@babel/plugin-transform-typescript": "^7.28.6",
5959
"@babel/preset-react": "^7.28.5",
6060
"@cspell/eslint-plugin": "^9.7.0",
6161
"@eslint/js": "^10.0.1",
62-
"@next/eslint-plugin-next": "^16.1.6",
62+
"@next/eslint-plugin-next": "^16.2.1",
6363
"@open-source-bazaar/china-ngo-database": "^0.6.0",
6464
"@softonus/prettier-plugin-duplicate-remover": "^1.1.2",
65-
"@stylistic/eslint-plugin": "^5.9.0",
65+
"@stylistic/eslint-plugin": "^5.10.0",
6666
"@types/eslint-config-prettier": "^6.11.3",
6767
"@types/jsonwebtoken": "^9.0.10",
68-
"@types/koa": "^3.0.1",
68+
"@types/koa": "^3.0.2",
6969
"@types/next-pwa": "^5.6.9",
70-
"@types/node": "^24.10.13",
70+
"@types/node": "^24.12.0",
7171
"@types/nodemailer": "^7.0.11",
7272
"@types/react": "^19.2.14",
7373
"@types/react-dom": "^19.2.3",
74-
"eslint": "^10.0.2",
75-
"eslint-config-next": "^16.1.6",
74+
"eslint": "^10.1.0",
75+
"eslint-config-next": "^16.2.1",
7676
"eslint-config-prettier": "^10.1.8",
7777
"eslint-plugin-react": "^7.37.5",
7878
"eslint-plugin-simple-import-sort": "^12.1.1",
79-
"globals": "^17.3.0",
79+
"globals": "^17.4.0",
8080
"husky": "^9.1.7",
8181
"jiti": "^2.6.1",
82-
"less": "^4.5.1",
83-
"less-loader": "^12.3.1",
84-
"lint-staged": "^16.2.7",
82+
"less": "^4.6.4",
83+
"less-loader": "^12.3.2",
84+
"lint-staged": "^16.4.0",
8585
"next-with-less": "^3.0.1",
8686
"prettier": "^3.8.1",
8787
"prettier-plugin-css-order": "^2.2.0",
88-
"sass": "^1.97.3",
88+
"sass": "^1.98.0",
8989
"typescript": "~5.9.3",
90-
"typescript-eslint": "^8.56.1"
90+
"typescript-eslint": "^8.57.2"
9191
},
9292
"resolutions": {
9393
"mobx-react-helper": "$mobx-react-helper",

pages/hackathon/[id].tsx

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@ import { observer } from 'mobx-react';
33
import Link from 'next/link';
44
import { cache, compose, errorLogger } from 'next-ssr-middleware';
55
import { FC, useContext } from 'react';
6-
import { Badge, Card, Col, Container, Row } from 'react-bootstrap';
6+
import {
7+
Badge,
8+
Button,
9+
ButtonGroup,
10+
Card,
11+
Col,
12+
Container,
13+
Dropdown,
14+
DropdownButton,
15+
Row,
16+
} from 'react-bootstrap';
717
import { text2color, UserRankView } from 'idea-react';
818
import { formatDate } from 'web-utility';
919

@@ -67,21 +77,14 @@ interface HackathonDetailProps {
6777
};
6878
}
6979

70-
const formatDateTime = (dateString: string) => {
71-
const date = new Date(dateString);
72-
return date.toLocaleString('zh-CN', {
73-
month: 'numeric',
74-
day: 'numeric',
75-
hour: '2-digit',
76-
minute: '2-digit',
77-
});
78-
};
80+
const FormButtonBar = ['Person', 'Project', 'Product', 'Evaluation'];
7981

8082
const HackathonDetail: FC<HackathonDetailProps> = observer(({ activity, hackathon }) => {
8183
const { t } = useContext(I18nContext);
8284

83-
const { name, summary, location, startTime, endTime } = activity,
85+
const { name, summary, location, startTime, endTime, databaseSchema } = activity,
8486
{ people, organizations, agenda, prizes, templates, projects } = hackathon;
87+
const { forms } = databaseSchema as BiTableSchema;
8588

8689
return (
8790
<>
@@ -99,7 +102,7 @@ const HackathonDetail: FC<HackathonDetailProps> = observer(({ activity, hackatho
99102
<Card.Body>
100103
<h5 className="text-white mb-2">📍 {t('event_location')}</h5>
101104
<p className="text-white-50 mb-0">
102-
{(location as TableCellLocation).full_address}
105+
{(location as TableCellLocation)?.full_address}
103106
</p>
104107
</Card.Body>
105108
</Card>
@@ -115,6 +118,33 @@ const HackathonDetail: FC<HackathonDetailProps> = observer(({ activity, hackatho
115118
</Card>
116119
</Col>
117120
</Row>
121+
122+
<ButtonGroup className="d-flex mt-3">
123+
{FormButtonBar.map((key, index) => {
124+
const list = forms[key]?.filter(
125+
// @ts-expect-error Upstream types bug
126+
({ shared_limit }) => shared_limit === 'anyone_editable',
127+
);
128+
129+
return !list?.[0] ? null : list.length < 2 ? (
130+
<Button href={list[0].shared_url} target="_blank" rel="noreferrer">
131+
{index + 1}. {list[0].name}
132+
</Button>
133+
) : (
134+
<DropdownButton
135+
as={ButtonGroup}
136+
title={`${index + 1}. ${t('product_submission')}`}
137+
id={`dropdown-${key}`}
138+
>
139+
{list.map(({ name, shared_url }) => (
140+
<Dropdown.Item key={name} href={shared_url} target="_blank" rel="noreferrer">
141+
{name}
142+
</Dropdown.Item>
143+
))}
144+
</DropdownButton>
145+
);
146+
})}
147+
</ButtonGroup>
118148
</Container>
119149
</section>
120150

0 commit comments

Comments
 (0)