Compare commits

...

6 Commits

Author SHA1 Message Date
ac8e3ab972 fix: revoke local token when profile query failed 2024-03-16 17:23:33 +08:00
cd858cd602 chore: split package 2024-03-16 17:01:33 +08:00
7764f7ca33 chore: update deps 2024-03-16 16:47:05 +08:00
afbf796208 feat: add ProblemDetailPage 2024-03-16 16:46:50 +08:00
df7f87d6bf fix: svg math symbols are not inlined 2024-03-16 16:46:26 +08:00
573227d79c fix: detail endpoint 2024-03-16 16:46:02 +08:00
9 changed files with 374 additions and 64 deletions

View File

@ -24,7 +24,7 @@
"@reduxjs/toolkit": "^2.2.1", "@reduxjs/toolkit": "^2.2.1",
"@tanstack/react-table": "^8.13.2", "@tanstack/react-table": "^8.13.2",
"ace-builds": "^1.32.7", "ace-builds": "^1.32.7",
"framer-motion": "^11.0.13", "framer-motion": "^11.0.14",
"github-markdown-css": "^5.5.1", "github-markdown-css": "^5.5.1",
"prism-react-renderer": "^2.3.1", "prism-react-renderer": "^2.3.1",
"react": "^18.2.0", "react": "^18.2.0",
@ -52,7 +52,7 @@
"eslint-plugin-import": "^2.29.1", "eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-prettier": "^5.1.3", "eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.0", "eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"husky": "^9.0.11", "husky": "^9.0.11",
"jsdom": "^23.2.0", "jsdom": "^23.2.0",

View File

@ -10,7 +10,7 @@ dependencies:
version: 2.1.1(@chakra-ui/system@2.6.2)(react@18.2.0) version: 2.1.1(@chakra-ui/system@2.6.2)(react@18.2.0)
'@chakra-ui/react': '@chakra-ui/react':
specifier: ^2.8.2 specifier: ^2.8.2
version: 2.8.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(@types/react@18.2.66)(framer-motion@11.0.13)(react-dom@18.2.0)(react@18.2.0) version: 2.8.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(@types/react@18.2.66)(framer-motion@11.0.14)(react-dom@18.2.0)(react@18.2.0)
'@dicebear/collection': '@dicebear/collection':
specifier: ^7.1.1 specifier: ^7.1.1
version: 7.1.1(@dicebear/core@7.1.1) version: 7.1.1(@dicebear/core@7.1.1)
@ -33,8 +33,8 @@ dependencies:
specifier: ^1.32.7 specifier: ^1.32.7
version: 1.32.7 version: 1.32.7
framer-motion: framer-motion:
specifier: ^11.0.13 specifier: ^11.0.14
version: 11.0.13(react-dom@18.2.0)(react@18.2.0) version: 11.0.14(react-dom@18.2.0)(react@18.2.0)
github-markdown-css: github-markdown-css:
specifier: ^5.5.1 specifier: ^5.5.1
version: 5.5.1 version: 5.5.1
@ -113,8 +113,8 @@ devDependencies:
specifier: ^5.1.3 specifier: ^5.1.3
version: 5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5) version: 5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5)
eslint-plugin-react: eslint-plugin-react:
specifier: ^7.34.0 specifier: ^7.34.1
version: 7.34.0(eslint@8.57.0) version: 7.34.1(eslint@8.57.0)
eslint-plugin-react-hooks: eslint-plugin-react-hooks:
specifier: ^4.6.0 specifier: ^4.6.0
version: 4.6.0(eslint@8.57.0) version: 4.6.0(eslint@8.57.0)
@ -381,7 +381,7 @@ packages:
'@babel/helper-validator-identifier': 7.22.20 '@babel/helper-validator-identifier': 7.22.20
to-fast-properties: 2.0.0 to-fast-properties: 2.0.0
/@chakra-ui/accordion@2.3.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.13)(react@18.2.0): /@chakra-ui/accordion@2.3.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.14)(react@18.2.0):
resolution: {integrity: sha512-FSXRm8iClFyU+gVaXisOSEw0/4Q+qZbFRiuhIAkVU6Boj0FxAMrlo9a8AV5TuF77rgaHytCdHk0Ng+cyUijrag==} resolution: {integrity: sha512-FSXRm8iClFyU+gVaXisOSEw0/4Q+qZbFRiuhIAkVU6Boj0FxAMrlo9a8AV5TuF77rgaHytCdHk0Ng+cyUijrag==}
peerDependencies: peerDependencies:
'@chakra-ui/system': '>=2.0.0' '@chakra-ui/system': '>=2.0.0'
@ -395,8 +395,8 @@ packages:
'@chakra-ui/react-use-merge-refs': 2.1.0(react@18.2.0) '@chakra-ui/react-use-merge-refs': 2.1.0(react@18.2.0)
'@chakra-ui/shared-utils': 2.0.5 '@chakra-ui/shared-utils': 2.0.5
'@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0) '@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0)
'@chakra-ui/transition': 2.1.0(framer-motion@11.0.13)(react@18.2.0) '@chakra-ui/transition': 2.1.0(framer-motion@11.0.14)(react@18.2.0)
framer-motion: 11.0.13(react-dom@18.2.0)(react@18.2.0) framer-motion: 11.0.14(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0 react: 18.2.0
dev: false dev: false
@ -724,7 +724,7 @@ packages:
react: 18.2.0 react: 18.2.0
dev: false dev: false
/@chakra-ui/menu@2.2.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.13)(react@18.2.0): /@chakra-ui/menu@2.2.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.14)(react@18.2.0):
resolution: {integrity: sha512-lJS7XEObzJxsOwWQh7yfG4H8FzFPRP5hVPN/CL+JzytEINCSBvsCDHrYPQGp7jzpCi8vnTqQQGQe0f8dwnXd2g==} resolution: {integrity: sha512-lJS7XEObzJxsOwWQh7yfG4H8FzFPRP5hVPN/CL+JzytEINCSBvsCDHrYPQGp7jzpCi8vnTqQQGQe0f8dwnXd2g==}
peerDependencies: peerDependencies:
'@chakra-ui/system': '>=2.0.0' '@chakra-ui/system': '>=2.0.0'
@ -746,12 +746,12 @@ packages:
'@chakra-ui/react-use-update-effect': 2.1.0(react@18.2.0) '@chakra-ui/react-use-update-effect': 2.1.0(react@18.2.0)
'@chakra-ui/shared-utils': 2.0.5 '@chakra-ui/shared-utils': 2.0.5
'@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0) '@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0)
'@chakra-ui/transition': 2.1.0(framer-motion@11.0.13)(react@18.2.0) '@chakra-ui/transition': 2.1.0(framer-motion@11.0.14)(react@18.2.0)
framer-motion: 11.0.13(react-dom@18.2.0)(react@18.2.0) framer-motion: 11.0.14(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0 react: 18.2.0
dev: false dev: false
/@chakra-ui/modal@2.3.1(@chakra-ui/system@2.6.2)(@types/react@18.2.66)(framer-motion@11.0.13)(react-dom@18.2.0)(react@18.2.0): /@chakra-ui/modal@2.3.1(@chakra-ui/system@2.6.2)(@types/react@18.2.66)(framer-motion@11.0.14)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-TQv1ZaiJMZN+rR9DK0snx/OPwmtaGH1HbZtlYt4W4s6CzyK541fxLRTjIXfEzIGpvNW+b6VFuFjbcR78p4DEoQ==} resolution: {integrity: sha512-TQv1ZaiJMZN+rR9DK0snx/OPwmtaGH1HbZtlYt4W4s6CzyK541fxLRTjIXfEzIGpvNW+b6VFuFjbcR78p4DEoQ==}
peerDependencies: peerDependencies:
'@chakra-ui/system': '>=2.0.0' '@chakra-ui/system': '>=2.0.0'
@ -767,9 +767,9 @@ packages:
'@chakra-ui/react-use-merge-refs': 2.1.0(react@18.2.0) '@chakra-ui/react-use-merge-refs': 2.1.0(react@18.2.0)
'@chakra-ui/shared-utils': 2.0.5 '@chakra-ui/shared-utils': 2.0.5
'@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0) '@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0)
'@chakra-ui/transition': 2.1.0(framer-motion@11.0.13)(react@18.2.0) '@chakra-ui/transition': 2.1.0(framer-motion@11.0.14)(react@18.2.0)
aria-hidden: 1.2.3 aria-hidden: 1.2.3
framer-motion: 11.0.13(react-dom@18.2.0)(react@18.2.0) framer-motion: 11.0.14(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0 react: 18.2.0
react-dom: 18.2.0(react@18.2.0) react-dom: 18.2.0(react@18.2.0)
react-remove-scroll: 2.5.7(@types/react@18.2.66)(react@18.2.0) react-remove-scroll: 2.5.7(@types/react@18.2.66)(react@18.2.0)
@ -823,7 +823,7 @@ packages:
react: 18.2.0 react: 18.2.0
dev: false dev: false
/@chakra-ui/popover@2.2.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.13)(react@18.2.0): /@chakra-ui/popover@2.2.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.14)(react@18.2.0):
resolution: {integrity: sha512-K+2ai2dD0ljvJnlrzesCDT9mNzLifE3noGKZ3QwLqd/K34Ym1W/0aL1ERSynrcG78NKoXS54SdEzkhCZ4Gn/Zg==} resolution: {integrity: sha512-K+2ai2dD0ljvJnlrzesCDT9mNzLifE3noGKZ3QwLqd/K34Ym1W/0aL1ERSynrcG78NKoXS54SdEzkhCZ4Gn/Zg==}
peerDependencies: peerDependencies:
'@chakra-ui/system': '>=2.0.0' '@chakra-ui/system': '>=2.0.0'
@ -842,7 +842,7 @@ packages:
'@chakra-ui/react-use-merge-refs': 2.1.0(react@18.2.0) '@chakra-ui/react-use-merge-refs': 2.1.0(react@18.2.0)
'@chakra-ui/shared-utils': 2.0.5 '@chakra-ui/shared-utils': 2.0.5
'@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0) '@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0)
framer-motion: 11.0.13(react-dom@18.2.0)(react@18.2.0) framer-motion: 11.0.14(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0 react: 18.2.0
dev: false dev: false
@ -1110,7 +1110,7 @@ packages:
react: 18.2.0 react: 18.2.0
dev: false dev: false
/@chakra-ui/react@2.8.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(@types/react@18.2.66)(framer-motion@11.0.13)(react-dom@18.2.0)(react@18.2.0): /@chakra-ui/react@2.8.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(@types/react@18.2.66)(framer-motion@11.0.14)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-Hn0moyxxyCDKuR9ywYpqgX8dvjqwu9ArwpIb9wHNYjnODETjLwazgNIliCVBRcJvysGRiV51U2/JtJVrpeCjUQ==} resolution: {integrity: sha512-Hn0moyxxyCDKuR9ywYpqgX8dvjqwu9ArwpIb9wHNYjnODETjLwazgNIliCVBRcJvysGRiV51U2/JtJVrpeCjUQ==}
peerDependencies: peerDependencies:
'@emotion/react': ^11.0.0 '@emotion/react': ^11.0.0
@ -1119,7 +1119,7 @@ packages:
react: '>=18' react: '>=18'
react-dom: '>=18' react-dom: '>=18'
dependencies: dependencies:
'@chakra-ui/accordion': 2.3.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.13)(react@18.2.0) '@chakra-ui/accordion': 2.3.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.14)(react@18.2.0)
'@chakra-ui/alert': 2.2.2(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/alert': 2.2.2(@chakra-ui/system@2.6.2)(react@18.2.0)
'@chakra-ui/avatar': 2.3.0(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/avatar': 2.3.0(@chakra-ui/system@2.6.2)(react@18.2.0)
'@chakra-ui/breadcrumb': 2.2.0(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/breadcrumb': 2.2.0(@chakra-ui/system@2.6.2)(react@18.2.0)
@ -1140,11 +1140,11 @@ packages:
'@chakra-ui/layout': 2.3.1(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/layout': 2.3.1(@chakra-ui/system@2.6.2)(react@18.2.0)
'@chakra-ui/live-region': 2.1.0(react@18.2.0) '@chakra-ui/live-region': 2.1.0(react@18.2.0)
'@chakra-ui/media-query': 3.3.0(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/media-query': 3.3.0(@chakra-ui/system@2.6.2)(react@18.2.0)
'@chakra-ui/menu': 2.2.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.13)(react@18.2.0) '@chakra-ui/menu': 2.2.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.14)(react@18.2.0)
'@chakra-ui/modal': 2.3.1(@chakra-ui/system@2.6.2)(@types/react@18.2.66)(framer-motion@11.0.13)(react-dom@18.2.0)(react@18.2.0) '@chakra-ui/modal': 2.3.1(@chakra-ui/system@2.6.2)(@types/react@18.2.66)(framer-motion@11.0.14)(react-dom@18.2.0)(react@18.2.0)
'@chakra-ui/number-input': 2.1.2(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/number-input': 2.1.2(@chakra-ui/system@2.6.2)(react@18.2.0)
'@chakra-ui/pin-input': 2.1.0(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/pin-input': 2.1.0(@chakra-ui/system@2.6.2)(react@18.2.0)
'@chakra-ui/popover': 2.2.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.13)(react@18.2.0) '@chakra-ui/popover': 2.2.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.14)(react@18.2.0)
'@chakra-ui/popper': 3.1.0(react@18.2.0) '@chakra-ui/popper': 3.1.0(react@18.2.0)
'@chakra-ui/portal': 2.1.0(react-dom@18.2.0)(react@18.2.0) '@chakra-ui/portal': 2.1.0(react-dom@18.2.0)(react@18.2.0)
'@chakra-ui/progress': 2.2.0(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/progress': 2.2.0(@chakra-ui/system@2.6.2)(react@18.2.0)
@ -1159,7 +1159,7 @@ packages:
'@chakra-ui/stat': 2.1.1(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/stat': 2.1.1(@chakra-ui/system@2.6.2)(react@18.2.0)
'@chakra-ui/stepper': 2.3.1(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/stepper': 2.3.1(@chakra-ui/system@2.6.2)(react@18.2.0)
'@chakra-ui/styled-system': 2.9.2 '@chakra-ui/styled-system': 2.9.2
'@chakra-ui/switch': 2.1.2(@chakra-ui/system@2.6.2)(framer-motion@11.0.13)(react@18.2.0) '@chakra-ui/switch': 2.1.2(@chakra-ui/system@2.6.2)(framer-motion@11.0.14)(react@18.2.0)
'@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0) '@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0)
'@chakra-ui/table': 2.1.0(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/table': 2.1.0(@chakra-ui/system@2.6.2)(react@18.2.0)
'@chakra-ui/tabs': 3.0.0(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/tabs': 3.0.0(@chakra-ui/system@2.6.2)(react@18.2.0)
@ -1167,14 +1167,14 @@ packages:
'@chakra-ui/textarea': 2.1.2(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/textarea': 2.1.2(@chakra-ui/system@2.6.2)(react@18.2.0)
'@chakra-ui/theme': 3.3.1(@chakra-ui/styled-system@2.9.2) '@chakra-ui/theme': 3.3.1(@chakra-ui/styled-system@2.9.2)
'@chakra-ui/theme-utils': 2.0.21 '@chakra-ui/theme-utils': 2.0.21
'@chakra-ui/toast': 7.0.2(@chakra-ui/system@2.6.2)(framer-motion@11.0.13)(react-dom@18.2.0)(react@18.2.0) '@chakra-ui/toast': 7.0.2(@chakra-ui/system@2.6.2)(framer-motion@11.0.14)(react-dom@18.2.0)(react@18.2.0)
'@chakra-ui/tooltip': 2.3.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.13)(react-dom@18.2.0)(react@18.2.0) '@chakra-ui/tooltip': 2.3.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.14)(react-dom@18.2.0)(react@18.2.0)
'@chakra-ui/transition': 2.1.0(framer-motion@11.0.13)(react@18.2.0) '@chakra-ui/transition': 2.1.0(framer-motion@11.0.14)(react@18.2.0)
'@chakra-ui/utils': 2.0.15 '@chakra-ui/utils': 2.0.15
'@chakra-ui/visually-hidden': 2.2.0(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/visually-hidden': 2.2.0(@chakra-ui/system@2.6.2)(react@18.2.0)
'@emotion/react': 11.11.4(@types/react@18.2.66)(react@18.2.0) '@emotion/react': 11.11.4(@types/react@18.2.66)(react@18.2.0)
'@emotion/styled': 11.11.0(@emotion/react@11.11.4)(@types/react@18.2.66)(react@18.2.0) '@emotion/styled': 11.11.0(@emotion/react@11.11.4)(@types/react@18.2.66)(react@18.2.0)
framer-motion: 11.0.13(react-dom@18.2.0)(react@18.2.0) framer-motion: 11.0.14(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0 react: 18.2.0
react-dom: 18.2.0(react@18.2.0) react-dom: 18.2.0(react@18.2.0)
transitivePeerDependencies: transitivePeerDependencies:
@ -1285,7 +1285,7 @@ packages:
lodash.mergewith: 4.6.2 lodash.mergewith: 4.6.2
dev: false dev: false
/@chakra-ui/switch@2.1.2(@chakra-ui/system@2.6.2)(framer-motion@11.0.13)(react@18.2.0): /@chakra-ui/switch@2.1.2(@chakra-ui/system@2.6.2)(framer-motion@11.0.14)(react@18.2.0):
resolution: {integrity: sha512-pgmi/CC+E1v31FcnQhsSGjJnOE2OcND4cKPyTE+0F+bmGm48Q/b5UmKD9Y+CmZsrt/7V3h8KNczowupfuBfIHA==} resolution: {integrity: sha512-pgmi/CC+E1v31FcnQhsSGjJnOE2OcND4cKPyTE+0F+bmGm48Q/b5UmKD9Y+CmZsrt/7V3h8KNczowupfuBfIHA==}
peerDependencies: peerDependencies:
'@chakra-ui/system': '>=2.0.0' '@chakra-ui/system': '>=2.0.0'
@ -1295,7 +1295,7 @@ packages:
'@chakra-ui/checkbox': 2.3.2(@chakra-ui/system@2.6.2)(react@18.2.0) '@chakra-ui/checkbox': 2.3.2(@chakra-ui/system@2.6.2)(react@18.2.0)
'@chakra-ui/shared-utils': 2.0.5 '@chakra-ui/shared-utils': 2.0.5
'@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0) '@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0)
framer-motion: 11.0.13(react-dom@18.2.0)(react@18.2.0) framer-motion: 11.0.14(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0 react: 18.2.0
dev: false dev: false
@ -1404,7 +1404,7 @@ packages:
'@chakra-ui/theme-tools': 2.1.2(@chakra-ui/styled-system@2.9.2) '@chakra-ui/theme-tools': 2.1.2(@chakra-ui/styled-system@2.9.2)
dev: false dev: false
/@chakra-ui/toast@7.0.2(@chakra-ui/system@2.6.2)(framer-motion@11.0.13)(react-dom@18.2.0)(react@18.2.0): /@chakra-ui/toast@7.0.2(@chakra-ui/system@2.6.2)(framer-motion@11.0.14)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-yvRP8jFKRs/YnkuE41BVTq9nB2v/KDRmje9u6dgDmE5+1bFt3bwjdf9gVbif4u5Ve7F7BGk5E093ARRVtvLvXA==} resolution: {integrity: sha512-yvRP8jFKRs/YnkuE41BVTq9nB2v/KDRmje9u6dgDmE5+1bFt3bwjdf9gVbif4u5Ve7F7BGk5E093ARRVtvLvXA==}
peerDependencies: peerDependencies:
'@chakra-ui/system': 2.6.2 '@chakra-ui/system': 2.6.2
@ -1422,12 +1422,12 @@ packages:
'@chakra-ui/styled-system': 2.9.2 '@chakra-ui/styled-system': 2.9.2
'@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0) '@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0)
'@chakra-ui/theme': 3.3.1(@chakra-ui/styled-system@2.9.2) '@chakra-ui/theme': 3.3.1(@chakra-ui/styled-system@2.9.2)
framer-motion: 11.0.13(react-dom@18.2.0)(react@18.2.0) framer-motion: 11.0.14(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0 react: 18.2.0
react-dom: 18.2.0(react@18.2.0) react-dom: 18.2.0(react@18.2.0)
dev: false dev: false
/@chakra-ui/tooltip@2.3.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.13)(react-dom@18.2.0)(react@18.2.0): /@chakra-ui/tooltip@2.3.1(@chakra-ui/system@2.6.2)(framer-motion@11.0.14)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-Rh39GBn/bL4kZpuEMPPRwYNnccRCL+w9OqamWHIB3Qboxs6h8cOyXfIdGxjo72lvhu1QI/a4KFqkM3St+WfC0A==} resolution: {integrity: sha512-Rh39GBn/bL4kZpuEMPPRwYNnccRCL+w9OqamWHIB3Qboxs6h8cOyXfIdGxjo72lvhu1QI/a4KFqkM3St+WfC0A==}
peerDependencies: peerDependencies:
'@chakra-ui/system': '>=2.0.0' '@chakra-ui/system': '>=2.0.0'
@ -1444,19 +1444,19 @@ packages:
'@chakra-ui/react-use-merge-refs': 2.1.0(react@18.2.0) '@chakra-ui/react-use-merge-refs': 2.1.0(react@18.2.0)
'@chakra-ui/shared-utils': 2.0.5 '@chakra-ui/shared-utils': 2.0.5
'@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0) '@chakra-ui/system': 2.6.2(@emotion/react@11.11.4)(@emotion/styled@11.11.0)(react@18.2.0)
framer-motion: 11.0.13(react-dom@18.2.0)(react@18.2.0) framer-motion: 11.0.14(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0 react: 18.2.0
react-dom: 18.2.0(react@18.2.0) react-dom: 18.2.0(react@18.2.0)
dev: false dev: false
/@chakra-ui/transition@2.1.0(framer-motion@11.0.13)(react@18.2.0): /@chakra-ui/transition@2.1.0(framer-motion@11.0.14)(react@18.2.0):
resolution: {integrity: sha512-orkT6T/Dt+/+kVwJNy7zwJ+U2xAZ3EU7M3XCs45RBvUnZDr/u9vdmaM/3D/rOpmQJWgQBwKPJleUXrYWUagEDQ==} resolution: {integrity: sha512-orkT6T/Dt+/+kVwJNy7zwJ+U2xAZ3EU7M3XCs45RBvUnZDr/u9vdmaM/3D/rOpmQJWgQBwKPJleUXrYWUagEDQ==}
peerDependencies: peerDependencies:
framer-motion: '>=4.0.0' framer-motion: '>=4.0.0'
react: '>=18' react: '>=18'
dependencies: dependencies:
'@chakra-ui/shared-utils': 2.0.5 '@chakra-ui/shared-utils': 2.0.5
framer-motion: 11.0.13(react-dom@18.2.0)(react@18.2.0) framer-motion: 11.0.14(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0 react: 18.2.0
dev: false dev: false
@ -2892,12 +2892,6 @@ packages:
resolution: {integrity: sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==} resolution: {integrity: sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==}
dev: true dev: true
/asynciterator.prototype@1.0.0:
resolution: {integrity: sha512-wwHYEIS0Q80f5mosx3L/dfG5t5rjEa9Ft51GTaNt862EnpyGHpgz2RkZvLPp1oF5TnAiTohkEKVEu8pQPJI7Vg==}
dependencies:
has-symbols: 1.0.3
dev: true
/asynckit@0.4.0: /asynckit@0.4.0:
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
@ -2967,7 +2961,7 @@ packages:
hasBin: true hasBin: true
dependencies: dependencies:
caniuse-lite: 1.0.30001597 caniuse-lite: 1.0.30001597
electron-to-chromium: 1.4.707 electron-to-chromium: 1.4.708
node-releases: 2.0.14 node-releases: 2.0.14
update-browserslist-db: 1.0.13(browserslist@4.23.0) update-browserslist-db: 1.0.13(browserslist@4.23.0)
dev: true dev: true
@ -3189,6 +3183,33 @@ packages:
whatwg-mimetype: 4.0.0 whatwg-mimetype: 4.0.0
whatwg-url: 14.0.0 whatwg-url: 14.0.0
/data-view-buffer@1.0.1:
resolution: {integrity: sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==}
engines: {node: '>= 0.4'}
dependencies:
call-bind: 1.0.7
es-errors: 1.3.0
is-data-view: 1.0.1
dev: true
/data-view-byte-length@1.0.1:
resolution: {integrity: sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==}
engines: {node: '>= 0.4'}
dependencies:
call-bind: 1.0.7
es-errors: 1.3.0
is-data-view: 1.0.1
dev: true
/data-view-byte-offset@1.0.0:
resolution: {integrity: sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==}
engines: {node: '>= 0.4'}
dependencies:
call-bind: 1.0.7
es-errors: 1.3.0
is-data-view: 1.0.1
dev: true
/debug@3.2.7: /debug@3.2.7:
resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
peerDependencies: peerDependencies:
@ -3285,8 +3306,8 @@ packages:
esutils: 2.0.3 esutils: 2.0.3
dev: true dev: true
/electron-to-chromium@1.4.707: /electron-to-chromium@1.4.708:
resolution: {integrity: sha512-qRq74Mo7ChePOU6GHdfAJ0NREXU8vQTlVlfWz3wNygFay6xrd/fY2J7oGHwrhFeU30OVctGLdTh/FcnokTWpng==} resolution: {integrity: sha512-iWgEEvREL4GTXXHKohhh33+6Y8XkPI5eHihDmm8zUk5Zo7HICEW+wI/j5kJ2tbuNUCXJ/sNXa03ajW635DiJXA==}
dev: true dev: true
/emoji-regex@10.3.0: /emoji-regex@10.3.0:
@ -3370,6 +3391,57 @@ packages:
which-typed-array: 1.1.15 which-typed-array: 1.1.15
dev: true dev: true
/es-abstract@1.23.0:
resolution: {integrity: sha512-vmuE7Uoevk2xkwu5Gwa7RfJk/ebVV6xRv7KuZNbUglmJHhWPMbLL20ztreVpBbdxBZijETx3Aml3NssX4SFMvQ==}
engines: {node: '>= 0.4'}
dependencies:
array-buffer-byte-length: 1.0.1
arraybuffer.prototype.slice: 1.0.3
available-typed-arrays: 1.0.7
call-bind: 1.0.7
data-view-buffer: 1.0.1
data-view-byte-length: 1.0.1
data-view-byte-offset: 1.0.0
es-define-property: 1.0.0
es-errors: 1.3.0
es-set-tostringtag: 2.0.3
es-to-primitive: 1.2.1
function.prototype.name: 1.1.6
get-intrinsic: 1.2.4
get-symbol-description: 1.0.2
globalthis: 1.0.3
gopd: 1.0.1
has-property-descriptors: 1.0.2
has-proto: 1.0.3
has-symbols: 1.0.3
hasown: 2.0.2
internal-slot: 1.0.7
is-array-buffer: 3.0.4
is-callable: 1.2.7
is-data-view: 1.0.1
is-negative-zero: 2.0.3
is-regex: 1.1.4
is-shared-array-buffer: 1.0.3
is-string: 1.0.7
is-typed-array: 1.1.13
is-weakref: 1.0.2
object-inspect: 1.13.1
object-keys: 1.1.1
object.assign: 4.1.5
regexp.prototype.flags: 1.5.2
safe-array-concat: 1.1.2
safe-regex-test: 1.0.3
string.prototype.trim: 1.2.8
string.prototype.trimend: 1.0.7
string.prototype.trimstart: 1.0.7
typed-array-buffer: 1.0.2
typed-array-byte-length: 1.0.1
typed-array-byte-offset: 1.0.2
typed-array-length: 1.0.5
unbox-primitive: 1.0.2
which-typed-array: 1.1.15
dev: true
/es-array-method-boxes-properly@1.0.0: /es-array-method-boxes-properly@1.0.0:
resolution: {integrity: sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==} resolution: {integrity: sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==}
dev: true dev: true
@ -3386,14 +3458,13 @@ packages:
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
dev: true dev: true
/es-iterator-helpers@1.0.17: /es-iterator-helpers@1.0.18:
resolution: {integrity: sha512-lh7BsUqelv4KUbR5a/ZTaGGIMLCjPGPqJ6q+Oq24YP0RdyptX1uzm4vvaqzk7Zx3bpl/76YLTTDj9L7uYQ92oQ==} resolution: {integrity: sha512-scxAJaewsahbqTYrGKJihhViaM6DDZDDoucfvzNbK0pOren1g/daDQ3IAhzn+1G14rBG7w+i5N+qul60++zlKA==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
dependencies: dependencies:
asynciterator.prototype: 1.0.0
call-bind: 1.0.7 call-bind: 1.0.7
define-properties: 1.2.1 define-properties: 1.2.1
es-abstract: 1.22.5 es-abstract: 1.23.0
es-errors: 1.3.0 es-errors: 1.3.0
es-set-tostringtag: 2.0.3 es-set-tostringtag: 2.0.3
function-bind: 1.1.2 function-bind: 1.1.2
@ -3602,7 +3673,7 @@ packages:
axobject-query: 3.2.1 axobject-query: 3.2.1
damerau-levenshtein: 1.0.8 damerau-levenshtein: 1.0.8
emoji-regex: 9.2.2 emoji-regex: 9.2.2
es-iterator-helpers: 1.0.17 es-iterator-helpers: 1.0.18
eslint: 8.57.0 eslint: 8.57.0
hasown: 2.0.2 hasown: 2.0.2
jsx-ast-utils: 3.3.5 jsx-ast-utils: 3.3.5
@ -3642,8 +3713,8 @@ packages:
eslint: 8.57.0 eslint: 8.57.0
dev: true dev: true
/eslint-plugin-react@7.34.0(eslint@8.57.0): /eslint-plugin-react@7.34.1(eslint@8.57.0):
resolution: {integrity: sha512-MeVXdReleBTdkz/bvcQMSnCXGi+c9kvy51IpinjnJgutl3YTHWsDdke7Z1ufZpGfDG8xduBDKyjtB9JH1eBKIQ==} resolution: {integrity: sha512-N97CxlouPT1AHt8Jn0mhhN2RrADlUAsk1/atcT2KyA/l9Q/E6ll7OIGwNumFmWfZ9skV3XXccYS19h80rHtgkw==}
engines: {node: '>=4'} engines: {node: '>=4'}
peerDependencies: peerDependencies:
eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8
@ -3654,7 +3725,7 @@ packages:
array.prototype.toreversed: 1.1.2 array.prototype.toreversed: 1.1.2
array.prototype.tosorted: 1.1.3 array.prototype.tosorted: 1.1.3
doctrine: 2.1.0 doctrine: 2.1.0
es-iterator-helpers: 1.0.17 es-iterator-helpers: 1.0.18
eslint: 8.57.0 eslint: 8.57.0
estraverse: 5.3.0 estraverse: 5.3.0
jsx-ast-utils: 3.3.5 jsx-ast-utils: 3.3.5
@ -3887,8 +3958,8 @@ packages:
combined-stream: 1.0.8 combined-stream: 1.0.8
mime-types: 2.1.35 mime-types: 2.1.35
/framer-motion@11.0.13(react-dom@18.2.0)(react@18.2.0): /framer-motion@11.0.14(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-zDjUj7dBiB6WklCvklKH06mwbYO0hzWrq5Rdz/DgeBFsCVQRmb9Zv7I9dPM7lX5c8eMxxba5D6sEVIv1kj/Ttg==} resolution: {integrity: sha512-RFjo2hB1MTW0EWsHQaXgVn0AEUDGxAs0ZL2vVjTTJJu3N7wFiLkmqTn5ysLjL+qKZ9jvfpKXDb9waN9AyLqk8g==}
peerDependencies: peerDependencies:
'@emotion/is-prop-valid': '*' '@emotion/is-prop-valid': '*'
react: ^18.0.0 react: ^18.0.0
@ -4378,6 +4449,13 @@ packages:
dependencies: dependencies:
hasown: 2.0.2 hasown: 2.0.2
/is-data-view@1.0.1:
resolution: {integrity: sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==}
engines: {node: '>= 0.4'}
dependencies:
is-typed-array: 1.1.13
dev: true
/is-date-object@1.0.5: /is-date-object@1.0.5:
resolution: {integrity: sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==} resolution: {integrity: sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
@ -4675,6 +4753,11 @@ packages:
engines: {node: '>=14'} engines: {node: '>=14'}
dev: true dev: true
/lilconfig@3.1.1:
resolution: {integrity: sha512-O18pf7nyvHTckunPWCV1XUNXU1piu01y2b7ATJ0ppkUkk8ocqVWBrYjJBCwHDjD/ZWcfyrA0P4gKhzWGi5EINQ==}
engines: {node: '>=14'}
dev: true
/lines-and-columns@1.2.4: /lines-and-columns@1.2.4:
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
dev: false dev: false
@ -5545,8 +5628,8 @@ packages:
postcss: postcss:
optional: true optional: true
dependencies: dependencies:
lilconfig: 3.0.0 lilconfig: 3.1.1
yaml: 2.3.4 yaml: 2.4.1
dev: true dev: true
/postcss@8.4.35: /postcss@8.4.35:
@ -5828,7 +5911,7 @@ packages:
dependencies: dependencies:
call-bind: 1.0.7 call-bind: 1.0.7
define-properties: 1.2.1 define-properties: 1.2.1
es-abstract: 1.22.5 es-abstract: 1.23.0
es-errors: 1.3.0 es-errors: 1.3.0
get-intrinsic: 1.2.4 get-intrinsic: 1.2.4
globalthis: 1.0.3 globalthis: 1.0.3
@ -6841,6 +6924,12 @@ packages:
engines: {node: '>= 14'} engines: {node: '>= 14'}
dev: true dev: true
/yaml@2.4.1:
resolution: {integrity: sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==}
engines: {node: '>= 14'}
hasBin: true
dev: true
/yocto-queue@0.1.0: /yocto-queue@0.1.0:
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
engines: {node: '>=10'} engines: {node: '>=10'}

View File

@ -85,7 +85,7 @@ export const problemApi = api.injectEndpoints({
}), }),
detail: builder.query<Wrap<DetailResponse>, DetailRequest>({ detail: builder.query<Wrap<DetailResponse>, DetailRequest>({
query: (data: DetailRequest) => ({ query: (data: DetailRequest) => ({
url: "/problem/search", url: "/problem/details",
method: "POST", method: "POST",
body: data, body: data,
}), }),

View File

@ -3,13 +3,10 @@ import { combineSlices, configureStore } from "@reduxjs/toolkit";
import { setupListeners } from "@reduxjs/toolkit/query"; import { setupListeners } from "@reduxjs/toolkit/query";
import { userApi } from "./services/user"; import { userApi } from "./services/user";
import { counterSlice } from "../features/counter/counterSlice";
import { quotesApiSlice } from "../features/quotes/quotesApiSlice";
import { authSlice } from "../features/auth/authSlice"; import { authSlice } from "../features/auth/authSlice";
const dataSlices = [counterSlice, authSlice]; const dataSlices = [authSlice];
const middlewareSlices = [quotesApiSlice, userApi]; const middlewareSlices = [userApi];
const slices = [...dataSlices, ...middlewareSlices]; const slices = [...dataSlices, ...middlewareSlices];
const rootReducer = combineSlices(...slices); const rootReducer = combineSlices(...slices);

View File

@ -1,3 +1,7 @@
.react-markdown { .react-markdown {
padding: 16px; padding: 16px;
svg {
display: inline;
}
} }

View File

@ -0,0 +1,157 @@
import type React from "react";
import { useEffect, useState } from "react";
import {
Accordion,
AccordionButton,
AccordionIcon,
AccordionItem,
AccordionPanel,
Box,
Link,
Select,
Table,
Tag,
Tbody,
Td,
Tr,
Wrap,
WrapItem,
} from "@chakra-ui/react";
import { Link as ReactRouterLink } from "react-router-dom";
import type { DetailResponse, RuntimeInfo } from "../app/services/problem";
const TitleItem = ({ word }: { word: string }) => (
<h2>
<AccordionButton>
<Box as="span" flex="1" textAlign="left">
{word}
</Box>
<AccordionIcon />
</AccordionButton>
</h2>
);
interface ProblemInfoMenuProps {
data?: DetailResponse;
onLanguageSelect?: (lang: string) => void;
action?: React.ReactNode;
}
const EmptyRuntime: RuntimeInfo = {
TimeLimit: 0,
MemoryLimit: 0,
NProcLimit: 0,
};
export default function ProblemInfoMenu(props: ProblemInfoMenuProps) {
const [lang, setLang] = useState(props.data?.context.Languages[0]?.Lang || "c");
const runtime = props.data?.context.Languages.find((x) => x.Lang === lang)?.Runtime.Run || EmptyRuntime;
useEffect(() => {
props.onLanguageSelect && props.onLanguageSelect(lang);
}, [lang, props]);
const problemInfo = (
<Table variant="striped" size="sm">
<Tbody>
<Tr>
<Td>Title</Td>
<Td>{props.data?.problem.title || "..."}</Td>
</Tr>
<Tr>
<Td>Author</Td>
<Td>
<Link
as={ReactRouterLink}
color="blue.500"
to={`/profile/${props.data?.problem.provider.meta.ID || 0}`}
>
{props.data?.problem.provider.nick_name || "..."}
</Link>
</Td>
</Tr>
<Tr>
<Td>Languages</Td>
<Td>
<Wrap>
{props.data?.context.Languages.map((l) => (
<WrapItem key={l.Lang}>
<Tag variant="outline" size="sm" colorScheme="pink">
{l.Lang}
</Tag>
</WrapItem>
))}
</Wrap>
</Td>
</Tr>
<Tr>
<Td>Tags</Td>
<Td>
<Wrap>
{props.data?.problem.tags.Elements.map((t) => (
<WrapItem key={t}>
<Tag variant="outline" size="sm" colorScheme="orange">
{t}
</Tag>
</WrapItem>
))}
</Wrap>
</Td>
</Tr>
</Tbody>
</Table>
);
const taskInfo = (
<Table variant="striped" size="sm">
<Tbody>
<Tr>
<Td>Time Limit</Td>
<Td>{runtime.TimeLimit} ms</Td>
</Tr>
<Tr>
<Td>Memory Limit</Td>
<Td>{runtime.MemoryLimit} MB</Td>
</Tr>
<Tr>
<Td>Process Limit</Td>
<Td>{runtime.NProcLimit}</Td>
</Tr>
<Tr>
<Td>Select</Td>
<Td>
<Select size="sm" onChange={(e) => setLang(e.target.value)} value={lang}>
{props.data?.context.Languages.map((l) => (
<option key={l.Lang} value={l.Lang}>
{l.Lang}
</option>
))}
</Select>
</Td>
</Tr>
</Tbody>
</Table>
);
return (
<>
<Accordion defaultIndex={[0, 1, ...(props.action ? [2] : [])]} allowMultiple>
<AccordionItem>
<TitleItem word="Problem Info" />
<AccordionPanel pb={4}>{problemInfo}</AccordionPanel>
</AccordionItem>
<AccordionItem>
<TitleItem word="Task Info" />
<AccordionPanel pb={4}>{taskInfo}</AccordionPanel>
</AccordionItem>
{props.action && (
<AccordionItem>
<TitleItem word="Action" />
<AccordionPanel pb={4}>{props.action}</AccordionPanel>
</AccordionItem>
)}
</Accordion>
</>
);
}

View File

@ -42,6 +42,11 @@ export const authSlice = createAppSlice({
console.error("Login Failed", action.payload); console.error("Login Failed", action.payload);
localStorage.removeItem("token"); localStorage.removeItem("token");
return { ...initialState, token: null }; return { ...initialState, token: null };
})
.addMatcher(userApi.endpoints.profile.matchRejected, (_state, _action) => {
// Profile Failed
localStorage.removeItem("token");
return { ...initialState, token: null };
}); });
}, },
}); });

View File

@ -0,0 +1,53 @@
import { lazy } from "react";
import { useNavigate, useParams } from "react-router-dom";
import { Box, Button, Stack, Wrap, WrapItem } from "@chakra-ui/react";
import { MdPlayCircleOutline, MdSearch } from "react-icons/md";
import { useDetailQuery } from "../app/services/problem";
const Markdown = lazy(() => import("../components/Markdown"));
const ProblemInfoMenu = lazy(() => import("../components/ProblemInfoMenu"));
export default function ProblemDetailPage() {
const { id } = useParams();
const navigate = useNavigate();
const { data: details } = useDetailQuery({ pid: Number(id) || 0 });
const actionBtn = (
<Wrap>
<WrapItem>
<Button
variant="outline"
size="sm"
leftIcon={<MdPlayCircleOutline />}
onClick={() => navigate(`/problem/${id}/submit`)}
>
Submit
</Button>
</WrapItem>
<WrapItem>
<Button
variant="outline"
size="sm"
leftIcon={<MdSearch />}
onClick={() => navigate(`/problem/${id}/status`)}
>
Status
</Button>
</WrapItem>
</Wrap>
);
return (
<>
<Stack direction={{ base: "column", md: "row" }}>
<Box w="100%">
<Markdown markdown={details?.body.problem.statement || ""} />
</Box>
<Box w="480px">
<ProblemInfoMenu data={details?.body} action={actionBtn} />
</Box>
</Stack>
</>
);
}

View File

@ -9,6 +9,7 @@ const HomePage = lazy(() => import("./pages/HomePage"));
const LoginPage = lazy(() => import("./pages/LoginPage")); const LoginPage = lazy(() => import("./pages/LoginPage"));
const LogoutPage = lazy(() => import("./pages/LogoutPage")); const LogoutPage = lazy(() => import("./pages/LogoutPage"));
const ProblemListPage = lazy(() => import("./pages/ProblemListPage")); const ProblemListPage = lazy(() => import("./pages/ProblemListPage"));
const ProblemDetailPage = lazy(() => import("./pages/ProblemDetailPage"));
export const router: RouteObject[] = [ export const router: RouteObject[] = [
{ {
@ -36,6 +37,10 @@ export const router: RouteObject[] = [
path: "problem", path: "problem",
element: <ProblemListPage />, element: <ProblemListPage />,
}, },
{
path: "problem/:id",
element: <ProblemDetailPage />,
},
], ],
}, },
]; ];