Skip to content

Commit

Permalink
[migrate] upgrade to Next.js 15, ESLint 9 & other latest Upstream pac…
Browse files Browse the repository at this point in the history
…kages

[add] Prettier CSS plugins

Signed-off-by: South Drifted <[email protected]>
  • Loading branch information
TechQuery committed Dec 27, 2024
1 parent 9b5f090 commit caca01c
Show file tree
Hide file tree
Showing 37 changed files with 3,104 additions and 2,736 deletions.
10 changes: 0 additions & 10 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Open-source [Hackathon][1] Platform with **Git-based Cloud Development Environme
## Technology stack

- Language: [TypeScript v5][5]
- Component engine: [Next.js v14][6]
- Component engine: [Next.js v15][6]
- Component suite: [Bootstrap v5][7]
- State management: [MobX v6][8]
- PWA framework: [Workbox v6][9]
Expand Down
8 changes: 4 additions & 4 deletions components/Activity/ActivityEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class ActivityEditor extends Component<ActivityEditorProps> {
uri: bannerUrl,
};
});
// @ts-ignore
// @ts-expect-error Type compatibility issue
await activityStore.updateOne(data, name);

if (!name && confirm(t('create_work_success'))) {
Expand Down Expand Up @@ -199,25 +199,25 @@ export class ActivityEditor extends Component<ActivityEditorProps> {
</Form.Group>

<DateTimeInput
key="enrollment"
label={t('enrollment')}
name="enrollment"
key="enrollment"
startAt={enrollmentStartedAt}
endAt={enrollmentEndedAt}
required
/>
<DateTimeInput
key="event"
label={t('activity_time')}
name="event"
key="event"
startAt={eventStartedAt}
endAt={eventEndedAt}
required
/>
<DateTimeInput
key="judge"
label={t('judge_time')}
name="judge"
key="judge"
startAt={judgeStartedAt}
endAt={judgeEndedAt}
required
Expand Down
2 changes: 1 addition & 1 deletion components/Activity/EnrollmentStatistic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default class EnrollmentStatisticCharts extends Component<EnrollmentStati
{Object.entries(answers).map(
([title, answers]) =>
!isEmpty(answers) && (
<Col as="section" key={title}>
<Col key={title} as="section">
<SVGCharts>
<Title>{title}</Title>
<PieSeries
Expand Down
6 changes: 3 additions & 3 deletions components/Activity/QuestionnairePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ export interface QuestionnaireFormProps {
export class QuestionnaireForm extends Component<QuestionnaireFormProps> {
renderField = ({ options, multiple, title, ...props }: Question) =>
options ? (
<Form.Group as="li" className="mb-3" key={title}>
<Form.Group key={title} as="li" className="mb-3">
{title}
<Row xs={1} sm={3} lg={4} className="mt-2">
{options.map(value => (
<Form.Check
key={value}
type={multiple ? 'checkbox' : 'radio'}
label={value}
name={title}
value={value}
id={value}
key={value}
/>
))}
</Row>
</Form.Group>
) : (
<Form.Group as="li" className="mb-3 mt-2" key={title} controlId={title}>
<Form.Group key={title} as="li" className="mb-3 mt-2" controlId={title}>
{title}
<Row>
<Form.Label />
Expand Down
2 changes: 1 addition & 1 deletion components/Git/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const GitCard: FC<GitCardProps> = observer(
<Row as="ul" className="list-unstyled g-4" xs={4}>
{languages &&
Object.keys(languages).map(language => (
<Col as="li" key={language}>
<Col key={language} as="li">
<GitLogo name={language} />
</Col>
))}
Expand Down
4 changes: 2 additions & 2 deletions components/Git/CardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const CardList: FC<XScrollListProps<GitTemplate>> = ({
description,
name = html_url.replace('https://github.com/', ''),
}) => (
<Col as="li" key={id}>
<Col key={id} as="li">
<Card className="shadow-sm">
<Card.Body className="d-flex flex-column gap-3">
<Card.Title as="h3" className="h5">
Expand All @@ -48,7 +48,7 @@ export const CardList: FC<XScrollListProps<GitTemplate>> = ({
<Row as="ul" className="list-unstyled g-4" xs={4}>
{languages &&
Object.keys(languages).map(language => (
<Col as="li" key={language}>
<Col key={language} as="li">
<GitLogo name={language} />
</Col>
))}
Expand Down
2 changes: 1 addition & 1 deletion components/Git/GitTeamCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const GitTeamCard: FC<GitTeamCardProps> = observer(
</nav>
<Row as="ul" className="list-unstyled g-4" xs={4}>
{languages.map(language => (
<Col as="li" key={language}>
<Col key={language} as="li">
<GitLogo name={language} />
</Col>
))}
Expand Down
2 changes: 1 addition & 1 deletion components/Git/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const GitListLayout: FC<GitListLayoutProps> = ({
}) => (
<Row as="ul" className="list-unstyled g-4" xs={1} sm={2}>
{defaultData?.map(item => (
<Col as="li" key={item.id}>
<Col key={item.id} as="li">
<GitCard
className="h-100 shadow-sm"
{...item}
Expand Down
2 changes: 1 addition & 1 deletion components/Git/TeamGitList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const TeamGitListLayout: FC<TeamGitListLayoutProps> = ({
}) => (
<Row as="ul" className="list-unstyled g-4" xs={1} sm={2}>
{defaultData?.map(item => (
<Col as="li" key={item.id}>
<Col key={item.id} as="li">
<GitTeamCard
className="h-100 shadow-sm"
{...item}
Expand Down
12 changes: 6 additions & 6 deletions components/Message/MessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ export const AnnouncementListLayout: FC<AnnouncementListLayoutProps> = observer(
<tr>
<th hidden={hideControls}>
<Form.Check
ref={(input: HTMLInputElement | null) => {
if (input)
input.indeterminate =
!!selectedIds?.length &&
selectedIds.length < defaultData.length;
}}
inline
type="checkbox"
name="announcementId"
checked={
selectedIds?.length > 0 &&
selectedIds?.length === defaultData?.length
}
ref={(input: HTMLInputElement | null) => {
if (input)
input.indeterminate =
!!selectedIds?.length &&
selectedIds.length < defaultData.length;
}}
onChange={() =>
onSelect?.(
selectedIds.length === defaultData.length
Expand Down
4 changes: 2 additions & 2 deletions components/Message/MessageModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ export class AnnouncementModal extends Component<AnnouncementModalProps> {
loading = store.uploading > 0;

return (
<Modal show={show} onHide={onHide} centered>
<Modal show={show} centered onHide={onHide}>
<Modal.Header closeButton>
<Modal.Title>{t('publish_announcement')}</Modal.Title>
</Modal.Header>
<Modal.Body
as="form"
ref={this.form}
as="form"
onSubmit={this.handleSubmit}
onReset={this.handleReset}
>
Expand Down
2 changes: 1 addition & 1 deletion components/NotFoundCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const NotFoundCard: FC<ErrorProps> = ({ title }) =>
i18n.currentLanguage.startsWith('zh') ? (
<script
src="//cdn.dnpw.org/404/v1.min.js"
// @ts-ignore
// @ts-expect-error https://www.dnpw.org/cn/pa-notfound.html
jumptarget="/"
jumptime="-1"
error={title}
Expand Down
6 changes: 3 additions & 3 deletions components/Organization/ActivityOrganizationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class OrganizationModal extends Component<OrganizationModalProps> {
name,
description,
type,
// @ts-ignore
// @ts-expect-error Type compatibility issue
logo: { name, description, uri: logoURI },
url: url,
});
Expand All @@ -56,13 +56,13 @@ export class OrganizationModal extends Component<OrganizationModalProps> {
const loading = store.uploading > 0;

return (
<Modal show={show} onHide={onHide} centered>
<Modal show={show} centered onHide={onHide}>
<Modal.Header closeButton>
<Modal.Title>{t('add_sponsor_information')}</Modal.Title>
</Modal.Header>
<Modal.Body
as="form"
ref={this.form}
as="form"
onSubmit={this.handleSubmit}
onReset={this.handleReset}
>
Expand Down
14 changes: 7 additions & 7 deletions components/Organization/OrganizationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const OrganizationListLayout: FC<XScrollListProps<Organizer>> = ({
}) => (
<ul className="list-unstyled">
{defaultData.map(item => (
<li className="mb-2" key={item.id}>
<li key={item.id} className="mb-2">
<OrganizationCard {...item} />
</li>
))}
Expand All @@ -30,19 +30,19 @@ export const OrganizationTableLayout: FC<XScrollListProps<Organizer>> = ({
<tr>
<th>
<Form.Check
ref={(input: HTMLInputElement | null) => {
if (input)
input.indeterminate =
!!selectedIds?.length &&
selectedIds.length < defaultData.length;
}}
inline
type="checkbox"
name="organizationId"
checked={
selectedIds?.length > 0 &&
selectedIds?.length === defaultData?.length
}
ref={(input: HTMLInputElement | null) => {
if (input)
input.indeterminate =
!!selectedIds?.length &&
selectedIds.length < defaultData.length;
}}
onChange={() =>
onSelect?.(
selectedIds.length === defaultData.length
Expand Down
2 changes: 1 addition & 1 deletion components/PlatformAdmin/PlatformAdminModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class PlatformAdminModal extends Component<PlatformAdminModalProps> {
const loading = store.uploading > 0;

return (
<Modal show={show} onHide={this.handleReset} centered>
<Modal show={show} centered onHide={this.handleReset}>
<Modal.Header closeButton>
<Modal.Title>{t('add_manager')}</Modal.Title>
</Modal.Header>
Expand Down
2 changes: 1 addition & 1 deletion components/Team/TeamAdministratorTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ export const TeamAdministratorTableLayout: FC<TeamAdministratorTableLayoutProps>
as="select"
className={styles.form}
disabled={currentUserId === id}
defaultValue={role}
onChange={({ currentTarget: { value } }) =>
onUpdateRole?.(id, value as TeamMemberRole)
}
defaultValue={role}
>
{Object.entries(RoleName()).map(([key, value]) => (
<option key={key} value={key}>
Expand Down
2 changes: 1 addition & 1 deletion components/Team/TeamParticipantTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ export const TeamParticipantTableLayout: FC<
as="select"
className={styles.form}
disabled={status === 'approved'}
defaultValue={status}
onChange={({ currentTarget: { value } }) =>
onApprove?.(id, value as TeamMemberStatus)
}
defaultValue={status}
>
{Object.entries(StatusName()).map(([key, value]) => (
<option key={key} value={key}>
Expand Down
2 changes: 1 addition & 1 deletion components/Team/WorkEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ export class WorkEditor extends Component<WorkEditorProps> {
<Col sm={10}>
{workTypes.map(({ title, value }) => (
<Form.Check
key={value}
type="radio"
inline
label={title}
name="type"
value={value}
id={value}
key={value}
checked={currentType === value}
onClick={() => (this.currentType = value)}
/>
Expand Down
2 changes: 1 addition & 1 deletion components/User/ActivityAdministratorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class AdministratorModal extends Component<AdministratorModalProps> {
const loading = store.uploading > 0;

return (
<Modal show={show} onHide={this.handleReset} centered>
<Modal show={show} centered onHide={this.handleReset}>
<Modal.Header closeButton>
<Modal.Title>{t('add_manager')}</Modal.Title>
</Modal.Header>
Expand Down
10 changes: 5 additions & 5 deletions components/User/HackathonAdminList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ export const HackathonAdminList: FC<
) : (
<th key={data}>
<Form.Check
inline
type="checkbox"
name="selectAll"
aria-label="selectAll"
checked={selectedIds.length === defaultData.length}
// https://github.com/facebook/react/issues/1798
ref={(input: HTMLInputElement | null) => {
if (input)
input.indeterminate =
!!selectedIds.length &&
selectedIds.length < defaultData.length;
}}
inline
type="checkbox"
name="selectAll"
aria-label="selectAll"
checked={selectedIds.length === defaultData.length}
onChange={() =>
onSelect?.(
selectedIds.length === defaultData.length
Expand Down
2 changes: 1 addition & 1 deletion components/layout/MainBreadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export const MainBreadcrumb: FC<MainBreadcrumbProps> = ({ currentRoute }) => (
<Breadcrumb className="p-1 bg-light rounded">
{currentRoute.map(({ href, title }, index, { length }) => (
<Breadcrumb.Item
className="mt-3"
key={title}
className="mt-3"
href={href}
active={index + 1 === length}
>
Expand Down
Loading

1 comment on commit caca01c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for open-hackathon ready!

✅ Preview
https://open-hackathon-noxwbui6m-techquerys-projects.vercel.app

Built with commit caca01c.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.