Skip to content

Commit

Permalink
[fix] 3 legacy bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
TechQuery committed Nov 28, 2023
1 parent 0e1d228 commit befe45e
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 49 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
## Technology stack

- Language: [TypeScript v5][2]
- Component engine: [Nextjs v13][3]
- Component engine: [Nextjs v14][3]
- Component suite: [Bootstrap v5][4]
- PWA framework: [Workbox v6][5]
- State management: [MobX v6][10]
Expand Down
7 changes: 3 additions & 4 deletions components/AdminFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import userStore from '../models/User';
import { MainNavigator } from './MainNavigator';
import { PageHead } from './PageHead';

const SessionBox = dynamic(() => import('./SessionBox'), { ssr: false }),
{ location } = globalThis,
const { location } = globalThis,
{ t } = i18n;

@observer
Expand Down Expand Up @@ -47,7 +46,7 @@ export class AdminFrame extends PureComponent<PropsWithChildren> {
routes.find(({ path }) => this.routeOf(path).active) || {};

return (
<SessionBox autoCover roles={[Role.Administrator, Role.Manager]}>
<>
<PageHead title={`${title} - ${t('administrator')}`} />

<MainNavigator fluid />
Expand Down Expand Up @@ -86,7 +85,7 @@ export class AdminFrame extends PureComponent<PropsWithChildren> {
{children}
</Container>
</div>
</SessionBox>
</>
);
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"web-utility": "^4.1.3"
},
"devDependencies": {
"@octokit/openapi-types": "^19.0.2",
"@octokit/openapi-types": "^19.1.0",
"@types/lodash": "^4.14.202",
"@types/node": "^18.18.13",
"@types/react": "^18.2.38",
"@types/react": "^18.2.39",
"eslint": "^8.54.0",
"eslint-config-next": "^14.0.3",
"eslint-config-prettier": "^9.0.0",
Expand Down
17 changes: 12 additions & 5 deletions pages/admin/category.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Category, UserInputData } from '@ideamall/data-service';
import { Category, Role, UserInputData } from '@ideamall/data-service';
import { ClickBoundary, Loading, SpinnerButton } from 'idea-react';
import { computed, makeObservable, observable } from 'mobx';
import { observer } from 'mobx-react';
import { FileUploader } from 'mobx-restful-table';
import { createRef, FormEvent, MouseEvent, PureComponent } from 'react';
import dynamic from 'next/dynamic';
import { createRef,FormEvent, MouseEvent, PureComponent } from 'react';
import { Col, FloatingLabel, Form } from 'react-bootstrap';
import { formToJSON } from 'web-utility';

Expand All @@ -13,11 +14,17 @@ import fileStore from '../../models/File';
import { i18n } from '../../models/Translation';
import userStore from '../../models/User';

const SessionBox = dynamic(() => import('../../components/SessionBox'), {
ssr: false,
});

export default function CategoryAdminPage() {
return (
<AdminFrame>
<CategoryAdmin />
</AdminFrame>
<SessionBox autoCover roles={[Role.Administrator, Role.Manager]}>
<AdminFrame>
<CategoryAdmin />
</AdminFrame>
</SessionBox>
);
}

Expand Down
13 changes: 9 additions & 4 deletions pages/admin/goods/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Goods } from '@ideamall/data-service';
import { Goods, Role } from '@ideamall/data-service';
import { Loading, SpinnerButton } from 'idea-react';
import { observer } from 'mobx-react';
import { FormField } from 'mobx-restful-table';
Expand All @@ -19,6 +19,9 @@ import fileStore from '../../../models/File';
import { GoodsModel } from '../../../models/Goods';
import { i18n } from '../../../models/Translation';

const SessionBox = dynamic(() => import('../../../components/SessionBox'), {
ssr: false,
});
const HTMLEditor = dynamic(() => import('../../../components/HTMLEditor'), {
ssr: false,
});
Expand All @@ -33,9 +36,11 @@ export default function GoodsEditorPage({
route: { params },
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
return (
<AdminFrame>
<GoodsEditor id={params!.id} />
</AdminFrame>
<SessionBox autoCover roles={[Role.Administrator, Role.Manager]}>
<AdminFrame>
<GoodsEditor id={params!.id} />
</AdminFrame>
</SessionBox>
);
}

Expand Down
15 changes: 11 additions & 4 deletions pages/admin/goods/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Goods } from '@ideamall/data-service';
import { Goods, Role } from '@ideamall/data-service';
import { Loading, text2color } from 'idea-react';
import { observer } from 'mobx-react';
import { Pager } from 'mobx-restful-table';
import dynamic from 'next/dynamic';
import { PureComponent } from 'react';
import { Badge, Button, Table } from 'react-bootstrap';
import { parseURLData } from 'web-utility';
Expand All @@ -12,11 +13,17 @@ import { isServer } from '../../../models/Base';
import { GoodsModel } from '../../../models/Goods';
import { i18n } from '../../../models/Translation';

const SessionBox = dynamic(() => import('../../../components/SessionBox'), {
ssr: false,
});

export default function GoodsAdminPage() {
return (
<AdminFrame>
<GoodsAdmin />
</AdminFrame>
<SessionBox autoCover roles={[Role.Administrator, Role.Manager]}>
<AdminFrame>
<GoodsAdmin />
</AdminFrame>
</SessionBox>
);
}

Expand Down
15 changes: 11 additions & 4 deletions pages/admin/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import { StatisticSummary } from '@ideamall/data-service';
import { Role, StatisticSummary } from '@ideamall/data-service';
import { observer } from 'mobx-react';
import dynamic from 'next/dynamic';
import { PureComponent } from 'react';
import { Card, Col, Row } from 'react-bootstrap';

import { AdminFrame } from '../../components/AdminFrame';
import { StatisticModel } from '../../models/Statistic';
import { i18n } from '../../models/Translation';

const SessionBox = dynamic(() => import('../../components/SessionBox'), {
ssr: false,
});

export default function AdminHomePage() {
return (
<AdminFrame>
<AdminHome />
</AdminFrame>
<SessionBox autoCover roles={[Role.Administrator, Role.Manager]}>
<AdminFrame>
<AdminHome />
</AdminFrame>
</SessionBox>
);
}

Expand Down
15 changes: 11 additions & 4 deletions pages/admin/user.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Gender, User } from '@ideamall/data-service';
import { Gender, Role, User } from '@ideamall/data-service';
import { Avatar } from 'idea-react';
import { computed } from 'mobx';
import { observer } from 'mobx-react';
import { Column, RestTable } from 'mobx-restful-table';
import dynamic from 'next/dynamic';
import { PureComponent } from 'react';
import { Container, Form } from 'react-bootstrap';

Expand All @@ -11,11 +12,17 @@ import { GenderSymbol, RoleName } from '../../components/data';
import { i18n } from '../../models/Translation';
import userStore from '../../models/User';

const SessionBox = dynamic(() => import('../../components/SessionBox'), {
ssr: false,
});

export default function UserAdminPage() {
return (
<AdminFrame>
<UserAdmin />
</AdminFrame>
<SessionBox autoCover roles={[Role.Administrator, Role.Manager]}>
<AdminFrame>
<UserAdmin />
</AdminFrame>
</SessionBox>
);
}

Expand Down
38 changes: 19 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
docker load < $1
docker image ls -a

docker compose down
docker compose up -d
docker-compose down
docker-compose up -d

docker image prune -a -f

1 comment on commit befe45e

@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 idea-mall ready!

✅ Preview
https://idea-mall-j7slg070j-techquery.vercel.app

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

Please sign in to comment.