Skip to content

Commit 848345f

Browse files
TechQueryCopilot
andcommitted
[refactor] simplify AI codes
[optimize] update Upstream packages Co-authored-by: Copilot <copilot@github.com>
1 parent bbe4ff9 commit 848345f

8 files changed

Lines changed: 524 additions & 535 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
@import './theme.less';
2+
3+
.card {
4+
;
5+
padding: 1.35rem;
6+
}
7+
8+
.avatar {
9+
flex-shrink: 0;
10+
box-shadow: 0 0 24px rgba(44, 232, 255, 0.14);
11+
border: 1px solid rgba(44, 232, 255, 0.26);
12+
width: 4rem;
13+
height: 4rem;
14+
}
15+
16+
.name {
17+
margin: 0;
18+
color: #fff;
19+
font-weight: 700;
20+
font-size: 1.05rem;
21+
}
22+
23+
.link {
24+
color: @cyan;
25+
text-decoration: none;
26+
27+
&:hover {
28+
color: #fff;
29+
}
30+
}
31+
32+
.summary {
33+
margin: 1rem 0 0;
34+
color: @muted;
35+
line-height: 1.75;
36+
}
37+
38+
.skill {
39+
;
40+
padding: 0.45rem 0.72rem;
41+
color: rgba(255, 255, 255, 0.8);
42+
font-size: 0.82rem;
43+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { Avatar } from 'idea-react';
2+
import { TableCellUser } from 'mobx-lark';
3+
import { FC } from 'react';
4+
import { Card } from 'react-bootstrap';
5+
6+
import { Member } from '../../../models/Hackathon';
7+
import styles from './TeamMember.module.less';
8+
9+
export const TeamMemberCard: FC<Member> = ({ person, githubAccount, summary, skills }) => {
10+
const member = person as TableCellUser;
11+
const githubName = githubAccount as string;
12+
const memberSummary = summary as string;
13+
const memberSkills = (skills as string[]).slice(0, 6);
14+
15+
return (
16+
<Card className={`${styles.card} h-100`} body>
17+
<div className="d-flex align-items-center gap-3">
18+
<Avatar className={styles.avatar} src={member?.avatar_url} />
19+
<div>
20+
<h3 className={styles.name}>{member?.name || '-'}</h3>
21+
22+
{githubName && (
23+
<a
24+
className={styles.link}
25+
href={`https://github.com/${githubName}`}
26+
target="_blank"
27+
rel="noreferrer"
28+
>
29+
@{githubName}
30+
</a>
31+
)}
32+
</div>
33+
</div>
34+
35+
{memberSummary && <p className={styles.summary}>{memberSummary}</p>}
36+
37+
{memberSkills[0] && (
38+
<ul className="d-flex flex-wrap gap-2 mt-3 mb-0 p-0 list-unstyled">
39+
{memberSkills.map(skill => (
40+
<li key={skill} className={styles.skill}>
41+
{skill}
42+
</li>
43+
))}
44+
</ul>
45+
)}
46+
</Card>
47+
);
48+
};

components/Activity/ProductCard.tsx

Lines changed: 65 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -4,89 +4,78 @@ import { FC } from 'react';
44
import { CardProps, Card, Button } from 'react-bootstrap';
55
import { formatDate } from 'web-utility';
66

7-
import { timeOf } from './Hackathon/utility';
87
import { Product } from '../../models/Hackathon';
98
import styles from '../../styles/Hackathon.module.less';
109

1110
export type ProductCardProps = Product & Omit<CardProps, 'id' | 'title'>;
1211

1312
export const ProductCard: FC<ProductCardProps> = observer(
14-
({ className = '', id, createdAt, name, sourceLink, link = sourceLink, summary, ...props }) => {
15-
const createdAtTime = timeOf(createdAt);
16-
const createdAtISO = Number.isFinite(createdAtTime)
17-
? new Date(createdAtTime).toJSON()
18-
: undefined;
19-
const createdAtText = Number.isFinite(createdAtTime) ? formatDate(createdAtTime) : '';
13+
({ className = '', id, createdAt, name, sourceLink, link = sourceLink, summary, ...props }) => (
14+
<Card className={`${styles.projectCard} ${className}`} {...props}>
15+
<Card.Body className="d-flex flex-column">
16+
<Card.Title
17+
as="a"
18+
className="text-dark fw-bold"
19+
title={name as string}
20+
target="_blank"
21+
href={link as string}
22+
>
23+
{(name || link) as string}
24+
</Card.Title>
25+
<p className="text-dark opacity-75 mb-3">{summary as string}</p>
26+
<div className="flex-fill mb-3">
27+
<FilePreview className="w-100" path={link as string} />
28+
</div>
2029

21-
return (
22-
<Card className={`${styles.projectCard} ${className}`} {...props}>
23-
<Card.Body className="d-flex flex-column">
24-
<Card.Title
25-
as="a"
26-
className="text-dark fw-bold"
27-
title={name as string}
28-
target="_blank"
29-
href={link as string}
30-
>
31-
{(name || link) as string}
32-
</Card.Title>
33-
<p className="text-dark opacity-75 mb-3">{summary as string}</p>
34-
<div className="flex-fill mb-3">
35-
<FilePreview className="w-100" path={link as string} />
30+
{sourceLink && (
31+
<div className="d-flex flex-wrap gap-2 mb-3">
32+
<Button
33+
variant="dark"
34+
size="sm"
35+
href={sourceLink as string}
36+
target="_blank"
37+
rel="noreferrer"
38+
>
39+
GitHub
40+
</Button>
41+
<Button
42+
variant="primary"
43+
size="sm"
44+
href={`https://github.dev/${(sourceLink as string).replace('https://github.com/', '')}`}
45+
target="_blank"
46+
rel="noreferrer"
47+
>
48+
GitHub.dev
49+
</Button>
50+
<Button
51+
variant="dark"
52+
size="sm"
53+
href={`https://codespaces.new/${(sourceLink as string).replace('https://github.com/', '')}`}
54+
target="_blank"
55+
rel="noreferrer"
56+
>
57+
Codespaces
58+
</Button>
59+
<Button
60+
variant="warning"
61+
size="sm"
62+
href={`https://gitpod.io/#${sourceLink as string}`}
63+
target="_blank"
64+
rel="noreferrer"
65+
>
66+
GitPod
67+
</Button>
3668
</div>
69+
)}
3770

38-
{sourceLink && (
39-
<div className="d-flex flex-wrap gap-2 mb-3">
40-
<Button
41-
variant="dark"
42-
size="sm"
43-
href={sourceLink as string}
44-
target="_blank"
45-
rel="noreferrer"
46-
>
47-
GitHub
48-
</Button>
49-
<Button
50-
variant="primary"
51-
size="sm"
52-
href={`https://github.dev/${(sourceLink as string).replace('https://github.com/', '')}`}
53-
target="_blank"
54-
rel="noreferrer"
55-
>
56-
GitHub.dev
57-
</Button>
58-
<Button
59-
variant="dark"
60-
size="sm"
61-
href={`https://codespaces.new/${(sourceLink as string).replace('https://github.com/', '')}`}
62-
target="_blank"
63-
rel="noreferrer"
64-
>
65-
Codespaces
66-
</Button>
67-
<Button
68-
variant="warning"
69-
size="sm"
70-
href={`https://gitpod.io/#${sourceLink as string}`}
71-
target="_blank"
72-
rel="noreferrer"
73-
>
74-
GitPod
75-
</Button>
76-
</div>
77-
)}
78-
79-
{createdAtISO && (
80-
<time
81-
suppressHydrationWarning
82-
className="text-dark opacity-75 small"
83-
dateTime={createdAtISO}
84-
>
85-
📅 {createdAtText}
86-
</time>
87-
)}
88-
</Card.Body>
89-
</Card>
90-
);
91-
},
71+
<time
72+
suppressHydrationWarning
73+
className="text-dark opacity-75 small"
74+
dateTime={new Date(createdAt as number).toJSON()}
75+
>
76+
📅 {formatDate(createdAt as number)}
77+
</time>
78+
</Card.Body>
79+
</Card>
80+
),
9281
);

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"private": true,
66
"scripts": {
77
"prepare": "husky",
8-
"sync-env": "pnpx git-utility download https://github.com/Open-Source-Bazaar/key-vault main Open-Source-Bazaar.github.io",
9-
"postinstall": "(pnpm run sync-env || true) && next typegen",
8+
"install": "pnpx git-utility download https://github.com/Open-Source-Bazaar/key-vault main Open-Source-Bazaar.github.io || true",
9+
"postinstall": "next typegen",
1010
"dev": "next dev --webpack",
1111
"build": "next build --webpack",
1212
"start": "next start",
@@ -17,7 +17,7 @@
1717
"@koa/router": "^15.4.0",
1818
"@mdx-js/loader": "^3.1.1",
1919
"@mdx-js/react": "^3.1.1",
20-
"@next/mdx": "^16.2.3",
20+
"@next/mdx": "^16.2.4",
2121
"core-js": "^3.49.0",
2222
"echarts-jsx": "^0.6.0",
2323
"file-type": "^22.0.1",
@@ -27,7 +27,7 @@
2727
"koa-jwt": "^4.0.4",
2828
"koajax": "^3.3.0",
2929
"license-filter": "^0.2.5",
30-
"marked": "^18.0.0",
30+
"marked": "^18.0.2",
3131
"mime": "^4.1.0",
3232
"mobx": "^6.15.0",
3333
"mobx-github": "^0.6.2",
@@ -38,10 +38,10 @@
3838
"mobx-restful": "^2.1.4",
3939
"mobx-restful-table": "^2.6.3",
4040
"mobx-strapi": "^0.8.1",
41-
"next": "^16.2.3",
41+
"next": "^16.2.4",
4242
"next-pwa": "^5.6.0",
4343
"next-ssr-middleware": "^1.1.0",
44-
"nodemailer": "^8.0.5",
44+
"nodemailer": "^8.0.7",
4545
"open-react-map": "^0.9.1",
4646
"react": "^19.2.5",
4747
"react-bootstrap": "^2.10.10",
@@ -58,7 +58,7 @@
5858
"@babel/preset-react": "^7.28.5",
5959
"@cspell/eslint-plugin": "^10.0.0",
6060
"@eslint/js": "^10.0.1",
61-
"@next/eslint-plugin-next": "^16.2.3",
61+
"@next/eslint-plugin-next": "^16.2.4",
6262
"@softonus/prettier-plugin-duplicate-remover": "^1.1.2",
6363
"@stylistic/eslint-plugin": "^5.10.0",
6464
"@types/eslint-config-prettier": "^6.11.3",
@@ -69,8 +69,8 @@
6969
"@types/nodemailer": "^8.0.0",
7070
"@types/react": "^19.2.14",
7171
"@types/react-dom": "^19.2.3",
72-
"eslint": "^10.2.0",
73-
"eslint-config-next": "^16.2.3",
72+
"eslint": "^10.2.1",
73+
"eslint-config-next": "^16.2.4",
7474
"eslint-config-prettier": "^10.1.8",
7575
"eslint-plugin-react": "^7.37.5",
7676
"eslint-plugin-simple-import-sort": "^13.0.0",
@@ -85,7 +85,7 @@
8585
"prettier-plugin-css-order": "^2.2.0",
8686
"sass": "^1.99.0",
8787
"typescript": "~5.9.3",
88-
"typescript-eslint": "^8.58.2"
88+
"typescript-eslint": "^8.59.1"
8989
},
9090
"resolutions": {
9191
"mobx-react-helper": "$mobx-react-helper",

pages/hackathon/[id].tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,14 @@ import {
5656
compactSummaryOf,
5757
dateKeyOf,
5858
daysBetween,
59-
firstTextOf,
6059
formatMoment,
6160
formatPeriod,
6261
isPublicForm,
6362
normalizeAgendaType,
6463
previewText,
65-
textListOf,
6664
timeOf,
6765
} from '../../components/Activity/Hackathon/utility';
6866

69-
7067
interface HackathonDetailProps {
7168
activity: Activity;
7269
hackathon: {
@@ -125,7 +122,7 @@ const HackathonDetail: FC<HackathonDetailProps> = observer(({ activity, hackatho
125122
{ people, organizations, agenda, prizes, templates, projects } = hackathon;
126123
const { forms } = databaseSchema;
127124
const formMap = (forms || {}) as Partial<Record<FormGroupKey, TableFormView[]>>;
128-
const summaryText = textListOf(summary).join(' · ') || firstTextOf(summary);
125+
const summaryText = (summary as string) || '';
129126
const agendaItems = [...agenda].sort(({ startedAt: left }, { startedAt: right }) => {
130127
const leftTime = timeOf(left);
131128
const rightTime = timeOf(right);

0 commit comments

Comments
 (0)