Skip to content

Commit

Permalink
Merge pull request #280 from Team-Lecue/SP1/Common
Browse files Browse the repository at this point in the history
common/ dev ㄱ
  • Loading branch information
eunbeann committed Mar 20, 2024
2 parents 601d2e7 + 7eb9c75 commit 23216c5
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 61 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
34 changes: 22 additions & 12 deletions src/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as Sentry from '@sentry/react';
import { AxiosError } from 'axios';
import { Suspense } from 'react';
import { ErrorBoundary, FallbackProps } from 'react-error-boundary';
import { useQueryErrorResetBoundary } from 'react-query';
import { BrowserRouter, Route, Routes } from 'react-router-dom';

Expand All @@ -23,10 +23,27 @@ import StickerPack from './StickerPack/page/StickerPack';
import TargetPage from './Target/page/TargetPage';

function Router() {
const { reset } = useQueryErrorResetBoundary();
interface fallbackProps {
error: Error;
componentStack: string;
eventId: string;
resetError: () => void;
}

function fallback(fallback: fallbackProps) {
const { error, resetError } = fallback;
if (
error instanceof AxiosError &&
(error.response?.status === 401 || error.response?.status === 403)
) {
return <Login />;
}
return <BoundaryErrorPage resetError={resetError} />;
}

return (
<BrowserRouter>
<ErrorBoundary FallbackComponent={fallbackRender} onReset={reset}>
<Sentry.ErrorBoundary fallback={fallback}>
<Suspense fallback={<LoadingPage />}>
<Routes>
<Route path="/" element={<SelectView />} />
Expand All @@ -52,16 +69,9 @@ function Router() {
<Route path="/*" element={<ErrorPage />} />
</Routes>
</Suspense>
</ErrorBoundary>
</Sentry.ErrorBoundary>
</BrowserRouter>
);
}

export default Router;

function fallbackRender({ error, resetErrorBoundary }: FallbackProps) {
if (error.response?.status === 401 || error.response?.status === 403) {
return <Login />;
}
return <BoundaryErrorPage resetErrorBoundary={resetErrorBoundary} />;
}
6 changes: 3 additions & 3 deletions src/components/common/BoundaryErrorPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { ImgError } from '../../../assets';
import * as S from './BoundaryErrorPage.style';

interface BoundaryErrorPageProps {
resetErrorBoundary: (...args: any[]) => void;
resetError: () => void;
}

function BoundaryErrorPage({ resetErrorBoundary }: BoundaryErrorPageProps) {
function BoundaryErrorPage({ resetError }: BoundaryErrorPageProps) {
const navigate = useNavigate();

const handleClickHomeButton = () => {
resetErrorBoundary();
resetError();
navigate('/', { state: { step: 1 } });
};

Expand Down
38 changes: 18 additions & 20 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
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(
// <React.StrictMode>
<App />,
// </React.StrictMode>,
);
ReactDOM.createRoot(document.getElementById('root')!).render(<App />);
117 changes: 93 additions & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
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==
dependencies:
"@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==
Expand All @@ -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/[email protected]":
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"
Expand All @@ -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==
Expand All @@ -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==
Expand Down Expand Up @@ -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==
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -680,6 +749,11 @@
"@sentry/types" "7.93.0"
"@sentry/utils" "7.93.0"

"@sentry/[email protected]":
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/[email protected]", "@sentry/browser@^7.93.0":
version "7.93.0"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.93.0.tgz#acb559125ab0576091a3fc9718e520ba9b2eb1b9"
Expand All @@ -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"
Expand Down Expand Up @@ -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/[email protected]":
Expand Down Expand Up @@ -1439,7 +1515,7 @@ [email protected]:
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==
Expand Down Expand Up @@ -2566,7 +2642,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==
Expand Down Expand Up @@ -3068,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"
Expand Down Expand Up @@ -3261,7 +3330,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==
Expand Down

0 comments on commit 23216c5

Please sign in to comment.