generated from arvinxx/npm-template
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
2,742 additions
and
2,075 deletions.
There are no files selected for viewing
4,696 changes: 2,656 additions & 2,040 deletions
4,696
src/ProChat/__test__/__snapshots__/demo.test.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ProChat, type Locale } from '@ant-design/pro-chat'; | ||
import { Segmented } from 'antd'; | ||
import { useTheme } from 'antd-style'; | ||
import React from 'react'; | ||
|
||
export default () => { | ||
const theme = useTheme(); | ||
const [language, setLanguage] = React.useState<Locale>('en-US'); | ||
return ( | ||
<div style={{ background: theme.colorBgLayout }}> | ||
<Segmented<Locale> | ||
options={['en-US', 'zh-CN']} | ||
defaultValue="en-US" | ||
onChange={(v) => { | ||
setLanguage(v); | ||
}} | ||
/> | ||
<ProChat | ||
locale={language} | ||
request={async () => { | ||
return new Response('this is mock data'); | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Locale, gLocaleObject } from '@/locale'; | ||
import { useMemo } from 'react'; | ||
import { useStore } from '../store'; | ||
|
||
const useProChatLocale = () => { | ||
const locale = useStore((s) => s.locale); | ||
|
||
const localeObject = useMemo(() => { | ||
return gLocaleObject(locale as Locale); | ||
}, [locale]); | ||
|
||
return { | ||
locale, | ||
localeObject, | ||
}; | ||
}; | ||
|
||
export default useProChatLocale; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export * from '../types/message'; | ||
|
||
export { type Locale } from '../locale'; | ||
export { ProChat } from './container'; | ||
export { ProChatProvider } from './container/Provider'; | ||
export { useProChat, type ProChatInstance } from './hooks/useProChat'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters