From 2e8f22bed47998239159e32537b1c298b042c5e8 Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 20 Jun 2023 10:52:56 +0800 Subject: [PATCH] fix: styles Signed-off-by: Innei --- package.json | 4 ---- sentry.client.config.ts | 5 +++++ src/app/error.tsx | 7 +++++++ src/app/global-error.tsx | 3 +++ src/app/notes/Paper.tsx | 2 +- src/app/notes/[id]/page.tsx | 6 +++--- src/app/notes/error.tsx | 9 +++++++++ src/app/notes/sentry-test/page.tsx | 9 +++++++++ .../layout/header/internal/HeaderDrawerButton.tsx | 3 ++- src/components/widgets/xlog/XLogInfo.tsx | 2 +- src/providers/root/modal-stack-provider.tsx | 2 +- 11 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 src/app/notes/sentry-test/page.tsx diff --git a/package.json b/package.json index 3fe0f20f7d..9d02da56b4 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,6 @@ "prod:stop": "pm2 stop ecosystem.config.js", "prod:reload": "pm2 reload ecosystem.config.js" }, - "browserslist": [ - "chrome >=110", - "last 2 Firefox versions" - ], "dependencies": { "@clerk/nextjs": "4.21.3", "@floating-ui/react-dom": "2.0.1", diff --git a/sentry.client.config.ts b/sentry.client.config.ts index 47c7f7ebaa..6491ad577a 100644 --- a/sentry.client.config.ts +++ b/sentry.client.config.ts @@ -29,5 +29,10 @@ Sentry.init({ maskAllText: true, blockAllMedia: true, }), + // eslint-disable-next-line import/namespace + new Sentry.BrowserTracing({ + // Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled + tracePropagationTargets: ['localhost', /^https:\/\/api\.innei\.ren/], + }), ], }) diff --git a/src/app/error.tsx b/src/app/error.tsx index 44f568688a..52d72615b7 100644 --- a/src/app/error.tsx +++ b/src/app/error.tsx @@ -1,5 +1,12 @@ 'use client' +import { useEffect } from 'react' + +import { captureException } from '@sentry/nextjs' + export default ({ error, reset }: any) => { + useEffect(() => { + captureException(error) + }, [error]) return
Something went wrong
} diff --git a/src/app/global-error.tsx b/src/app/global-error.tsx index 1bca45f96d..d8bad32933 100644 --- a/src/app/global-error.tsx +++ b/src/app/global-error.tsx @@ -2,10 +2,13 @@ import { useEffect } from 'react' +import { captureException } from '@sentry/nextjs' + // TODO next.js not implement for now export default ({ error, reset }: any) => { useEffect(() => { console.log(error, reset) + captureException(error) }, [error]) return ( diff --git a/src/app/notes/Paper.tsx b/src/app/notes/Paper.tsx index da56dc540f..4d8d0b7991 100644 --- a/src/app/notes/Paper.tsx +++ b/src/app/notes/Paper.tsx @@ -5,7 +5,7 @@ export const Paper: Component = ({ children }) => {
{ : '' }` return ( - <> +
@@ -127,7 +127,7 @@ const NotePage = memo(({ note }: { note: NoteModel }) => { - + ) }) diff --git a/src/app/notes/error.tsx b/src/app/notes/error.tsx index 26b7aaf9e0..fbcbfa5459 100644 --- a/src/app/notes/error.tsx +++ b/src/app/notes/error.tsx @@ -1,5 +1,9 @@ 'use client' +import { useEffect } from 'react' + +import { captureException } from '@sentry/nextjs' + import { NotePasswordForm } from '~/components/widgets/note/NotePasswordForm' import { Paper } from './Paper' @@ -13,6 +17,10 @@ const pickStatusCode = (error: Error) => { } // TODO Catch if 404 or 403 export default ({ error, reset }: { error: Error; reset: () => void }) => { + useEffect(() => { + if (!isRequestError(error)) captureException(error) + }, [error]) + if (isRequestError(error)) { const code = pickStatusCode(error) @@ -32,6 +40,7 @@ export default ({ error, reset }: { error: Error; reset: () => void }) => { ) } + return (
diff --git a/src/app/notes/sentry-test/page.tsx b/src/app/notes/sentry-test/page.tsx new file mode 100644 index 0000000000..488e01512b --- /dev/null +++ b/src/app/notes/sentry-test/page.tsx @@ -0,0 +1,9 @@ +'use client' +export default () => { + return ( + // @ts-expect-error + + ) +} diff --git a/src/components/layout/header/internal/HeaderDrawerButton.tsx b/src/components/layout/header/internal/HeaderDrawerButton.tsx index e53ada4cb8..b3194b3766 100644 --- a/src/components/layout/header/internal/HeaderDrawerButton.tsx +++ b/src/components/layout/header/internal/HeaderDrawerButton.tsx @@ -85,6 +85,7 @@ const LinkInternal: typeof Link = memo(({ children, ...rest }) => { return ( { jotaiStore.set(drawerOpenAtom, false) }} @@ -98,7 +99,7 @@ const HeaderDrawerContent = () => { const { config } = useHeaderConfig() return ( -
+
{config.map((section, index) => { return (
-
+
{sections}
diff --git a/src/providers/root/modal-stack-provider.tsx b/src/providers/root/modal-stack-provider.tsx index 23ba07441c..a8d0c7ea88 100644 --- a/src/providers/root/modal-stack-provider.tsx +++ b/src/providers/root/modal-stack-provider.tsx @@ -113,7 +113,7 @@ export const Modal: Component<{ animate={enterStyle} transition={modalTransition} className={clsxm( - 'flex flex-col overflow-hidden rounded-lg', + 'relative flex flex-col overflow-hidden rounded-lg', 'bg-slate-50/90 dark:bg-neutral-900/90', 'p-2 shadow-2xl shadow-stone-300 backdrop-blur-sm dark:shadow-neutral-700', 'max-h-[70vh] min-w-[300px] max-w-[90vw] lg:max-h-[50vh] lg:max-w-[50vw]',