diff --git a/web/app/components/app/chat/copy-btn/index.tsx b/web/app/components/app/chat/copy-btn/index.tsx index f384e714d5..b72c1ac71a 100644 --- a/web/app/components/app/chat/copy-btn/index.tsx +++ b/web/app/components/app/chat/copy-btn/index.tsx @@ -1,10 +1,9 @@ 'use client' import React from 'react' -import Tooltip from '@/app/components/base/tooltip' import { t } from 'i18next' -import s from './style.module.css' import copy from 'copy-to-clipboard' - +import s from './style.module.css' +import Tooltip from '@/app/components/base/tooltip' type ICopyBtnProps = { value: string @@ -24,18 +23,18 @@ const CopyBtn = ({ content={(isCopied ? t('appApi.copied') : t('appApi.copy')) as string} className='z-10' > -
{ - copy(value) - setIsCopied(true) - }} - > -
-
+
{ + copy(value) + setIsCopied(true) + }} + > +
+
) diff --git a/web/app/components/app/text-generate/saved-items/index.tsx b/web/app/components/app/text-generate/saved-items/index.tsx index 5c3a5dd8f8..e2cc0e8396 100644 --- a/web/app/components/app/text-generate/saved-items/index.tsx +++ b/web/app/components/app/text-generate/saved-items/index.tsx @@ -1,17 +1,18 @@ 'use client' -import React, { FC } from 'react' +import type { FC } from 'react' +import React from 'react' import { useTranslation } from 'react-i18next' import cn from 'classnames' +import copy from 'copy-to-clipboard' +import NoData from './no-data' import type { SavedMessage } from '@/models/debug' import { Markdown } from '@/app/components/base/markdown' import { SimpleBtn, copyIcon } from '@/app/components/app/text-generate/item' -import copy from 'copy-to-clipboard' import Toast from '@/app/components/base/toast' -import NoData from './no-data' -export interface ISavedItemsProps { +export type ISavedItemsProps = { className?: string - list: SavedMessage[], + list: SavedMessage[] onRemove: (id: string) => void onStartCreateContent: () => void } @@ -26,52 +27,54 @@ const SavedItems: FC = ({ className, list, onRemove, - onStartCreateContent + onStartCreateContent, }) => { const { t } = useTranslation() return (
- {list.length === 0 ? ( -
- -
- ) : (<> - {list.map(({ id, answer }) => ( -
- -
-
- { - copy(answer) - Toast.notify({ type: 'success', message: t('common.actionMsg.copySuccessfully') }) - }}> - {copyIcon} -
{t('common.operation.copy')}
-
- - { - onRemove(id) - }}> - {removeIcon} -
{t('common.operation.remove')}
-
-
-
{answer?.length} {t('common.unit.char')}
-
+ {list.length === 0 + ? ( +
+
- ))} - )} + ) + : (<> + {list.map(({ id, answer }) => ( +
+ +
+
+ { + copy(answer) + Toast.notify({ type: 'success', message: t('common.actionMsg.copySuccessfully') }) + }}> + {copyIcon} +
{t('common.operation.copy')}
+
+ + { + onRemove(id) + }}> + {removeIcon} +
{t('common.operation.remove')}
+
+
+
{answer?.length} {t('common.unit.char')}
+
+
+ ))} + )}
)