From 689499a4ec484a5d225be668374542483c942712 Mon Sep 17 00:00:00 2001 From: eunbeann Date: Wed, 21 Feb 2024 14:57:28 +0900 Subject: [PATCH 01/37] chore: update sentry --- package.json | 2 +- yarn.lock | 110 +++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 94 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 5b1bad47..c5ea2385 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "@emotion/styled": "^11.11.0", "@sentry/browser": "^7.93.0", "@sentry/react": "^7.93.0", - "@sentry/vite-plugin": "^2.10.2", + "@sentry/vite-plugin": "^2.14.1", "axios": "^1.6.5", "eslint-plugin-react": "^7.33.2", "grapheme-splitter": "^1.0.4", diff --git a/yarn.lock b/yarn.lock index 7ca484db..0ecb7bb4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,7 +7,7 @@ resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== -"@ampproject/remapping@^2.2.0": +"@ampproject/remapping@^2.1.0", "@ampproject/remapping@^2.2.0": version "2.2.1" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630" integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg== @@ -15,7 +15,7 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.22.13", "@babel/code-frame@^7.23.5": +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.22.13", "@babel/code-frame@^7.23.5": version "7.23.5" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.23.5.tgz#9009b69a8c602293476ad598ff53e4562e15c244" integrity sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA== @@ -28,6 +28,27 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.23.5.tgz#ffb878728bb6bdcb6f4510aa51b1be9afb8cfd98" integrity sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw== +"@babel/core@7.18.5": + version "7.18.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.18.5.tgz#c597fa680e58d571c28dda9827669c78cdd7f000" + integrity sha512-MGY8vg3DxMnctw0LdvSEojOsumc70g0t18gNyUdAZqB1Rpd1Bqo/svHGvt+UJ6JcGX+DIekGFDxxIWofBxLCnQ== + dependencies: + "@ampproject/remapping" "^2.1.0" + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.18.2" + "@babel/helper-compilation-targets" "^7.18.2" + "@babel/helper-module-transforms" "^7.18.0" + "@babel/helpers" "^7.18.2" + "@babel/parser" "^7.18.5" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.18.5" + "@babel/types" "^7.18.4" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.1" + semver "^6.3.0" + "@babel/core@^7.21.3", "@babel/core@^7.23.5": version "7.23.7" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.23.7.tgz#4d8016e06a14b5f92530a13ed0561730b5c6483f" @@ -49,7 +70,7 @@ json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.23.6": +"@babel/generator@^7.18.2", "@babel/generator@^7.23.6": version "7.23.6" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.6.tgz#9e1fca4811c77a10580d17d26b57b036133f3c2e" integrity sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw== @@ -59,7 +80,7 @@ "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" -"@babel/helper-compilation-targets@^7.23.6": +"@babel/helper-compilation-targets@^7.18.2", "@babel/helper-compilation-targets@^7.23.6": version "7.23.6" resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz#4d79069b16cbcf1461289eccfbbd81501ae39991" integrity sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ== @@ -97,7 +118,7 @@ dependencies: "@babel/types" "^7.22.15" -"@babel/helper-module-transforms@^7.23.3": +"@babel/helper-module-transforms@^7.18.0", "@babel/helper-module-transforms@^7.23.3": version "7.23.3" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz#d7d12c3c5d30af5b3c0fcab2a6d5217773e2d0f1" integrity sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ== @@ -142,6 +163,15 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz#907a3fbd4523426285365d1206c423c4c5520307" integrity sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw== +"@babel/helpers@^7.18.2": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.23.9.tgz#c3e20bbe7f7a7e10cb9b178384b4affdf5995c7d" + integrity sha512-87ICKgU5t5SzOT7sBMfCOZQ2rHjRU+Pcb9BoILMYz600W6DkVRLFBPwQ18gwUVvggqXivaUakpnxWQGbpywbBQ== + dependencies: + "@babel/template" "^7.23.9" + "@babel/traverse" "^7.23.9" + "@babel/types" "^7.23.9" + "@babel/helpers@^7.23.7": version "7.23.8" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.23.8.tgz#fc6b2d65b16847fd50adddbd4232c76378959e34" @@ -165,6 +195,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.6.tgz#ba1c9e512bda72a47e285ae42aff9d2a635a9e3b" integrity sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ== +"@babel/parser@^7.18.5", "@babel/parser@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.9.tgz#7b903b6149b0f8fa7ad564af646c4c38a77fc44b" + integrity sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA== + "@babel/plugin-transform-react-jsx-self@^7.23.3": version "7.23.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.23.3.tgz#ed3e7dadde046cce761a8e3cf003a13d1a7972d9" @@ -186,6 +221,15 @@ dependencies: regenerator-runtime "^0.14.0" +"@babel/template@^7.16.7", "@babel/template@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.23.9.tgz#f881d0487cba2828d3259dcb9ef5005a9731011a" + integrity sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA== + dependencies: + "@babel/code-frame" "^7.23.5" + "@babel/parser" "^7.23.9" + "@babel/types" "^7.23.9" + "@babel/template@^7.22.15": version "7.22.15" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" @@ -195,6 +239,22 @@ "@babel/parser" "^7.22.15" "@babel/types" "^7.22.15" +"@babel/traverse@^7.18.5", "@babel/traverse@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.9.tgz#2f9d6aead6b564669394c5ce0f9302bb65b9d950" + integrity sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg== + dependencies: + "@babel/code-frame" "^7.23.5" + "@babel/generator" "^7.23.6" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.23.9" + "@babel/types" "^7.23.9" + debug "^4.3.1" + globals "^11.1.0" + "@babel/traverse@^7.23.7": version "7.23.7" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.7.tgz#9a7bf285c928cb99b5ead19c3b1ce5b310c9c305" @@ -220,6 +280,15 @@ "@babel/helper-validator-identifier" "^7.22.20" to-fast-properties "^2.0.0" +"@babel/types@^7.18.4", "@babel/types@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.9.tgz#1dd7b59a9a2b5c87f8b41e52770b5ecbf492e002" + integrity sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q== + dependencies: + "@babel/helper-string-parser" "^7.23.4" + "@babel/helper-validator-identifier" "^7.22.20" + to-fast-properties "^2.0.0" + "@csstools/css-parser-algorithms@^2.4.0": version "2.5.0" resolved "https://registry.yarnpkg.com/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.5.0.tgz#0c03cd5418a9f404a05ff2ffcb1b69d04e8ec532" @@ -680,6 +749,11 @@ "@sentry/types" "7.93.0" "@sentry/utils" "7.93.0" +"@sentry/babel-plugin-component-annotate@2.14.1": + version "2.14.1" + resolved "https://registry.yarnpkg.com/@sentry/babel-plugin-component-annotate/-/babel-plugin-component-annotate-2.14.1.tgz#3eb759809e051d341071b9e1d5a2e8cf35b67c56" + integrity sha512-NHVOr6m0vOoh1UNSZr+OpWQERjjQM7lO48WN/N/MzobIIxc2pymw2KAq3lNJ1SnVAy1t9RNP8u+g6aEFEMGZ/w== + "@sentry/browser@7.93.0", "@sentry/browser@^7.93.0": version "7.93.0" resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.93.0.tgz#acb559125ab0576091a3fc9718e520ba9b2eb1b9" @@ -692,11 +766,13 @@ "@sentry/types" "7.93.0" "@sentry/utils" "7.93.0" -"@sentry/bundler-plugin-core@2.10.2": - version "2.10.2" - resolved "https://registry.yarnpkg.com/@sentry/bundler-plugin-core/-/bundler-plugin-core-2.10.2.tgz#d26f6a67b843eb757eb836020816e68472eee365" - integrity sha512-7IoekLtROlJZqTxtHQ3IhocBuf9dsEq+JjqlHMyZXoq+QKuvJFvMd/4T+r6KjZ15kMZOIkR+spK3V7duH201hw== +"@sentry/bundler-plugin-core@2.14.1": + version "2.14.1" + resolved "https://registry.yarnpkg.com/@sentry/bundler-plugin-core/-/bundler-plugin-core-2.14.1.tgz#419fcd2e792f8b4fc6bb6eb735d09c2325ba1697" + integrity sha512-JbYkeQQ+FTy4KjuJmnjjRGKv1LOSH+Q9cbcMHkr+vNrwAbdxkQ7WURGEKUCFTciIekToMCOiFk+g3FQlRmzLPg== dependencies: + "@babel/core" "7.18.5" + "@sentry/babel-plugin-component-annotate" "2.14.1" "@sentry/cli" "^2.22.3" "@sentry/node" "^7.60.0" "@sentry/utils" "^7.60.0" @@ -812,12 +888,12 @@ dependencies: "@sentry/types" "7.93.0" -"@sentry/vite-plugin@^2.10.2": - version "2.10.2" - resolved "https://registry.yarnpkg.com/@sentry/vite-plugin/-/vite-plugin-2.10.2.tgz#13f40b0dfbaf8451afaab619222da48fda8cf568" - integrity sha512-30uu0L8ZCpAKOxAXmtyqwL06sG8UEBXGY5mxUDITyQYDf8pKuiOEf5018KlEDjhYVypfMQH3jq5xXUUka+/ipg== +"@sentry/vite-plugin@^2.14.1": + version "2.14.1" + resolved "https://registry.yarnpkg.com/@sentry/vite-plugin/-/vite-plugin-2.14.1.tgz#daa9e353990ba141e18f66cd0f80017eb001cfe9" + integrity sha512-leNq+hWaKRhp0e+U1LYVbKBUAN4P+RXhG6GyMLvjKZL0LTsbLni05XeWg3Xy364Xoawcj6vgEN2lVvlpUvUnEQ== dependencies: - "@sentry/bundler-plugin-core" "2.10.2" + "@sentry/bundler-plugin-core" "2.14.1" unplugin "1.0.1" "@svgr/babel-plugin-add-jsx-attribute@8.0.0": @@ -1439,7 +1515,7 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== -convert-source-map@^1.5.0: +convert-source-map@^1.5.0, convert-source-map@^1.7.0: version "1.9.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== @@ -2561,7 +2637,7 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -json5@^2.2.3: +json5@^2.2.1, json5@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== @@ -3256,7 +3332,7 @@ scheduler@^0.23.0: dependencies: loose-envify "^1.1.0" -semver@^6.3.1: +semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== From 73d14d1825670823925076aa66c2ed9e99cdd99b Mon Sep 17 00:00:00 2001 From: eunbeann Date: Wed, 21 Feb 2024 14:58:49 +0900 Subject: [PATCH 02/37] =?UTF-8?q?fix:=20change=20ErrorBoundary=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=EB=B0=94=EC=9A=B4=EB=8D=94=EB=A6=AC=EB=A5=BC=20react-?= =?UTF-8?q?error-boundary=EC=97=90=EC=84=9C=20Sentry=EB=82=B4=EC=9E=A5=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Router.tsx | 24 +++++++++++-------- .../common/BoundaryErrorPage/index.tsx | 7 +----- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/Router.tsx b/src/Router.tsx index b23ae087..2bdcbb74 100644 --- a/src/Router.tsx +++ b/src/Router.tsx @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ +import * as Sentry from '@sentry/react'; import { Suspense } from 'react'; -import { ErrorBoundary, FallbackProps } from 'react-error-boundary'; import { useQueryErrorResetBoundary } from 'react-query'; import { BrowserRouter, Route, Routes } from 'react-router-dom'; @@ -24,9 +24,20 @@ import TargetPage from './Target/page/TargetPage'; function Router() { const { reset } = useQueryErrorResetBoundary(); + + function fallbackRender(error: any) { + if ( + error && + (error.response?.status === 401 || error.response?.status === 403) + ) { + return ; + } + return ; + } + return ( - + }> } /> @@ -52,16 +63,9 @@ function Router() { } /> - + ); } export default Router; - -function fallbackRender({ error, resetErrorBoundary }: FallbackProps) { - if (error.response?.status === 401 || error.response?.status === 403) { - return ; - } - return ; -} diff --git a/src/components/common/BoundaryErrorPage/index.tsx b/src/components/common/BoundaryErrorPage/index.tsx index f19318f5..f9c55d33 100644 --- a/src/components/common/BoundaryErrorPage/index.tsx +++ b/src/components/common/BoundaryErrorPage/index.tsx @@ -4,15 +4,10 @@ import { useNavigate } from 'react-router-dom'; import { ImgError } from '../../../assets'; import * as S from './BoundaryErrorPage.style'; -interface BoundaryErrorPageProps { - resetErrorBoundary: (...args: any[]) => void; -} - -function BoundaryErrorPage({ resetErrorBoundary }: BoundaryErrorPageProps) { +function BoundaryErrorPage() { const navigate = useNavigate(); const handleClickHomeButton = () => { - resetErrorBoundary(); navigate('/', { state: { step: 1 } }); }; From 7dc1b77541ae6ddfa11512509b917bceff8265de Mon Sep 17 00:00:00 2001 From: eunbeann Date: Wed, 21 Feb 2024 14:59:28 +0900 Subject: [PATCH 03/37] =?UTF-8?q?feat:=20=EC=84=BC=ED=8A=B8=EB=A6=AC=20?= =?UTF-8?q?=EC=82=B4=EB=A6=AC=EA=B8=B0=201.=20=ED=94=84=EB=A1=9C=EB=8D=95?= =?UTF-8?q?=EC=85=98=20=ED=99=98=EA=B2=BD=EC=B6=94=EA=B0=80=202.=20Propaga?= =?UTF-8?q?tionTarget=20=EC=98=A4=ED=83=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.tsx | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index f91368c1..fc323fcb 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,22 +1,24 @@ +import * as Sentry from '@sentry/react'; import ReactDOM from 'react-dom/client'; import App from './App.tsx'; -// Sentry.init({ -// dsn: 'https://ff1721b5da5c3ed5ed8c4e4507b6ad51@o4506557086629888.ingest.sentry.io/4506573475741696', -// integrations: [ -// new Sentry.BrowserTracing({ -// tracePropagationTargets: ['localhost', /^https:\/\/www\.lecue\.me/], -// }), -// new Sentry.Replay({ -// maskAllText: false, -// blockAllMedia: false, -// }), -// ], -// tracesSampleRate: 1.0, -// replaysSessionSampleRate: 0.1, -// replaysOnErrorSampleRate: 1.0, -// }); +Sentry.init({ + dsn: 'https://ff1721b5da5c3ed5ed8c4e4507b6ad51@o4506557086629888.ingest.sentry.io/4506573475741696', + environment: 'produnction', + integrations: [ + new Sentry.BrowserTracing({ + tracePropagationTargets: ['localhost', /^https:\/\/lecue\.me\/api/], + }), + new Sentry.Replay({ + maskAllText: false, + blockAllMedia: false, + }), + ], + tracesSampleRate: 1.0, + replaysSessionSampleRate: 0.1, + replaysOnErrorSampleRate: 1.0, +}); ReactDOM.createRoot(document.getElementById('root')!).render( // From 937e0921bd771f0de23c23303e808652e6f5d5ab Mon Sep 17 00:00:00 2001 From: eunbeann Date: Fri, 23 Feb 2024 14:50:48 +0900 Subject: [PATCH 04/37] =?UTF-8?q?fix:=20=EC=97=90=EB=9F=AC=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Router.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Router.tsx b/src/Router.tsx index 2bdcbb74..4dda08a3 100644 --- a/src/Router.tsx +++ b/src/Router.tsx @@ -1,10 +1,9 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import * as Sentry from '@sentry/react'; +import { AxiosError } from 'axios'; import { Suspense } from 'react'; import { useQueryErrorResetBoundary } from 'react-query'; import { BrowserRouter, Route, Routes } from 'react-router-dom'; -import BoundaryErrorPage from './components/common/BoundaryErrorPage'; import ClearToken from './components/common/ClearToken/ClearToken'; import ErrorPage from './components/common/ErrorPage'; import LoadingPage from './components/common/LoadingPage'; @@ -25,14 +24,23 @@ import TargetPage from './Target/page/TargetPage'; function Router() { const { reset } = useQueryErrorResetBoundary(); - function fallbackRender(error: any) { + interface fallbackProps { + error: Error; + componentStack: string; + eventId: string; + resetError(): void; + } + + function fallbackRender(fallback: fallbackProps) { + const error = fallback.error; if ( - error && + error instanceof AxiosError && (error.response?.status === 401 || error.response?.status === 403) ) { return ; } - return ; + console.log('return'); + return ; } return ( From adf5bae9c7e5b5206804db4ffd6c5c10298339e7 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Thu, 29 Feb 2024 19:50:17 +0900 Subject: [PATCH 05/37] =?UTF-8?q?style:=20asset=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/icon/ic_alert_o.svg | 12 ++++++++++++ src/assets/icon/ic_alert_x.svg | 11 +++++++++++ src/assets/icon/ic_home_favorite.svg | 23 ++++++++++++++++++++++ src/assets/icon/ic_profile.svg | 29 ++++++++++++++++++++++++++++ src/assets/index.ts | 8 ++++++++ 5 files changed, 83 insertions(+) create mode 100644 src/assets/icon/ic_alert_o.svg create mode 100644 src/assets/icon/ic_alert_x.svg create mode 100644 src/assets/icon/ic_home_favorite.svg create mode 100644 src/assets/icon/ic_profile.svg diff --git a/src/assets/icon/ic_alert_o.svg b/src/assets/icon/ic_alert_o.svg new file mode 100644 index 00000000..a8163791 --- /dev/null +++ b/src/assets/icon/ic_alert_o.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/assets/icon/ic_alert_x.svg b/src/assets/icon/ic_alert_x.svg new file mode 100644 index 00000000..6d3e3628 --- /dev/null +++ b/src/assets/icon/ic_alert_x.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/assets/icon/ic_home_favorite.svg b/src/assets/icon/ic_home_favorite.svg new file mode 100644 index 00000000..d8b3cc7c --- /dev/null +++ b/src/assets/icon/ic_home_favorite.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/icon/ic_profile.svg b/src/assets/icon/ic_profile.svg new file mode 100644 index 00000000..0b5f53f7 --- /dev/null +++ b/src/assets/icon/ic_profile.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/index.ts b/src/assets/index.ts index 48d600dd..5d5b41fe 100644 --- a/src/assets/index.ts +++ b/src/assets/index.ts @@ -6,6 +6,8 @@ import BtnFloatingStickerOrange from './button/btn_floating_sticker_orange.svg?r import BtnFloatingWrite from './button/btn_floating_write.svg?react'; import BtnFloatingWriteOrange from './button/btn_floating_write_orange.svg?react'; import BtnKakaologin from './button/btn_kakaologin.svg?react'; +import IcAlertO from './icon/ic_alert_o.svg?react'; +import IcAlertX from './icon/ic_alert_x.svg?react'; import IcArrowLeftBlack from './icon/ic_arrow_left_black.svg?react'; import IcArrowLeftWhite from './icon/ic_arrow_left_white.svg?react'; import IcCamera from './icon/ic_camera.svg?react'; @@ -15,7 +17,9 @@ import IcCheck from './icon/ic_check.svg?react'; import IcCrown from './icon/ic_crown.svg?react'; import IcDate from './icon/ic_date.svg?react'; import IcHome from './icon/ic_home.svg?react'; +import IcHomeFavorite from './icon/ic_home_favorite.svg?react'; import IcNotice from './icon/ic_notice.svg?react'; +import IcProfile from './icon/ic_profile.svg?react'; import IcSharing from './icon/ic_sharing.svg?react'; import IcWaste from './icon/ic_waste.svg?react'; import IcX from './icon/ic_x.svg?react'; @@ -56,6 +60,8 @@ export { BtnFloatingWrite, BtnFloatingWriteOrange, BtnKakaologin, + IcAlertO, + IcAlertX, IcArrowLeftBlack, IcArrowLeftWhite, IcCamera, @@ -65,7 +71,9 @@ export { IcCrown, IcDate, IcHome, + IcHomeFavorite, IcNotice, + IcProfile, IcSharing, IcWaste, IcX, From 9dfd9edc7c9cb5af1ec556cfadb554fe51d00de5 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Thu, 29 Feb 2024 19:51:08 +0900 Subject: [PATCH 06/37] =?UTF-8?q?feat:=20navigate=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=ED=8D=BC=EB=B8=94=EB=A6=AC=EC=8B=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NavigateLecueBook.style.ts | 28 ++++++------ .../components/NavigateLecueBook/index.tsx | 44 ++++++++----------- 2 files changed, 32 insertions(+), 40 deletions(-) diff --git a/src/Home/components/NavigateLecueBook/NavigateLecueBook.style.ts b/src/Home/components/NavigateLecueBook/NavigateLecueBook.style.ts index 3af55d88..03fbf33a 100644 --- a/src/Home/components/NavigateLecueBook/NavigateLecueBook.style.ts +++ b/src/Home/components/NavigateLecueBook/NavigateLecueBook.style.ts @@ -8,32 +8,30 @@ export const MainWrapper = styled.div` export const IconWrapper = styled.section` display: flex; - gap: 15.7rem; - justify-content: space-between; + + /* 바뀔 수 있을 것 같으니 디자인 나오면 다시 확인해보기 ! */ + gap: 16rem; align-items: baseline; width: 100%; - padding: 6rem 1.6rem 5rem; + margin: 4rem 1.8rem 3.5rem 1.6rem; `; -export const ButtonWrapper = styled.section` - display: flex; - gap: 1rem; - flex-direction: column; +export const DummyGraphic = styled.div` + width: 37.5rem; + height: 20rem; - padding: 0 9.5rem 4.9rem 0; + background-color: ${({ theme }) => theme.colors.LG}; `; -export const Button = styled.button<{ variant?: boolean }>` - width: 28rem; - height: 6.4rem; +export const Button = styled.button` + padding: 2.1rem 9.4rem 2.2rem 8.8rem; + margin: 2rem 0 4rem; border: 0.1rem solid ${({ theme }) => theme.colors.BG}; border-radius: 0 0.2rem 0.2rem 0; border-left: none; - background-color: ${({ theme, variant }) => - variant ? theme.colors.white : theme.colors.BG}; - color: ${({ theme, variant }) => - variant ? theme.colors.BG : theme.colors.white}; + background-color: ${({ theme }) => theme.colors.BG}; + color: ${({ theme }) => theme.colors.white}; ${({ theme }) => theme.fonts.Title1_SB_16} `; diff --git a/src/Home/components/NavigateLecueBook/index.tsx b/src/Home/components/NavigateLecueBook/index.tsx index 29b9e660..916ec8c0 100644 --- a/src/Home/components/NavigateLecueBook/index.tsx +++ b/src/Home/components/NavigateLecueBook/index.tsx @@ -1,18 +1,25 @@ import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; -import { IcNotice, ImgLogoLecue } from '../../../assets'; +import { IcProfile, ImgLogoLecue } from '../../../assets'; import CommonModal from '../../../components/common/Modal/CommonModal'; import * as S from './NavigateLecueBook.style'; function NavigateLecueBook() { - const NAVIGATE_CATEGORY = ['레큐북 만들기', '내 기록 보기']; const navigate = useNavigate(); const [modalOn, setModalOn] = useState(false); - const handleClickNavBtn = (idx: number) => { + const handleClickIcProfile = () => { if (localStorage.getItem('token')) { - idx === 0 ? navigate('/target') : navigate('/mypage'); + navigate('/mypage'); + } else { + setModalOn(true); + } + }; + + const handleClickNavBtn = () => { + if (localStorage.getItem('token')) { + navigate('/target'); } else { setModalOn(true); } @@ -22,29 +29,16 @@ function NavigateLecueBook() { - - - + + - - {NAVIGATE_CATEGORY.map((category, idx) => { - return ( - handleClickNavBtn(idx)} - > - {category} - - ); - })} - + {/* 임시로 넣은 것! 추후 새로운 그래픽으로 수정 */} + + + + 레큐북 만들기 + {modalOn && ( Date: Mon, 4 Mar 2024 18:50:32 +0900 Subject: [PATCH 07/37] =?UTF-8?q?style:=20=EA=B0=84=EA=B2=A9=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/LecueBookList.style.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Home/components/LecueBookList/LecueBookList.style.ts b/src/Home/components/LecueBookList/LecueBookList.style.ts index 411e6889..c6d876a6 100644 --- a/src/Home/components/LecueBookList/LecueBookList.style.ts +++ b/src/Home/components/LecueBookList/LecueBookList.style.ts @@ -25,11 +25,11 @@ export const Title = styled.header` export const LecueBookList = styled.section` display: grid; - gap: 2.2rem; + gap: 2em 2.4rem; grid-template-columns: repeat(3, 1fr); width: 100%; - padding: 3rem 1.6rem 2.2rem; + padding: 3rem 1.6rem; `; export const LecueBook = styled.li` From 6d8fe012e5736c08caec0c2060587c7c2144da4b Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Mon, 4 Mar 2024 18:51:02 +0900 Subject: [PATCH 08/37] =?UTF-8?q?feat:=20=EB=A0=88=ED=81=90=EB=B6=81=20?= =?UTF-8?q?=EB=B3=B4=EC=97=AC=EC=A3=BC=EB=8A=94=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=EB=A5=BC=20=EA=B3=B5=ED=86=B5=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 44 ++++++++++++--------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index 0bad82f7..a0b77b8e 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -1,8 +1,6 @@ -// import { useNavigate } from 'react-router-dom'; +import { useNavigate } from 'react-router'; -import { useNavigate } from 'react-router-dom'; - -import useGetLecueBook from '../../hooks/useGetLecueBook'; +import NoBookmarkList from '../NoBookmarkList'; import * as S from './LecueBookList.style'; interface BookProps { @@ -12,8 +10,12 @@ interface BookProps { favoriteName: string; } -function LecueBookList() { - const { data } = useGetLecueBook(); +interface LecueBookListProps { + title: string; + data?: [BookProps]; +} + +function LecueBookList({ title, data }: LecueBookListProps) { const navigate = useNavigate(); const handleClickLecueBook = (uuid: string) => { @@ -22,19 +24,23 @@ function LecueBookList() { return ( - 인기 레큐북 구경하기 - - {data && - data.data.map((book: BookProps) => ( - handleClickLecueBook(book.bookUuid)} - > - - {book.favoriteName} - - ))} - + {title} + {data ? ( + + {data && + data.map((book: BookProps) => ( + handleClickLecueBook(book.bookUuid)} + > + + {book.favoriteName} + + ))} + + ) : ( + + )} ); } From d2b73599f6183e4c3a835e5f4013ee94c1fbe351 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Mon, 4 Mar 2024 18:51:22 +0900 Subject: [PATCH 09/37] =?UTF-8?q?feat:=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=ED=95=9C=20=EB=A0=88=ED=81=90=EB=B6=81=EC=9D=B4=20?= =?UTF-8?q?=EC=97=86=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20=EB=9D=84=EC=9B=8C?= =?UTF-8?q?=EC=A4=84=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NoBookmarkList/NoBookmarkList.style.ts | 33 +++++++++++++++++++ src/Home/components/NoBookmarkList/index.tsx | 18 ++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/Home/components/NoBookmarkList/NoBookmarkList.style.ts create mode 100644 src/Home/components/NoBookmarkList/index.tsx diff --git a/src/Home/components/NoBookmarkList/NoBookmarkList.style.ts b/src/Home/components/NoBookmarkList/NoBookmarkList.style.ts new file mode 100644 index 00000000..eb7865c0 --- /dev/null +++ b/src/Home/components/NoBookmarkList/NoBookmarkList.style.ts @@ -0,0 +1,33 @@ +import styled from '@emotion/styled'; + +export const ListWrapper = styled.section` + display: flex; + gap: 2rem; + justify-content: center; + align-items: center; + flex-direction: column; + + padding: 3rem 0; +`; + +export const DescriptionWrapper = styled.article` + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +`; + +export const Description = styled.p` + color: ${({ theme }) => theme.colors.BG}; + ${({ theme }) => theme.fonts.Body2_M_14}; +`; + +export const NavigateBtn = styled.button` + padding: 0.8rem 2.8rem; + + border: 0.1rem solid ${({ theme }) => theme.colors.BG}; + border-radius: 0.6rem; + background-color: ${({ theme }) => theme.colors.white}; + color: ${({ theme }) => theme.colors.BG}; + ${({ theme }) => theme.fonts.Body4_SB_14}; +`; diff --git a/src/Home/components/NoBookmarkList/index.tsx b/src/Home/components/NoBookmarkList/index.tsx new file mode 100644 index 00000000..3b65623c --- /dev/null +++ b/src/Home/components/NoBookmarkList/index.tsx @@ -0,0 +1,18 @@ +import * as S from './NoBookmarkList.style'; + +const NoBookmarkList = () => { + return ( + + + 아직 즐겨찾기한 레큐북이 없어요. + + 자주 보고 싶은 레큐북을 즐겨찾기 해보세요. + + + + 레큐북 보러가기 + + ); +}; + +export default NoBookmarkList; From beca111ad8ba2d13885f5f390b7acd452122e792 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Mon, 4 Mar 2024 18:51:38 +0900 Subject: [PATCH 10/37] =?UTF-8?q?feat:=20=EA=B3=B5=ED=86=B5=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=ED=99=9C=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=97=AC=20=EB=A0=88=ED=81=90=EB=B6=81=20=EB=B3=B4=EC=97=AC?= =?UTF-8?q?=EC=A3=BC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/page/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Home/page/index.tsx b/src/Home/page/index.tsx index 1c4c3db5..97f15783 100644 --- a/src/Home/page/index.tsx +++ b/src/Home/page/index.tsx @@ -8,7 +8,7 @@ import useGetLecueBook from '../hooks/useGetLecueBook'; import * as S from './Home.style'; function Home({ handleStep }: StepProps) { - const { isLoading } = useGetLecueBook(); + const { isLoading, data } = useGetLecueBook(); useEffect(() => { handleStep(1); @@ -19,7 +19,8 @@ function Home({ handleStep }: StepProps) { ) : ( - + + ); } From fcbc77de76206398648c507123d5224b3d65a868 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Mon, 4 Mar 2024 19:54:30 +0900 Subject: [PATCH 11/37] =?UTF-8?q?chore:=20=EC=A3=BC=EC=84=9D=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/page/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Home/page/index.tsx b/src/Home/page/index.tsx index 97f15783..2c54b96b 100644 --- a/src/Home/page/index.tsx +++ b/src/Home/page/index.tsx @@ -19,6 +19,7 @@ function Home({ handleStep }: StepProps) { ) : ( + {/* 서버 api 나오면 즐겨찾기 data props로 넘겨주는 부분 추가할 예정 */} From 4839f854af4f4a124a4935f4743ba2be7008a117 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Mon, 4 Mar 2024 20:05:20 +0900 Subject: [PATCH 12/37] =?UTF-8?q?feat:=20=EB=B2=84=ED=8A=BC=20=ED=81=B4?= =?UTF-8?q?=EB=A6=AD=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/NoBookmarkList/index.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Home/components/NoBookmarkList/index.tsx b/src/Home/components/NoBookmarkList/index.tsx index 3b65623c..c2c43909 100644 --- a/src/Home/components/NoBookmarkList/index.tsx +++ b/src/Home/components/NoBookmarkList/index.tsx @@ -1,6 +1,14 @@ +import { useNavigate } from 'react-router'; + import * as S from './NoBookmarkList.style'; const NoBookmarkList = () => { + const navigate = useNavigate(); + + const handleClickNavigateBtn = () => { + navigate('/mypage'); + }; + return ( @@ -10,7 +18,9 @@ const NoBookmarkList = () => { - 레큐북 보러가기 + + 레큐북 보러가기 + ); }; From 782850586f83fd152a479f21bbd6a58016cc617f Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Mon, 4 Mar 2024 20:23:50 +0900 Subject: [PATCH 13/37] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=97=AC=EB=B6=80=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EB=B6=84?= =?UTF-8?q?=EA=B8=B0=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/page/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Home/page/index.tsx b/src/Home/page/index.tsx index 2c54b96b..d4cd29bf 100644 --- a/src/Home/page/index.tsx +++ b/src/Home/page/index.tsx @@ -8,6 +8,7 @@ import useGetLecueBook from '../hooks/useGetLecueBook'; import * as S from './Home.style'; function Home({ handleStep }: StepProps) { + const token = localStorage.getItem('token'); const { isLoading, data } = useGetLecueBook(); useEffect(() => { @@ -20,7 +21,7 @@ function Home({ handleStep }: StepProps) { {/* 서버 api 나오면 즐겨찾기 data props로 넘겨주는 부분 추가할 예정 */} - + {token && } ); From f70005c72bcbe6527a1b1e9591db33fa46016109 Mon Sep 17 00:00:00 2001 From: eunbeann Date: Tue, 5 Mar 2024 10:28:52 +0900 Subject: [PATCH 14/37] =?UTF-8?q?feat:=20=EC=97=90=EB=9F=AC=20=EB=A6=AC?= =?UTF-8?q?=EC=85=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Router.tsx | 12 ++++++------ src/components/common/BoundaryErrorPage/index.tsx | 7 ++++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Router.tsx b/src/Router.tsx index 4dda08a3..ae89b4e7 100644 --- a/src/Router.tsx +++ b/src/Router.tsx @@ -4,6 +4,7 @@ import { Suspense } from 'react'; import { useQueryErrorResetBoundary } from 'react-query'; import { BrowserRouter, Route, Routes } from 'react-router-dom'; +import BoundaryErrorPage from './components/common/BoundaryErrorPage'; import ClearToken from './components/common/ClearToken/ClearToken'; import ErrorPage from './components/common/ErrorPage'; import LoadingPage from './components/common/LoadingPage'; @@ -28,24 +29,23 @@ function Router() { error: Error; componentStack: string; eventId: string; - resetError(): void; + resetError: () => void; } - function fallbackRender(fallback: fallbackProps) { - const error = fallback.error; + function fallback(fallback: fallbackProps) { + const { error, resetError } = fallback; if ( error instanceof AxiosError && (error.response?.status === 401 || error.response?.status === 403) ) { return ; } - console.log('return'); - return ; + return ; } return ( - + }> } /> diff --git a/src/components/common/BoundaryErrorPage/index.tsx b/src/components/common/BoundaryErrorPage/index.tsx index f9c55d33..fd35fb8c 100644 --- a/src/components/common/BoundaryErrorPage/index.tsx +++ b/src/components/common/BoundaryErrorPage/index.tsx @@ -4,10 +4,15 @@ import { useNavigate } from 'react-router-dom'; import { ImgError } from '../../../assets'; import * as S from './BoundaryErrorPage.style'; -function BoundaryErrorPage() { +interface BoundaryErrorPageProps { + resetError: () => void; +} + +function BoundaryErrorPage({ resetError }: BoundaryErrorPageProps) { const navigate = useNavigate(); const handleClickHomeButton = () => { + resetError(); navigate('/', { state: { step: 1 } }); }; From 5e85e9eb9d70b0f290898fb5f01854febcbc1d97 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Tue, 5 Mar 2024 16:12:47 +0900 Subject: [PATCH 15/37] =?UTF-8?q?refactor:=20=EB=A6=AC=EB=B7=B0=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index a0b77b8e..63a346b0 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -12,7 +12,7 @@ interface BookProps { interface LecueBookListProps { title: string; - data?: [BookProps]; + data?: BookProps[]; } function LecueBookList({ title, data }: LecueBookListProps) { From 0175ef1aa3c2039abeb3dcacf8820c7934045779 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Tue, 5 Mar 2024 17:18:23 +0900 Subject: [PATCH 16/37] =?UTF-8?q?feat:=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20>=20?= =?UTF-8?q?=EB=A0=88=ED=81=90=EB=B6=81=EC=97=90=20=EC=A6=90=EA=B2=A8?= =?UTF-8?q?=EC=B0=BE=EA=B8=B0=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/LecueBookList.style.ts | 8 +++++++- src/Home/components/LecueBookList/index.tsx | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Home/components/LecueBookList/LecueBookList.style.ts b/src/Home/components/LecueBookList/LecueBookList.style.ts index c6d876a6..4bf72bfe 100644 --- a/src/Home/components/LecueBookList/LecueBookList.style.ts +++ b/src/Home/components/LecueBookList/LecueBookList.style.ts @@ -38,13 +38,19 @@ export const LecueBook = styled.li` justify-content: center; align-items: center; flex-direction: column; + position: relative; width: 100%; - height: 14rem; cursor: pointer; `; +export const IconWrapper = styled.div` + position: absolute; + top: 0; + left: 0.1rem; +`; + export const BookImage = styled.img` width: 9.8rem; height: 9.8rem; diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index 63a346b0..5dc07c4a 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -1,5 +1,6 @@ import { useNavigate } from 'react-router'; +import { IcHomeFavorite } from '../../../assets'; import NoBookmarkList from '../NoBookmarkList'; import * as S from './LecueBookList.style'; @@ -17,6 +18,7 @@ interface LecueBookListProps { function LecueBookList({ title, data }: LecueBookListProps) { const navigate = useNavigate(); + const isBookmark = title.includes('즐겨찾기'); const handleClickLecueBook = (uuid: string) => { navigate(`/lecue-book/${uuid}`); @@ -33,6 +35,11 @@ function LecueBookList({ title, data }: LecueBookListProps) { key={book.bookId} onClick={() => handleClickLecueBook(book.bookUuid)} > + {isBookmark && ( + + + + )} {book.favoriteName} From a028b966903ebac99fee539334ef22f313ee14c6 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Tue, 5 Mar 2024 17:49:56 +0900 Subject: [PATCH 17/37] =?UTF-8?q?feat:=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=20=EC=95=84=EC=9D=B4=EC=BD=98=20=ED=81=B4=EB=A6=AD=20?= =?UTF-8?q?=EC=8B=9C,=20=ED=95=B4=EB=8B=B9=20=EB=A0=88=ED=81=90=EB=B6=81?= =?UTF-8?q?=20=EC=82=AC=EB=9D=BC=EC=A7=80=EA=B2=8C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index 5dc07c4a..e0011cfc 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -24,6 +24,15 @@ function LecueBookList({ title, data }: LecueBookListProps) { navigate(`/lecue-book/${uuid}`); }; + const handleClickFavoriteIcon = (bookId: number) => { + // api가 나오면 서버 통신 코드로 변경할 예정! (현재는 임시로 구현해둠) + const clickedBookMark = document.getElementById(`${bookId}`); + + if (clickedBookMark) { + clickedBookMark.style.display = 'none'; + } + }; + return ( {title} @@ -33,10 +42,16 @@ function LecueBookList({ title, data }: LecueBookListProps) { data.map((book: BookProps) => ( handleClickLecueBook(book.bookUuid)} > {isBookmark && ( - + { + e.stopPropagation(); + handleClickFavoriteIcon(book.bookId); + }} + > )} From ece2ce88fc80a69061e6af060cf3608be03574d2 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Thu, 7 Mar 2024 01:08:28 +0900 Subject: [PATCH 18/37] =?UTF-8?q?refactor:=20stopPropagation=20=EC=99=B8?= =?UTF-8?q?=EC=9D=98=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EB=B2=84=EB=B8=94?= =?UTF-8?q?=EB=A7=81=20=EB=B0=A9=EC=A7=80=20=EC=BD=94=EB=93=9C=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index e0011cfc..26703cde 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -40,22 +40,20 @@ function LecueBookList({ title, data }: LecueBookListProps) { {data && data.map((book: BookProps) => ( - handleClickLecueBook(book.bookUuid)} - > + {isBookmark && ( { - e.stopPropagation(); - handleClickFavoriteIcon(book.bookId); - }} + onClick={() => handleClickFavoriteIcon(book.bookId)} > )} - + + handleClickLecueBook(book.bookUuid)} + /> {book.favoriteName} ))} From 6065c063be7b6d5c61f6d437ddf49c9814e6a129 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 13:53:05 +0900 Subject: [PATCH 19/37] =?UTF-8?q?chore:=20=EC=95=88=20=EC=93=B0=EB=8A=94?= =?UTF-8?q?=20=ED=8C=8C=EC=9D=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/hooks/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/Home/hooks/.gitkeep diff --git a/src/Home/hooks/.gitkeep b/src/Home/hooks/.gitkeep deleted file mode 100644 index e69de29b..00000000 From 6a31d263003323e2a00104a69922fd03540f1112 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 13:53:32 +0900 Subject: [PATCH 20/37] =?UTF-8?q?feat:=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=ED=95=9C=20=EB=A0=88=ED=81=90=EB=B6=81=20=EB=B6=88?= =?UTF-8?q?=EB=9F=AC=EC=98=A4=EB=8A=94=20api=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/api/getFavorite.ts | 16 ++++++++++++++++ src/Home/hooks/useGetFavorite.ts | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/Home/api/getFavorite.ts create mode 100644 src/Home/hooks/useGetFavorite.ts diff --git a/src/Home/api/getFavorite.ts b/src/Home/api/getFavorite.ts new file mode 100644 index 00000000..3122b033 --- /dev/null +++ b/src/Home/api/getFavorite.ts @@ -0,0 +1,16 @@ +import { api } from '../../libs/api'; + +const getFavorite = async () => { + const token = localStorage.getItem('token'); + const { data } = await api.get('/api/favorite', { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}`, + }, + }); + return data; + + console.log(data); +}; + +export default getFavorite; diff --git a/src/Home/hooks/useGetFavorite.ts b/src/Home/hooks/useGetFavorite.ts new file mode 100644 index 00000000..fc48f529 --- /dev/null +++ b/src/Home/hooks/useGetFavorite.ts @@ -0,0 +1,19 @@ +import { useQuery } from 'react-query'; +import { useNavigate } from 'react-router-dom'; + +import getFavorite from '../api/getFavorite'; + +const useGetFavorite = () => { + const navigate = useNavigate(); + + const { isLoading: isLoadingFavorite, data: favorite } = useQuery({ + queryKey: ['get-favorite'], + queryFn: () => getFavorite(), + onError: () => navigate('/error'), + refetchOnWindowFocus: false, + }); + + return { isLoading: isLoadingFavorite, data: favorite }; +}; + +export default useGetFavorite; From 76e8207d69f945e2d3527b5bde126fd0ec3ee3a4 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 13:54:24 +0900 Subject: [PATCH 21/37] =?UTF-8?q?chore:=20NoBookmarkList=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=EB=A5=BC=20=EB=A6=AC=ED=84=B4?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EC=A1=B0=EA=B1=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 37 ++++++++++----------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index 26703cde..c77f161d 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -36,27 +36,26 @@ function LecueBookList({ title, data }: LecueBookListProps) { return ( {title} - {data ? ( + {data && data.length !== 0 ? ( - {data && - data.map((book: BookProps) => ( - - {isBookmark && ( - handleClickFavoriteIcon(book.bookId)} - > - - - )} + {data.map((book: BookProps) => ( + + {isBookmark && ( + handleClickFavoriteIcon(book.bookId)} + > + + + )} - handleClickLecueBook(book.bookUuid)} - /> - {book.favoriteName} - - ))} + handleClickLecueBook(book.bookUuid)} + /> + {book.favoriteName} + + ))} ) : ( From 0542994f8387cdd5d3721ceea60746f7d4f0f2bd Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 13:54:47 +0900 Subject: [PATCH 22/37] =?UTF-8?q?feat:=20isLoading,=20data=20=EB=A6=AC?= =?UTF-8?q?=ED=84=B4=20=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/hooks/useGetLecueBook.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Home/hooks/useGetLecueBook.ts b/src/Home/hooks/useGetLecueBook.ts index 0fa4627e..a43b43ea 100644 --- a/src/Home/hooks/useGetLecueBook.ts +++ b/src/Home/hooks/useGetLecueBook.ts @@ -6,14 +6,14 @@ import getLecueBook from '../api/getLecueBook'; const useGetLecueBook = () => { const navigate = useNavigate(); - const { isLoading, data } = useQuery({ + const { isLoading: isLoadingLecueBook, data: lecueBook } = useQuery({ queryKey: ['get-lecue-book'], queryFn: () => getLecueBook(), onError: () => navigate('/error'), refetchOnWindowFocus: false, }); - return { isLoading, data }; + return { isLoading: isLoadingLecueBook, data: lecueBook }; }; export default useGetLecueBook; From ded72362254fddae365baed9788cad1dd61cb3cc Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 13:55:04 +0900 Subject: [PATCH 23/37] =?UTF-8?q?feat:=20=ED=99=88=20=ED=99=94=EB=A9=B4?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=A6=90=EA=B2=A8=EC=B0=BE=EA=B8=B0=20api?= =?UTF-8?q?=20=ED=98=B8=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/page/index.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Home/page/index.tsx b/src/Home/page/index.tsx index d4cd29bf..c13a276b 100644 --- a/src/Home/page/index.tsx +++ b/src/Home/page/index.tsx @@ -4,25 +4,29 @@ import LoadingPage from '../../components/common/LoadingPage'; import { StepProps } from '../../Splash/page/SplashPage'; import LecueBookList from '../components/LecueBookList'; import NavigateLecueBook from '../components/NavigateLecueBook'; +import useGetFavorite from '../hooks/useGetFavorite'; import useGetLecueBook from '../hooks/useGetLecueBook'; import * as S from './Home.style'; function Home({ handleStep }: StepProps) { const token = localStorage.getItem('token'); - const { isLoading, data } = useGetLecueBook(); + const { isLoading: isLoadingLecueBook, data: lecueBook } = useGetLecueBook(); + const { isLoading: isLoadingFavorite, data: favorite } = useGetFavorite(); useEffect(() => { handleStep(1); }, []); - return isLoading ? ( + return isLoadingLecueBook || isLoadingFavorite ? ( ) : ( - {/* 서버 api 나오면 즐겨찾기 data props로 넘겨주는 부분 추가할 예정 */} - {token && } - + + {token && ( + + )} + ); } From 652c34b78f9a884276616d342a504fa80e83178f Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 14:06:19 +0900 Subject: [PATCH 24/37] =?UTF-8?q?chore:=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/api/getFavorite.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Home/api/getFavorite.ts b/src/Home/api/getFavorite.ts index 3122b033..b76b6091 100644 --- a/src/Home/api/getFavorite.ts +++ b/src/Home/api/getFavorite.ts @@ -9,8 +9,6 @@ const getFavorite = async () => { }, }); return data; - - console.log(data); }; export default getFavorite; From 5c8d5afe80d9a0a38eea332feaefd19bc01392b4 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 14:08:07 +0900 Subject: [PATCH 25/37] =?UTF-8?q?feat:=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=20=EC=82=AD=EC=A0=9C=20api=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/api/deleteFavorite.ts | 16 ++++++++++++++++ src/Home/hooks/useDeleteFavorite.ts | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/Home/api/deleteFavorite.ts create mode 100644 src/Home/hooks/useDeleteFavorite.ts diff --git a/src/Home/api/deleteFavorite.ts b/src/Home/api/deleteFavorite.ts new file mode 100644 index 00000000..d47d7c76 --- /dev/null +++ b/src/Home/api/deleteFavorite.ts @@ -0,0 +1,16 @@ +import { api } from '../../libs/api'; + +const deleteFavorite = async (bookId: number) => { + const token = localStorage.getItem('token'); + const { data } = await api.delete('/api/favorite', { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}`, + }, + data: { bookId: bookId }, + }); + + return data; +}; + +export default deleteFavorite; diff --git a/src/Home/hooks/useDeleteFavorite.ts b/src/Home/hooks/useDeleteFavorite.ts new file mode 100644 index 00000000..1c0dfabd --- /dev/null +++ b/src/Home/hooks/useDeleteFavorite.ts @@ -0,0 +1,18 @@ +import { useMutation } from 'react-query'; +import { useNavigate } from 'react-router-dom'; + +import deleteFavorite from '../api/deleteFavorite'; + +const useDeleteFavorite = () => { + const navigate = useNavigate(); + const mutation = useMutation({ + mutationFn: (bookId: number) => { + return deleteFavorite(bookId); + }, + onError: () => navigate('/error'), + onSuccess: () => location.reload(), + }); + return mutation; +}; + +export default useDeleteFavorite; From 825cd4d8a7638bee0b9834faaa7e988e30a29c1f Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 14:08:28 +0900 Subject: [PATCH 26/37] =?UTF-8?q?feat:=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=20=EC=95=84=EC=9D=B4=EC=BD=98=20=ED=81=B4=EB=A6=AD=20?= =?UTF-8?q?=EC=8B=9C=20=EC=82=AD=EC=A0=9C=20api=20=ED=98=B8=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index c77f161d..bbe839f7 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -1,6 +1,7 @@ import { useNavigate } from 'react-router'; import { IcHomeFavorite } from '../../../assets'; +import useDeleteFavorite from '../../hooks/useDeleteFavorite'; import NoBookmarkList from '../NoBookmarkList'; import * as S from './LecueBookList.style'; @@ -18,6 +19,7 @@ interface LecueBookListProps { function LecueBookList({ title, data }: LecueBookListProps) { const navigate = useNavigate(); + const deleteMutation = useDeleteFavorite(); const isBookmark = title.includes('즐겨찾기'); const handleClickLecueBook = (uuid: string) => { @@ -25,12 +27,7 @@ function LecueBookList({ title, data }: LecueBookListProps) { }; const handleClickFavoriteIcon = (bookId: number) => { - // api가 나오면 서버 통신 코드로 변경할 예정! (현재는 임시로 구현해둠) - const clickedBookMark = document.getElementById(`${bookId}`); - - if (clickedBookMark) { - clickedBookMark.style.display = 'none'; - } + deleteMutation.mutate(bookId); }; return ( From a591b1c59578abcb49333e0f2aeac7c37a622e37 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 14:50:22 +0900 Subject: [PATCH 27/37] =?UTF-8?q?chore:=20return=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/api/getFavorite.ts | 2 +- src/Home/api/getLecueBook.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Home/api/getFavorite.ts b/src/Home/api/getFavorite.ts index b76b6091..7c7122d7 100644 --- a/src/Home/api/getFavorite.ts +++ b/src/Home/api/getFavorite.ts @@ -8,7 +8,7 @@ const getFavorite = async () => { Authorization: `Bearer ${token}`, }, }); - return data; + return data.data; }; export default getFavorite; diff --git a/src/Home/api/getLecueBook.ts b/src/Home/api/getLecueBook.ts index 336d2a2b..28a38c07 100644 --- a/src/Home/api/getLecueBook.ts +++ b/src/Home/api/getLecueBook.ts @@ -2,7 +2,7 @@ import { api } from '../../libs/api'; const getLecueBook = async () => { const { data } = await api.get('/api/common/home'); - return data; + return data.data; }; export default getLecueBook; From 9ccb96cd16abedc67fd7c055bcb6f24a2fa7bd48 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 14:50:50 +0900 Subject: [PATCH 28/37] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EB=B6=84=EA=B8=B0=EC=B2=98=EB=A6=AC=20=EC=82=AD=EC=A0=9C,=20st?= =?UTF-8?q?ate=EB=A1=9C=20token=20=EB=84=98=EA=B2=A8=EC=A4=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/NavigateLecueBook/index.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Home/components/NavigateLecueBook/index.tsx b/src/Home/components/NavigateLecueBook/index.tsx index 916ec8c0..6215939f 100644 --- a/src/Home/components/NavigateLecueBook/index.tsx +++ b/src/Home/components/NavigateLecueBook/index.tsx @@ -10,11 +10,9 @@ function NavigateLecueBook() { const [modalOn, setModalOn] = useState(false); const handleClickIcProfile = () => { - if (localStorage.getItem('token')) { - navigate('/mypage'); - } else { - setModalOn(true); - } + const token = localStorage.getItem('token'); + + navigate('/mypage', { state: token }); }; const handleClickNavBtn = () => { From 68d48f791e6c75bb2da6a7a4c903285f2c56f1ef Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 14:51:17 +0900 Subject: [PATCH 29/37] =?UTF-8?q?feat:=20=EC=9D=B8=EA=B8=B0,=20=EC=A6=90?= =?UTF-8?q?=EA=B2=A8=EC=B0=BE=EA=B8=B0=20=EB=A0=88=ED=81=90=EB=B6=81=20api?= =?UTF-8?q?=20=ED=98=B8=EC=B6=9C=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 6 ++++-- src/Home/page/index.tsx | 12 ++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index bbe839f7..014cc93e 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -2,6 +2,8 @@ import { useNavigate } from 'react-router'; import { IcHomeFavorite } from '../../../assets'; import useDeleteFavorite from '../../hooks/useDeleteFavorite'; +import useGetFavorite from '../../hooks/useGetFavorite'; +import useGetLecueBook from '../../hooks/useGetLecueBook'; import NoBookmarkList from '../NoBookmarkList'; import * as S from './LecueBookList.style'; @@ -14,13 +16,13 @@ interface BookProps { interface LecueBookListProps { title: string; - data?: BookProps[]; } -function LecueBookList({ title, data }: LecueBookListProps) { +function LecueBookList({ title }: LecueBookListProps) { const navigate = useNavigate(); const deleteMutation = useDeleteFavorite(); const isBookmark = title.includes('즐겨찾기'); + const { data } = isBookmark ? useGetFavorite() : useGetLecueBook(); const handleClickLecueBook = (uuid: string) => { navigate(`/lecue-book/${uuid}`); diff --git a/src/Home/page/index.tsx b/src/Home/page/index.tsx index c13a276b..9d640380 100644 --- a/src/Home/page/index.tsx +++ b/src/Home/page/index.tsx @@ -4,29 +4,25 @@ import LoadingPage from '../../components/common/LoadingPage'; import { StepProps } from '../../Splash/page/SplashPage'; import LecueBookList from '../components/LecueBookList'; import NavigateLecueBook from '../components/NavigateLecueBook'; -import useGetFavorite from '../hooks/useGetFavorite'; import useGetLecueBook from '../hooks/useGetLecueBook'; import * as S from './Home.style'; function Home({ handleStep }: StepProps) { const token = localStorage.getItem('token'); - const { isLoading: isLoadingLecueBook, data: lecueBook } = useGetLecueBook(); - const { isLoading: isLoadingFavorite, data: favorite } = useGetFavorite(); + const { isLoading: isLoadingLecueBook } = useGetLecueBook(); useEffect(() => { handleStep(1); }, []); - return isLoadingLecueBook || isLoadingFavorite ? ( + return isLoadingLecueBook ? ( ) : ( - {token && ( - - )} - + {token && } + ); } From 030d937559f82f66297708e90688a9a34d62c8bf Mon Sep 17 00:00:00 2001 From: eunbeann Date: Mon, 18 Mar 2024 13:58:10 +0900 Subject: [PATCH 30/37] remove: remove react-error-boundary --- package.json | 1 - yarn.lock | 7 ------- 2 files changed, 8 deletions(-) diff --git a/package.json b/package.json index 164ee4f2..aee5979b 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-draggable": "^4.4.6", - "react-error-boundary": "^4.0.12", "react-query": "^3.39.3", "react-router-dom": "^6.21.1", "vite-plugin-svgr": "^4.2.0" diff --git a/yarn.lock b/yarn.lock index ae7f8863..786627ed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3144,13 +3144,6 @@ react-draggable@^4.4.6: clsx "^1.1.1" prop-types "^15.8.1" -react-error-boundary@^4.0.12: - version "4.0.12" - resolved "https://registry.yarnpkg.com/react-error-boundary/-/react-error-boundary-4.0.12.tgz#59f8f1dbc53bbbb34fc384c8db7cf4082cb63e2c" - integrity sha512-kJdxdEYlb7CPC1A0SeUY38cHpjuu6UkvzKiAmqmOFL21VRfMhOcWxTCBgLVCO0VEMh9JhFNcVaXlV4/BTpiwOA== - dependencies: - "@babel/runtime" "^7.12.5" - react-is@^16.13.1, react-is@^16.7.0: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" From 3144d6f6b1180c59298b2c43a9a83fd61cb979c0 Mon Sep 17 00:00:00 2001 From: eunbeann Date: Mon, 18 Mar 2024 13:59:23 +0900 Subject: [PATCH 31/37] remove: delete unuse reset --- src/Router.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Router.tsx b/src/Router.tsx index ae89b4e7..ecc1b9cf 100644 --- a/src/Router.tsx +++ b/src/Router.tsx @@ -23,8 +23,6 @@ import StickerPack from './StickerPack/page/StickerPack'; import TargetPage from './Target/page/TargetPage'; function Router() { - const { reset } = useQueryErrorResetBoundary(); - interface fallbackProps { error: Error; componentStack: string; From d1a3cd237d335e82bde8bd4e2c30f41d2867b5ce Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Tue, 19 Mar 2024 03:57:07 +0900 Subject: [PATCH 32/37] =?UTF-8?q?refactor:=20refetch=EB=A1=9C=20location.r?= =?UTF-8?q?eload=20=EB=8C=80=EC=B2=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/hooks/useDeleteFavorite.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Home/hooks/useDeleteFavorite.ts b/src/Home/hooks/useDeleteFavorite.ts index 1c0dfabd..81a364e1 100644 --- a/src/Home/hooks/useDeleteFavorite.ts +++ b/src/Home/hooks/useDeleteFavorite.ts @@ -1,16 +1,19 @@ -import { useMutation } from 'react-query'; +import { useMutation, useQueryClient } from 'react-query'; import { useNavigate } from 'react-router-dom'; import deleteFavorite from '../api/deleteFavorite'; const useDeleteFavorite = () => { const navigate = useNavigate(); + const queryClient = useQueryClient(); const mutation = useMutation({ mutationFn: (bookId: number) => { return deleteFavorite(bookId); }, onError: () => navigate('/error'), - onSuccess: () => location.reload(), + onSuccess: () => { + queryClient.refetchQueries(['get-favorite'], { exact: true }); + }, }); return mutation; }; From bfb939f1e9d37aac96e786a48262001b70006e58 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Tue, 19 Mar 2024 03:58:32 +0900 Subject: [PATCH 33/37] =?UTF-8?q?refactor:=20=EC=8B=9C=EB=A9=98=ED=8B=B1?= =?UTF-8?q?=20=ED=83=9C=EA=B7=B8=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/LecueBookList.style.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Home/components/LecueBookList/LecueBookList.style.ts b/src/Home/components/LecueBookList/LecueBookList.style.ts index 4bf72bfe..d1079d34 100644 --- a/src/Home/components/LecueBookList/LecueBookList.style.ts +++ b/src/Home/components/LecueBookList/LecueBookList.style.ts @@ -45,7 +45,7 @@ export const LecueBook = styled.li` cursor: pointer; `; -export const IconWrapper = styled.div` +export const IconWrapper = styled.button` position: absolute; top: 0; left: 0.1rem; From 85b7e418aa1dcd527200295d09d80a3add64ebba Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Tue, 19 Mar 2024 04:03:23 +0900 Subject: [PATCH 34/37] =?UTF-8?q?remove:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=ED=8C=8C=EC=9D=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libs/hooks/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/libs/hooks/.keep diff --git a/src/libs/hooks/.keep b/src/libs/hooks/.keep deleted file mode 100644 index e69de29b..00000000 From a9c51e9060ec8865a21dacb374a1de9db99c94f8 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Tue, 19 Mar 2024 04:03:33 +0900 Subject: [PATCH 35/37] =?UTF-8?q?chore:=20=ED=8F=B4=EB=8D=94=20=EA=B5=AC?= =?UTF-8?q?=EC=A1=B0=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 4 ++-- src/{Home => libs}/api/deleteFavorite.ts | 0 src/{Home => libs}/api/getFavorite.ts | 0 src/{Home => libs}/hooks/useDeleteFavorite.ts | 0 src/{Home => libs}/hooks/useGetFavorite.ts | 0 5 files changed, 2 insertions(+), 2 deletions(-) rename src/{Home => libs}/api/deleteFavorite.ts (100%) rename src/{Home => libs}/api/getFavorite.ts (100%) rename src/{Home => libs}/hooks/useDeleteFavorite.ts (100%) rename src/{Home => libs}/hooks/useGetFavorite.ts (100%) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index 014cc93e..4eda671e 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -1,8 +1,8 @@ import { useNavigate } from 'react-router'; import { IcHomeFavorite } from '../../../assets'; -import useDeleteFavorite from '../../hooks/useDeleteFavorite'; -import useGetFavorite from '../../hooks/useGetFavorite'; +import useDeleteFavorite from '../../../libs/hooks/useDeleteFavorite'; +import useGetFavorite from '../../../libs/hooks/useGetFavorite'; import useGetLecueBook from '../../hooks/useGetLecueBook'; import NoBookmarkList from '../NoBookmarkList'; import * as S from './LecueBookList.style'; diff --git a/src/Home/api/deleteFavorite.ts b/src/libs/api/deleteFavorite.ts similarity index 100% rename from src/Home/api/deleteFavorite.ts rename to src/libs/api/deleteFavorite.ts diff --git a/src/Home/api/getFavorite.ts b/src/libs/api/getFavorite.ts similarity index 100% rename from src/Home/api/getFavorite.ts rename to src/libs/api/getFavorite.ts diff --git a/src/Home/hooks/useDeleteFavorite.ts b/src/libs/hooks/useDeleteFavorite.ts similarity index 100% rename from src/Home/hooks/useDeleteFavorite.ts rename to src/libs/hooks/useDeleteFavorite.ts diff --git a/src/Home/hooks/useGetFavorite.ts b/src/libs/hooks/useGetFavorite.ts similarity index 100% rename from src/Home/hooks/useGetFavorite.ts rename to src/libs/hooks/useGetFavorite.ts From 4ccb041d8919219d3a922a9d7bcd2cd77b5a02fe Mon Sep 17 00:00:00 2001 From: eunbeann Date: Tue, 19 Mar 2024 09:29:26 +0900 Subject: [PATCH 36/37] chore: delete console --- src/main.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index fc323fcb..2efd6356 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -20,8 +20,4 @@ Sentry.init({ replaysOnErrorSampleRate: 1.0, }); -ReactDOM.createRoot(document.getElementById('root')!).render( - // - , - // , -); +ReactDOM.createRoot(document.getElementById('root')!).render(); From 17c2643561b83bfa00a21e7eaae2b83bd5a48f72 Mon Sep 17 00:00:00 2001 From: eunbeann Date: Wed, 20 Mar 2024 12:45:52 +0900 Subject: [PATCH 37/37] hotfix: solve import error --- src/Router.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Router.tsx b/src/Router.tsx index ecc1b9cf..22e2e6f7 100644 --- a/src/Router.tsx +++ b/src/Router.tsx @@ -1,7 +1,6 @@ import * as Sentry from '@sentry/react'; import { AxiosError } from 'axios'; import { Suspense } from 'react'; -import { useQueryErrorResetBoundary } from 'react-query'; import { BrowserRouter, Route, Routes } from 'react-router-dom'; import BoundaryErrorPage from './components/common/BoundaryErrorPage';