From 69f53632922ea556d419db18853567a15844aed8 Mon Sep 17 00:00:00 2001 From: canisminor1990 Date: Sun, 24 Nov 2024 16:13:34 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20Fix=20demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/.dumirc.ts | 4 +- src/builtins/Previewer/index.tsx | 25 +++-- src/components/Analytics/Clarity.tsx | 20 ++++ src/components/Analytics/GoogleAnalytics.tsx | 24 +++++ src/components/Analytics/Plausible.tsx | 9 ++ src/components/Analytics/index.tsx | 25 +++++ src/components/Favicons/index.tsx | 41 -------- src/components/StoreUpdater/index.tsx | 2 + src/layouts/DemoLayout/GlobalStyle.ts | 23 +++++ src/layouts/DemoLayout/index.tsx | 51 ++++++++-- src/layouts/DocLayout/DocumentLayout.tsx | 8 +- src/layouts/DocLayout/GlobalStyle.ts | 27 +++-- src/layouts/DocLayout/Head/Favicons.tsx | 24 +++++ src/layouts/DocLayout/Head/Og.tsx | 45 +++++++++ src/layouts/DocLayout/index.tsx | 6 +- src/pages/Changelog/index.tsx | 6 +- src/pages/Docs/index.tsx | 6 +- src/slots/ApiHeader/index.tsx | 4 +- src/slots/Content/index.tsx | 4 +- src/slots/ContentFooter/index.tsx | 4 +- src/slots/Features/index.tsx | 4 +- src/slots/Footer/index.tsx | 6 +- src/slots/Header/Burger.tsx | 4 +- src/slots/Header/DiscordButton.tsx | 4 +- src/slots/Header/GithubButton.tsx | 85 +++++++++++++++- src/slots/Header/index.tsx | 5 +- src/slots/Hero/index.tsx | 10 +- src/slots/Logo/index.tsx | 4 +- src/slots/Navbar/index.tsx | 4 +- src/slots/Toc/index.tsx | 4 +- src/store/index.ts | 18 ---- src/store/initialState.ts | 31 ++++-- src/store/selectors/apiHeader.ts | 15 +-- src/store/selectors/hero.ts | 43 ++++---- src/store/selectors/index.ts | 71 +------------ src/store/selectors/site.ts | 100 +++++++++++++++++++ src/store/selectors/siteBasicInfo.ts | 21 ---- src/store/selectors/token.ts | 9 -- src/store/useSiteStore.ts | 8 +- src/types/config.ts | 38 ++++++- 40 files changed, 563 insertions(+), 279 deletions(-) create mode 100644 src/components/Analytics/Clarity.tsx create mode 100644 src/components/Analytics/GoogleAnalytics.tsx create mode 100644 src/components/Analytics/Plausible.tsx create mode 100644 src/components/Analytics/index.tsx delete mode 100644 src/components/Favicons/index.tsx create mode 100644 src/layouts/DemoLayout/GlobalStyle.ts create mode 100644 src/layouts/DocLayout/Head/Favicons.tsx create mode 100644 src/layouts/DocLayout/Head/Og.tsx create mode 100644 src/store/selectors/site.ts delete mode 100644 src/store/selectors/siteBasicInfo.ts delete mode 100644 src/store/selectors/token.ts diff --git a/example/.dumirc.ts b/example/.dumirc.ts index b045d80..2210fdb 100644 --- a/example/.dumirc.ts +++ b/example/.dumirc.ts @@ -27,7 +27,7 @@ const themeConfig = { type: 'doc', }, description: 'Lobe UI is an open-source UI component library for building chatbot web apps', - footer: 'Made with 🤯 by LobeHub', + footer: 'Made with 🤯 by LobeHub', giscus: { category: 'Q&A', categoryId: 'DIC_kwDOJloKoM4CXsCu', @@ -53,7 +53,7 @@ export default defineConfig({ define: { 'process.env': process.env, }, - favicons: ['https://npm.elemecdn.com/@lobehub/assets-favicons/assets/favicon.ico'], + favicons: ['https://lobehub.com/favicon.ico'], locales: [{ id: 'en-US', name: 'English' }], mfsu: isWin ? undefined : {}, npmClient: 'pnpm', diff --git a/src/builtins/Previewer/index.tsx b/src/builtins/Previewer/index.tsx index 50bd47d..73e286d 100644 --- a/src/builtins/Previewer/index.tsx +++ b/src/builtins/Previewer/index.tsx @@ -1,3 +1,4 @@ +import { Typography } from '@lobehub/ui'; import { IPreviewerProps } from 'dumi/dist/client/theme-api/types'; import Previewer from 'dumi/theme-default/builtins/Previewer'; @@ -13,16 +14,18 @@ export default ({ center, codePlacement, nopadding, pure, ...props }: PreviewerP const { styles, cx } = useStyles(pure); return ( -
- -
+ +
+ +
+
); }; diff --git a/src/components/Analytics/Clarity.tsx b/src/components/Analytics/Clarity.tsx new file mode 100644 index 0000000..de04eb4 --- /dev/null +++ b/src/components/Analytics/Clarity.tsx @@ -0,0 +1,20 @@ +import { memo } from 'react'; + +const MicrosoftClarity = memo<{ projectId: string }>(({ projectId }) => { + return ( +