Skip to content

Commit

Permalink
fix: site build
Browse files Browse the repository at this point in the history
  • Loading branch information
YumoImer committed Nov 15, 2024
1 parent 4ffd7ac commit bc8a5bc
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 92 deletions.
4 changes: 3 additions & 1 deletion .dumi/hooks/useScrollY.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from 'react';

const getSnapshot = () => window.scrollY;

const getServerSnapshot = () => 0;

const useScrollY = () => {
const [scrollYDirection, setScrollYDirection] = React.useState<'down' | 'up'>();

Expand All @@ -27,7 +29,7 @@ const useScrollY = () => {
return () => window.removeEventListener('scroll', handleScroll);
}, []);

const scrollY = React.useSyncExternalStore<number>(subscribe, getSnapshot);
const scrollY = React.useSyncExternalStore<number>(subscribe, getSnapshot, getServerSnapshot);

return {
scrollY,
Expand Down
75 changes: 75 additions & 0 deletions .dumi/pages/index/common/CustomizationProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 3 additions & 1 deletion .dumi/pages/index/common/CustomizationSender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<SenderProps> = (props) => {
const CustomizationSender: React.FC<SenderProps> = (props) => {
return (
<Sender
actions={() => {
Expand All @@ -23,3 +23,5 @@ export const CustomizationSender: React.FC<SenderProps> = (props) => {
/>
);
};

export default CustomizationSender;
6 changes: 3 additions & 3 deletions .dumi/pages/index/common/Introduction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export interface IntroductionItem {

interface IntroductionProps extends ContainerProps {
column?: number;
items: IntroductionItem[];
items?: IntroductionItem[];
}

const Introduction: React.FC<IntroductionProps> = (props) => {
Expand All @@ -119,10 +119,10 @@ const Introduction: React.FC<IntroductionProps> = (props) => {
<div
className={styles.content}
style={{
gridTemplateColumns: `repeat(${props.column || props.items.length}, 1fr)`,
gridTemplateColumns: `repeat(${props.column || props.items?.length}, 1fr)`,
}}
>
{props.items.map((item) => (
{props.items?.map((item) => (
<div className={styles.item} key={`${item.title}`}>
{item.header && (
<div className={styles.item_header}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion .dumi/pages/index/components/CompIntroduction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion .dumi/pages/index/components/DesignGuide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
8 changes: 5 additions & 3 deletions .dumi/pages/index/components/SceneIntroduction/Assistant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
5 changes: 2 additions & 3 deletions .dumi/pages/index/components/SceneIntroduction/Nest.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
22 changes: 0 additions & 22 deletions .dumi/pages/index/constants/color.ts

This file was deleted.

51 changes: 0 additions & 51 deletions .dumi/pages/index/constants/locales.ts

This file was deleted.

0 comments on commit bc8a5bc

Please sign in to comment.