forked from infiniflow/ragflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: translate EmbedModal infiniflow#345 (infiniflow#455)
### What problem does this PR solve? Embed the chat window into other websites through iframe infiniflow#345 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
- Loading branch information
Showing
14 changed files
with
314 additions
and
106 deletions.
There are no files selected for viewing
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
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,8 @@ | ||
.codeCard { | ||
.clearCardBody(); | ||
} | ||
|
||
.codeText { | ||
padding: 10px; | ||
background-color: #e8e8ea; | ||
} |
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,70 @@ | ||
import CopyToClipboard from '@/components/copy-to-clipboard'; | ||
import HightLightMarkdown from '@/components/highlight-markdown'; | ||
import { useTranslate } from '@/hooks/commonHooks'; | ||
import { IModalProps } from '@/interfaces/common'; | ||
import { Card, Modal, Tabs, TabsProps } from 'antd'; | ||
import styles from './index.less'; | ||
|
||
const EmbedModal = ({ | ||
visible, | ||
hideModal, | ||
token = '', | ||
}: IModalProps<any> & { token: string }) => { | ||
const { t } = useTranslate('chat'); | ||
|
||
const text = ` | ||
~~~ html | ||
<iframe | ||
src="https://demo.ragflow.io/chat/share?shared_id=${token}" | ||
style="width: 100%; height: 100%; min-height: 600px" | ||
frameborder="0" | ||
> | ||
</iframe> | ||
~~~ | ||
`; | ||
|
||
const items: TabsProps['items'] = [ | ||
{ | ||
key: '1', | ||
label: t('fullScreenTitle'), | ||
children: ( | ||
<Card | ||
title={t('fullScreenDescription')} | ||
extra={<CopyToClipboard text={text}></CopyToClipboard>} | ||
className={styles.codeCard} | ||
> | ||
<HightLightMarkdown>{text}</HightLightMarkdown> | ||
</Card> | ||
), | ||
}, | ||
{ | ||
key: '2', | ||
label: t('partialTitle'), | ||
children: t('comingSoon'), | ||
}, | ||
{ | ||
key: '3', | ||
label: t('extensionTitle'), | ||
children: t('comingSoon'), | ||
}, | ||
]; | ||
|
||
const onChange = (key: string) => { | ||
console.log(key); | ||
}; | ||
|
||
return ( | ||
<Modal | ||
title={t('embedModalTitle')} | ||
open={visible} | ||
style={{ top: 300 }} | ||
width={'50vw'} | ||
onOk={hideModal} | ||
onCancel={hideModal} | ||
> | ||
<Tabs defaultActiveKey="1" items={items} onChange={onChange} /> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default EmbedModal; |
Oops, something went wrong.