From bc8a5bc19094666cae5398d4b993aa7beb735d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8F=8E=EF=B8=8F=20Yumo?= Date: Fri, 15 Nov 2024 10:41:37 +0800 Subject: [PATCH] fix: site build --- .dumi/hooks/useScrollY.ts | 4 +- .../index/common/CustomizationProvider.tsx | 75 +++++++++++++++++++ .../index/common/CustomizationSender.tsx | 4 +- .dumi/pages/index/common/Introduction.tsx | 6 +- .../CompIntroduction/Customization.tsx | 5 +- .../components/CompIntroduction/index.tsx | 2 +- .dumi/pages/index/components/DesignGuide.tsx | 2 +- .../SceneIntroduction/Assistant.tsx | 8 +- .../SceneIntroduction/Independent.tsx | 8 +- .../components/SceneIntroduction/Nest.tsx | 5 +- .dumi/pages/index/constants/color.ts | 22 ------ .dumi/pages/index/constants/locales.ts | 51 ------------- 12 files changed, 100 insertions(+), 92 deletions(-) delete mode 100644 .dumi/pages/index/constants/color.ts delete mode 100644 .dumi/pages/index/constants/locales.ts diff --git a/.dumi/hooks/useScrollY.ts b/.dumi/hooks/useScrollY.ts index 566e30df..f698388d 100644 --- a/.dumi/hooks/useScrollY.ts +++ b/.dumi/hooks/useScrollY.ts @@ -2,6 +2,8 @@ import React from 'react'; const getSnapshot = () => window.scrollY; +const getServerSnapshot = () => 0; + const useScrollY = () => { const [scrollYDirection, setScrollYDirection] = React.useState<'down' | 'up'>(); @@ -27,7 +29,7 @@ const useScrollY = () => { return () => window.removeEventListener('scroll', handleScroll); }, []); - const scrollY = React.useSyncExternalStore(subscribe, getSnapshot); + const scrollY = React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); return { scrollY, diff --git a/.dumi/pages/index/common/CustomizationProvider.tsx b/.dumi/pages/index/common/CustomizationProvider.tsx index 6749496b..e7fbfa28 100644 --- a/.dumi/pages/index/common/CustomizationProvider.tsx +++ b/.dumi/pages/index/common/CustomizationProvider.tsx @@ -30,6 +30,81 @@ export const useCustomizationBgStyle = createStyles(({ token, css }) => { }; }); +export const LOCALES = { + cn: { + greeting: '你好, 我是全新 AI 产品创造助手', + greeting_short: '你好, 我是 Ant Design X', + description: '基于 Ant Design 的 AGI 产品智能解决方案, 创造更美好的智能视界', + description_short: '基于 Ant Design 的 AGI 产品智能解决方案, 创造更美好的智能视界', + help_text: '我可以帮您: ', + + conversations_group: '最近对话', + send_placeholder: '输入 / 获取建议', + + hot_question: '热门话题', + + question1: 'Ant Design X 全新升级了什么? ', + question2: 'Ant Design X 推出全新 RICH 设计规范 ', + question3: 'Ant Design X 组件资产有哪些? ', + question4: '快来了解全新AI时代的设计范式! ', + + design_guide: 'Rich 设计指南', + + empathy: 'AI 理解用户诉求并解决', + persona: 'AI 对外的人设及形象', + conversation: 'AI 如何表达用户能听懂', + interface: 'AI 兼顾“chat” & “do” 行为', + }, + en: { + greeting: 'Hello, I am your AI Product Design Assistant', + greeting_short: 'Hello, I am Ant Design X', + description: + "Powered by Ant Design's AGI solution to enhance intelligent, aesthetic visual experiences", + description_short: 'Aesthetic visual experiences', + help_text: 'I can assist you with:', + + conversations_group: 'History', + send_placeholder: 'Type / to get suggestions', + + hot_question: 'Hot Topics', + + question1: 'What are the new upgrades in X?', + question2: 'X has introduced the new RICH design guide.', + question3: 'What are the component assets in X?', + question4: 'Discover new design for the AI!', + + design_guide: 'Rich Design Guidelines', + + empathy: 'AI that understands and addresses user needs', + persona: "Defining AI's persona and presentation", + conversation: 'Ensuring AI communicates clearly', + interface: "Balancing 'chat' & 'do' functionalities", + }, +}; + +export const DESIGN_STAGE_COLOR = { + AWAKE: { + START: '#6fb3e2', + END: '#6c57ff', + }, + EXPRESS: { + START: '#6dd6f5', + END: '#108c44', + }, + CONFIRM: { + START: '#48d0b6', + END: '#acf75b', + }, + FEEDBACK: { + START: '#f7c348', + END: '#f75972', + }, + COMMON: { + START: '#d857ff', + END: '#8594ff', + }, +}; + const useStyle = createStyles(({ token, css }) => { const borderRadius = 20; diff --git a/.dumi/pages/index/common/CustomizationSender.tsx b/.dumi/pages/index/common/CustomizationSender.tsx index 4428093b..2af92533 100644 --- a/.dumi/pages/index/common/CustomizationSender.tsx +++ b/.dumi/pages/index/common/CustomizationSender.tsx @@ -2,7 +2,7 @@ import { Sender, type SenderProps } from '@ant-design/x'; import { Button } from 'antd'; import React from 'react'; -export const CustomizationSender: React.FC = (props) => { +const CustomizationSender: React.FC = (props) => { return ( { @@ -23,3 +23,5 @@ export const CustomizationSender: React.FC = (props) => { /> ); }; + +export default CustomizationSender; diff --git a/.dumi/pages/index/common/Introduction.tsx b/.dumi/pages/index/common/Introduction.tsx index eb4e2728..82934ba4 100644 --- a/.dumi/pages/index/common/Introduction.tsx +++ b/.dumi/pages/index/common/Introduction.tsx @@ -108,7 +108,7 @@ export interface IntroductionItem { interface IntroductionProps extends ContainerProps { column?: number; - items: IntroductionItem[]; + items?: IntroductionItem[]; } const Introduction: React.FC = (props) => { @@ -119,10 +119,10 @@ const Introduction: React.FC = (props) => {
- {props.items.map((item) => ( + {props.items?.map((item) => (
{item.header && (
diff --git a/.dumi/pages/index/components/CompIntroduction/Customization.tsx b/.dumi/pages/index/components/CompIntroduction/Customization.tsx index 1902e99c..705894c0 100644 --- a/.dumi/pages/index/components/CompIntroduction/Customization.tsx +++ b/.dumi/pages/index/components/CompIntroduction/Customization.tsx @@ -5,9 +5,8 @@ import React from 'react'; import { DeleteOutlined, EditOutlined, EnterOutlined } from '@ant-design/icons'; import type { BubbleProps, ConversationsProps, PromptsProps, WelcomeProps } from '@ant-design/x'; import useLocale from '../../../../hooks/useLocale'; -import { useCustomizationBgStyle } from '../../common/CustomizationProvider'; -import { CustomizationSender } from '../../common/CustomizationSender'; -import { LOCALES } from '../../constants/locales'; +import { LOCALES, useCustomizationBgStyle } from '../../common/CustomizationProvider'; +import CustomizationSender from '../../common/CustomizationSender'; const useStyle = createStyles(({ token, css }) => { return { diff --git a/.dumi/pages/index/components/CompIntroduction/index.tsx b/.dumi/pages/index/components/CompIntroduction/index.tsx index 8ab476c5..01d5ae3f 100644 --- a/.dumi/pages/index/components/CompIntroduction/index.tsx +++ b/.dumi/pages/index/components/CompIntroduction/index.tsx @@ -3,8 +3,8 @@ import { createStyles } from 'antd-style'; import React from 'react'; import useLocale from '../../../../hooks/useLocale'; +import { DESIGN_STAGE_COLOR } from '../../common/CustomizationProvider'; import Introduction, { type IntroductionItem } from '../../common/Introduction'; -import { DESIGN_STAGE_COLOR } from '../../constants/color'; import SiteContext from '../SiteContext'; import { CustomConversations, diff --git a/.dumi/pages/index/components/DesignGuide.tsx b/.dumi/pages/index/components/DesignGuide.tsx index b3faab49..97b16e69 100644 --- a/.dumi/pages/index/components/DesignGuide.tsx +++ b/.dumi/pages/index/components/DesignGuide.tsx @@ -5,7 +5,7 @@ import React from 'react'; import useLocale from '../../../hooks/useLocale'; import Container from '../common/Container'; -import { DESIGN_STAGE_COLOR } from '../constants/color'; +import { DESIGN_STAGE_COLOR } from '../common/CustomizationProvider'; const comma = '\u00A0,\u00A0\u00A0\u00A0'; diff --git a/.dumi/pages/index/components/SceneIntroduction/Assistant.tsx b/.dumi/pages/index/components/SceneIntroduction/Assistant.tsx index 1668e338..7815503e 100644 --- a/.dumi/pages/index/components/SceneIntroduction/Assistant.tsx +++ b/.dumi/pages/index/components/SceneIntroduction/Assistant.tsx @@ -2,12 +2,14 @@ import { Bubble, Prompts, Welcome, useXAgent, useXChat } from '@ant-design/x'; import { createStyles } from 'antd-style'; import React from 'react'; import useLocale from '../../../../hooks/useLocale'; -import CustomizationProvider, { useCustomizationBgStyle } from '../../common/CustomizationProvider'; -import { CustomizationSender } from '../../common/CustomizationSender'; +import CustomizationProvider, { + useCustomizationBgStyle, + LOCALES, +} from '../../common/CustomizationProvider'; +import CustomizationSender from '../../common/CustomizationSender'; import { BubbleDataType } from '@ant-design/x/es/bubble/BubbleList'; import { Flex, type GetProp, Skeleton } from 'antd'; -import { LOCALES } from '../../constants/locales'; const sleep = () => new Promise((resolve) => setTimeout(resolve, 1000)); diff --git a/.dumi/pages/index/components/SceneIntroduction/Independent.tsx b/.dumi/pages/index/components/SceneIntroduction/Independent.tsx index 04bc9789..82af9f99 100644 --- a/.dumi/pages/index/components/SceneIntroduction/Independent.tsx +++ b/.dumi/pages/index/components/SceneIntroduction/Independent.tsx @@ -2,11 +2,13 @@ import { Bubble, Prompts, Welcome, useXAgent, useXChat } from '@ant-design/x'; import { createStyles } from 'antd-style'; import React from 'react'; import useLocale from '../../../../hooks/useLocale'; -import CustomizationProvider, { useCustomizationBgStyle } from '../../common/CustomizationProvider'; -import { CustomizationSender } from '../../common/CustomizationSender'; +import CustomizationProvider, { + useCustomizationBgStyle, + LOCALES, +} from '../../common/CustomizationProvider'; +import CustomizationSender from '../../common/CustomizationSender'; import { Flex, type GetProp, Tag } from 'antd'; -import { LOCALES } from '../../constants/locales'; const sleep = () => new Promise((resolve) => setTimeout(resolve, 1000)); diff --git a/.dumi/pages/index/components/SceneIntroduction/Nest.tsx b/.dumi/pages/index/components/SceneIntroduction/Nest.tsx index d119ef73..2978313c 100644 --- a/.dumi/pages/index/components/SceneIntroduction/Nest.tsx +++ b/.dumi/pages/index/components/SceneIntroduction/Nest.tsx @@ -1,10 +1,9 @@ import { createStyles } from 'antd-style'; import React from 'react'; -import { CustomizationSender } from '../../common/CustomizationSender'; +import CustomizationSender from '../../common/CustomizationSender'; import useLocale from '../../../../hooks/useLocale'; -import { useCustomizationBgStyle } from '../../common/CustomizationProvider'; -import { LOCALES } from '../../constants/locales'; +import { LOCALES, useCustomizationBgStyle } from '../../common/CustomizationProvider'; const useStyle = createStyles(({ token, css }) => { return { diff --git a/.dumi/pages/index/constants/color.ts b/.dumi/pages/index/constants/color.ts deleted file mode 100644 index 37af42c1..00000000 --- a/.dumi/pages/index/constants/color.ts +++ /dev/null @@ -1,22 +0,0 @@ -export const DESIGN_STAGE_COLOR = { - AWAKE: { - START: '#6fb3e2', - END: '#6c57ff', - }, - EXPRESS: { - START: '#6dd6f5', - END: '#108c44', - }, - CONFIRM: { - START: '#48d0b6', - END: '#acf75b', - }, - FEEDBACK: { - START: '#f7c348', - END: '#f75972', - }, - COMMON: { - START: '#d857ff', - END: '#8594ff', - }, -}; diff --git a/.dumi/pages/index/constants/locales.ts b/.dumi/pages/index/constants/locales.ts deleted file mode 100644 index 44241cc3..00000000 --- a/.dumi/pages/index/constants/locales.ts +++ /dev/null @@ -1,51 +0,0 @@ -export const LOCALES = { - cn: { - greeting: '你好, 我是全新 AI 产品创造助手', - greeting_short: '你好, 我是 Ant Design X', - description: '基于 Ant Design 的 AGI 产品智能解决方案, 创造更美好的智能视界', - description_short: '基于 Ant Design 的 AGI 产品智能解决方案, 创造更美好的智能视界', - help_text: '我可以帮您: ', - - conversations_group: '最近对话', - send_placeholder: '输入 / 获取建议', - - hot_question: '热门话题', - - question1: 'Ant Design X 全新升级了什么? ', - question2: 'Ant Design X 推出全新 RICH 设计规范 ', - question3: 'Ant Design X 组件资产有哪些? ', - question4: '快来了解全新AI时代的设计范式! ', - - design_guide: 'Rich 设计指南', - - empathy: 'AI 理解用户诉求并解决', - persona: 'AI 对外的人设及形象', - conversation: 'AI 如何表达用户能听懂', - interface: 'AI 兼顾“chat” & “do” 行为', - }, - en: { - greeting: 'Hello, I am your AI Product Design Assistant', - greeting_short: 'Hello, I am Ant Design X', - description: - "Powered by Ant Design's AGI solution to enhance intelligent, aesthetic visual experiences", - description_short: 'Aesthetic visual experiences', - help_text: 'I can assist you with:', - - conversations_group: 'History', - send_placeholder: 'Type / to get suggestions', - - hot_question: 'Hot Topics', - - question1: 'What are the new upgrades in X?', - question2: 'X has introduced the new RICH design guide.', - question3: 'What are the component assets in X?', - question4: 'Discover new design for the AI!', - - design_guide: 'Rich Design Guidelines', - - empathy: 'AI that understands and addresses user needs', - persona: "Defining AI's persona and presentation", - conversation: 'Ensuring AI communicates clearly', - interface: "Balancing 'chat' & 'do' functionalities", - }, -};