Skip to content

Commit 73a9798

Browse files
committed
[optimize] simplify several details & update Upstream packages
1 parent 71450db commit 73a9798

File tree

6 files changed

+283
-313
lines changed

6 files changed

+283
-313
lines changed

components/Activity/AgendaList.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ import userStore from '../../models/User';
1212
import { renderTagInput } from '../Tag';
1313

1414
export interface AgendaListProps {
15+
userId?: number;
1516
activityId?: number;
1617
isOrganizer?: boolean;
17-
userId?: number;
1818
}
1919

2020
@observer
2121
export class AgendaList extends ObservedComponent<AgendaListProps, typeof i18n> {
2222
static contextType = I18nContext;
2323

24-
agendaStore = new AgendaModel(this.props.activityId);
24+
agendaStore = new AgendaModel();
2525

2626
@computed
2727
get columns(): Column<Agenda>[] {
@@ -43,12 +43,14 @@ export class AgendaList extends ObservedComponent<AgendaListProps, typeof i18n>
4343
},
4444
{
4545
renderHead: t('start_time'),
46-
renderBody: ({ forum }) => forum?.startTime ? new Date(forum.startTime).toLocaleString() : '-',
46+
renderBody: ({ forum }) =>
47+
forum?.startTime ? new Date(forum.startTime).toLocaleString() : '-',
4748
type: 'datetime-local',
4849
},
4950
{
5051
renderHead: t('end_time'),
51-
renderBody: ({ forum }) => forum?.endTime ? new Date(forum.endTime).toLocaleString() : '-',
52+
renderBody: ({ forum }) =>
53+
forum?.endTime ? new Date(forum.endTime).toLocaleString() : '-',
5254
type: 'datetime-local',
5355
},
5456
{
@@ -61,8 +63,7 @@ export class AgendaList extends ObservedComponent<AgendaListProps, typeof i18n>
6163
{
6264
key: 'mentors',
6365
renderHead: t('mentors'),
64-
renderBody: ({ mentors }) =>
65-
mentors?.map(mentor => mentor.name).join(', ') || '-',
66+
renderBody: ({ mentors }) => mentors?.map(mentor => mentor.name).join(', ') || '-',
6667
renderInput: renderTagInput(userStore),
6768
required: true,
6869
invalidMessage: t('field_required'),
@@ -83,7 +84,7 @@ export class AgendaList extends ObservedComponent<AgendaListProps, typeof i18n>
8384

8485
render() {
8586
const { activityId, userId } = this.props;
86-
87+
8788
return (
8889
<RestTable
8990
className="h-100 text-center"
@@ -93,9 +94,9 @@ export class AgendaList extends ObservedComponent<AgendaListProps, typeof i18n>
9394
deletable
9495
columns={this.columns}
9596
store={this.agendaStore}
96-
{...({ filter: { activity: activityId, createdBy: userId } } as any)}
97+
filter={{ activity: activityId, createdBy: userId }}
9798
translator={this.observedContext}
9899
/>
99100
);
100101
}
101-
}
102+
}

components/Session/List.tsx

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,15 @@ import { Button } from 'react-bootstrap';
88
import sessionStore from '../../models/Session';
99
import { i18n, I18nContext } from '../../models/Translation';
1010

11-
export interface SessionListProps {
12-
showActions?: boolean;
13-
}
14-
1511
@observer
16-
export class SessionList extends ObservedComponent<SessionListProps, typeof i18n> {
12+
export class SessionList extends ObservedComponent<{}, typeof i18n> {
1713
static contextType = I18nContext;
1814

1915
@computed
2016
get columns(): Column<Session>[] {
2117
const { t } = this.observedContext;
22-
const { showActions = true } = this.observedProps;
2318

24-
const baseColumns: Column<Session>[] = [
19+
return [
2520
{
2621
key: 'title',
2722
renderHead: t('title'),
@@ -52,36 +47,29 @@ export class SessionList extends ObservedComponent<SessionListProps, typeof i18n
5247
type: 'number',
5348
min: 1,
5449
},
55-
];
56-
57-
if (showActions) {
58-
baseColumns.push({
50+
{
5951
renderHead: t('actions'),
6052
renderBody: () => (
6153
<Button variant="outline-success" size="sm" href="/user/agenda">
6254
{t('submit_to_activity')}
6355
</Button>
6456
),
65-
});
66-
}
67-
68-
return baseColumns;
57+
},
58+
];
6959
}
7060

7161
render() {
72-
const { showActions = true } = this.observedProps;
73-
7462
return (
7563
<RestTable
7664
className="h-100 text-center"
7765
striped
7866
hover
79-
editable={showActions}
80-
deletable={showActions}
67+
editable
68+
deletable
8169
columns={this.columns}
8270
store={sessionStore}
8371
translator={this.observedContext}
8472
/>
8573
);
8674
}
87-
}
75+
}

models/Agenda.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ import { TableModel } from './Base';
44
import userStore from './User';
55

66
export class AgendaModel extends TableModel<Agenda> {
7-
baseURI = '';
7+
baseURI = 'agenda';
88
client = userStore.client;
9-
10-
constructor(activityId: number) {
11-
super();
12-
this.baseURI = `activity/${activityId}/agenda`;
13-
}
14-
}
9+
}

next-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3+
/// <reference path="./.next/types/routes.d.ts" />
34

45
// NOTE: This file should not be edited
56
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
"@koa/router": "^14.0.0",
1919
"@mdx-js/loader": "^3.1.0",
2020
"@mdx-js/react": "^3.1.0",
21-
"@next/mdx": "^15.4.7",
21+
"@next/mdx": "^15.5.0",
2222
"@passwordless-id/webauthn": "^2.3.1",
2323
"@sentry/nextjs": "^10.5.0",
2424
"copy-webpack-plugin": "^13.0.1",
25-
"core-js": "^3.45.0",
25+
"core-js": "^3.45.1",
2626
"editorjs-html": "^4.0.5",
2727
"idb-keyval": "^6.2.2",
2828
"idea-react": "^2.0.0-rc.13",
@@ -38,8 +38,8 @@
3838
"mobx-react": "^9.2.0",
3939
"mobx-react-helper": "^0.5.1",
4040
"mobx-restful": "^2.1.0",
41-
"mobx-restful-table": "^2.5.2",
42-
"next": "^15.4.7",
41+
"mobx-restful-table": "^2.5.3",
42+
"next": "^15.5.0",
4343
"next-pwa": "~5.6.0",
4444
"next-ssr-middleware": "^1.0.2",
4545
"next-with-less": "^3.0.1",
@@ -52,7 +52,7 @@
5252
"remark-frontmatter": "^5.0.0",
5353
"remark-gfm": "^4.0.1",
5454
"remark-mdx-frontmatter": "^5.2.0",
55-
"undici": "^7.14.0",
55+
"undici": "^7.15.0",
5656
"web-utility": "^4.5.1",
5757
"webpack": "^5.101.3",
5858
"yaml": "^2.8.1"
@@ -65,7 +65,7 @@
6565
"@eslint/compat": "^1.3.2",
6666
"@eslint/eslintrc": "^3.3.1",
6767
"@eslint/js": "^9.33.0",
68-
"@next/eslint-plugin-next": "^15.4.7",
68+
"@next/eslint-plugin-next": "^15.5.0",
6969
"@open-source-bazaar/activityhub-service": "1.0.0-rc.1",
7070
"@softonus/prettier-plugin-duplicate-remover": "^1.1.2",
7171
"@stylistic/eslint-plugin": "^5.2.3",
@@ -75,7 +75,7 @@
7575
"@types/lodash": "^4.17.20",
7676
"@types/next-pwa": "^5.6.9",
7777
"@types/node": "^22.17.2",
78-
"@types/react": "^19.1.10",
78+
"@types/react": "^19.1.11",
7979
"dotenv-cli": "^10.0.0",
8080
"eslint": "^9.33.0",
8181
"eslint-config-prettier": "^10.1.8",
@@ -92,7 +92,8 @@
9292
"typescript-eslint": "^8.40.0"
9393
},
9494
"resolutions": {
95-
"next": "$next"
95+
"next": "$next",
96+
"mobx-react-helper": "$mobx-react-helper"
9697
},
9798
"pnpm": {
9899
"onlyBuiltDependencies": [

0 commit comments

Comments
 (0)