diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json index 05e34ff29c..21dbae6b54 100644 --- a/locales/en-US/chat.json +++ b/locales/en-US/chat.json @@ -487,7 +487,7 @@ "sessionGroup.tooLong": "Category name length should be between 1-20", "shareModal.copy": "Copy", "shareModal.copyLink": "Copy Link", - "shareModal.copyLinkSuccess": "Link copied", + "shareModal.copyLinkSuccess": "Share link copied to clipboard", "shareModal.download": "Download Screenshot", "shareModal.downloadError": "Download failed", "shareModal.downloadFile": "Download File", @@ -517,17 +517,23 @@ "shareModal.pdfErrorDescription": "An error occurred while generating the PDF, please try again", "shareModal.pdfGenerationError": "PDF generation failed", "shareModal.pdfReady": "PDF is ready", - "shareModal.popover.moreOptions": "More share options", - "shareModal.popover.privacyWarning.confirm": "I understand, continue", - "shareModal.popover.privacyWarning.content": "Please make sure your conversation doesn't contain any personal or sensitive information. You are responsible for any content you choose to share and its consequences.", + "shareModal.popover.export": "Export", + "shareModal.popover.privacyWarning.confirm": "Share & copy link", + "shareModal.popover.privacyWarning.content": "Anyone with the link can open this whole conversation, so take a moment to make sure there's nothing here you'd rather keep private. A shared topic may include:", "shareModal.popover.privacyWarning.doNotShowAgain": "Don't show this again", - "shareModal.popover.privacyWarning.title": "Privacy Notice", + "shareModal.popover.privacyWarning.items.credentials": "Credentials", + "shareModal.popover.privacyWarning.items.files": "Uploaded files", + "shareModal.popover.privacyWarning.items.images": "Images", + "shareModal.popover.privacyWarning.items.toolCalls": "Connector calling details", + "shareModal.popover.privacyWarning.note": "You can switch back to private anytime.", + "shareModal.popover.privacyWarning.title": "Before you share this link", "shareModal.popover.title": "Share Topic", "shareModal.popover.visibility": "Visibility", "shareModal.regeneratePdf": "Regenerate PDF", "shareModal.screenshot": "Screenshot", "shareModal.settings": "Export Settings", "shareModal.text": "Text", + "shareModal.title": "Export", "shareModal.widthMode.label": "Width Mode", "shareModal.widthMode.narrow": "Narrow", "shareModal.widthMode.wide": "Wide", @@ -545,7 +551,11 @@ "sharePage.error.unauthorized.action": "Sign In", "sharePage.error.unauthorized.subtitle": "Please sign in to view this shared topic.", "sharePage.error.unauthorized.title": "Sign In Required", - "sharePageDisclaimer": "This content is shared by a user and does not represent the views of LobeHub. LobeHub is not responsible for any consequences arising from this shared content.", + "sharePage.menu.copyLink": "Copy Link", + "sharePage.menu.goToLobeHub": "Go to LobeHub", + "sharePage.menu.more": "More", + "sharePage.menu.report": "Report", + "sharePageDisclaimer": "Shared by a user. The content reflects their views, not LobeHub's, and LobeHub takes no responsibility for it.", "signalCallbacks.collapse": "Hide details", "signalCallbacks.empty": "No callback messages", "signalCallbacks.expand": "Show details", diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json index 4d6ef69a3a..0e70b452b4 100644 --- a/locales/zh-CN/chat.json +++ b/locales/zh-CN/chat.json @@ -487,7 +487,7 @@ "sessionGroup.tooLong": "分类名称长度需为 1–20 个字符", "shareModal.copy": "复制", "shareModal.copyLink": "复制链接", - "shareModal.copyLinkSuccess": "链接已复制", + "shareModal.copyLinkSuccess": "分享链接已复制到剪贴板", "shareModal.download": "下载截图", "shareModal.downloadError": "下载失败,请检查网络后重试", "shareModal.downloadFile": "下载文件", @@ -517,17 +517,23 @@ "shareModal.pdfErrorDescription": "生成 PDF 时出错,请重试或联系支持", "shareModal.pdfGenerationError": "PDF 生成失败", "shareModal.pdfReady": "PDF 已准备就绪", - "shareModal.popover.moreOptions": "更多分享方式", - "shareModal.popover.privacyWarning.confirm": "我已了解,继续", - "shareModal.popover.privacyWarning.content": "请确保对话中不含个人隐私或敏感信息,LobeHub 不对任何分享的内容及其产生的后果负责。", + "shareModal.popover.export": "导出", + "shareModal.popover.privacyWarning.confirm": "分享并复制链接", + "shareModal.popover.privacyWarning.content": "拿到链接的人都能查看整段对话,分享前花点时间确认其中没有不便公开的内容。被分享的话题可能包含:", "shareModal.popover.privacyWarning.doNotShowAgain": "不再显示此提示", - "shareModal.popover.privacyWarning.title": "隐私提醒", + "shareModal.popover.privacyWarning.items.credentials": "凭证与密钥", + "shareModal.popover.privacyWarning.items.files": "上传的文件", + "shareModal.popover.privacyWarning.items.images": "图片", + "shareModal.popover.privacyWarning.items.toolCalls": "连接器调用详情", + "shareModal.popover.privacyWarning.note": "你可以随时切回私密状态。", + "shareModal.popover.privacyWarning.title": "分享链接前请留意", "shareModal.popover.title": "分享话题", "shareModal.popover.visibility": "可见性", "shareModal.regeneratePdf": "重新生成 PDF", "shareModal.screenshot": "截图", "shareModal.settings": "导出设置", "shareModal.text": "文本", + "shareModal.title": "导出", "shareModal.widthMode.label": "宽度模式", "shareModal.widthMode.narrow": "窄屏", "shareModal.widthMode.wide": "宽屏", @@ -545,7 +551,11 @@ "sharePage.error.unauthorized.action": "登录", "sharePage.error.unauthorized.subtitle": "请登录后查看此分享话题。", "sharePage.error.unauthorized.title": "需要登录", - "sharePageDisclaimer": "此内容由用户分享,不代表 LobeHub 观点。LobeHub 不对该分享内容产生的任何后果承担责任。", + "sharePage.menu.copyLink": "复制链接", + "sharePage.menu.goToLobeHub": "前往 LobeHub", + "sharePage.menu.more": "更多", + "sharePage.menu.report": "举报", + "sharePageDisclaimer": "由用户分享,仅代表其个人观点,不代表 LobeHub 立场;LobeHub 不对该内容承担责任。", "signalCallbacks.collapse": "隐藏详情", "signalCallbacks.empty": "没有回调消息", "signalCallbacks.expand": "显示详情", diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts index adbb324003..3681e3054a 100644 --- a/packages/locales/src/default/chat.ts +++ b/packages/locales/src/default/chat.ts @@ -547,7 +547,7 @@ export default { 'sessionGroup.tooLong': 'Category name length should be between 1-20', 'shareModal.copy': 'Copy', 'shareModal.copyLink': 'Copy Link', - 'shareModal.copyLinkSuccess': 'Link copied', + 'shareModal.copyLinkSuccess': 'Share link copied to clipboard', 'shareModal.download': 'Download Screenshot', 'shareModal.downloadError': 'Download failed', 'shareModal.downloadFile': 'Download File', @@ -577,18 +577,24 @@ export default { 'shareModal.pdfErrorDescription': 'An error occurred while generating the PDF, please try again', 'shareModal.pdfGenerationError': 'PDF generation failed', 'shareModal.pdfReady': 'PDF is ready', - 'shareModal.popover.moreOptions': 'More share options', - 'shareModal.popover.privacyWarning.confirm': 'I understand, continue', + 'shareModal.popover.export': 'Export', + 'shareModal.popover.privacyWarning.confirm': 'Share & copy link', 'shareModal.popover.privacyWarning.content': - "Please make sure your conversation doesn't contain any personal or sensitive information. You are responsible for any content you choose to share and its consequences.", + "Anyone with the link can open this whole conversation, so take a moment to make sure there's nothing here you'd rather keep private. A shared topic may include:", 'shareModal.popover.privacyWarning.doNotShowAgain': "Don't show this again", - 'shareModal.popover.privacyWarning.title': 'Privacy Notice', + 'shareModal.popover.privacyWarning.items.credentials': 'Credentials', + 'shareModal.popover.privacyWarning.items.files': 'Uploaded files', + 'shareModal.popover.privacyWarning.items.images': 'Images', + 'shareModal.popover.privacyWarning.items.toolCalls': 'Connector calling details', + 'shareModal.popover.privacyWarning.note': 'You can switch back to private anytime.', + 'shareModal.popover.privacyWarning.title': 'Before you share this link', 'shareModal.popover.title': 'Share Topic', 'shareModal.popover.visibility': 'Visibility', 'shareModal.regeneratePdf': 'Regenerate PDF', 'shareModal.screenshot': 'Screenshot', 'shareModal.settings': 'Export Settings', 'shareModal.text': 'Text', + 'shareModal.title': 'Export', 'shareModal.widthMode.label': 'Width Mode', 'shareModal.widthMode.narrow': 'Narrow', 'shareModal.widthMode.wide': 'Wide', @@ -606,8 +612,12 @@ export default { 'sharePage.error.unauthorized.action': 'Sign In', 'sharePage.error.unauthorized.subtitle': 'Please sign in to view this shared topic.', 'sharePage.error.unauthorized.title': 'Sign In Required', + 'sharePage.menu.copyLink': 'Copy Link', + 'sharePage.menu.goToLobeHub': 'Go to LobeHub', + 'sharePage.menu.more': 'More', + 'sharePage.menu.report': 'Report', 'sharePageDisclaimer': - 'This content is shared by a user and does not represent the views of LobeHub. LobeHub is not responsible for any consequences arising from this shared content.', + "Shared by a user. The content reflects their views, not LobeHub's, and LobeHub takes no responsibility for it.", 'signalCallbacks.collapse': 'Hide details', 'signalCallbacks.empty': 'No callback messages', 'signalCallbacks.expand': 'Show details', diff --git a/src/features/RouteMeta/mobileRouteMeta.ts b/src/features/RouteMeta/mobileRouteMeta.ts index 3623c318f9..2075e432f8 100644 --- a/src/features/RouteMeta/mobileRouteMeta.ts +++ b/src/features/RouteMeta/mobileRouteMeta.ts @@ -1,8 +1,6 @@ import { t } from 'i18next'; -import { MessageSquare, Settings } from 'lucide-react'; -import useSWR from 'swr'; +import { Settings } from 'lucide-react'; -import { lambdaClient } from '@/libs/trpc/client'; import { routeMeta } from '@/spa/router/routeMeta'; import { useAgentStore } from '@/store/agent'; import { agentSelectors } from '@/store/agent/selectors'; @@ -20,20 +18,3 @@ export const mobileAgentSettingsRouteMeta = routeMeta({ }; }, }); - -export const shareTopicRouteMeta = routeMeta({ - icon: MessageSquare, - titleKey: 'navigation.chat', - useDynamicMeta: (params) => { - const shareId = params.id; - const { data } = useSWR( - shareId ? ['shared-topic', shareId] : null, - () => lambdaClient.share.getSharedTopic.query({ shareId: shareId! }), - { revalidateOnFocus: false }, - ); - - return { - title: data?.title || undefined, - }; - }, -}); diff --git a/src/features/ShareModal/Modal.tsx b/src/features/ShareModal/Modal.tsx index 918cccfdfc..37b256d588 100644 --- a/src/features/ShareModal/Modal.tsx +++ b/src/features/ShareModal/Modal.tsx @@ -105,7 +105,7 @@ export const openShareModal = ({ styles: { content: { height: 'min(80vh, 800px)' }, }, - title: t('share', { ns: 'common' }), + title: t('shareModal.title', { ns: 'chat' }), width: 'min(90vw, 1024px)', }); diff --git a/src/features/SharePopover/index.tsx b/src/features/SharePopover/index.tsx index da86acf7d3..3fb08aae02 100644 --- a/src/features/SharePopover/index.tsx +++ b/src/features/SharePopover/index.tsx @@ -12,7 +12,15 @@ import { } from '@lobehub/ui'; import { confirmModal, Select } from '@lobehub/ui/base-ui'; import { App, Divider } from 'antd'; -import { ExternalLinkIcon, LinkIcon, LockIcon } from 'lucide-react'; +import { + FileOutputIcon, + ImageIcon, + KeyRoundIcon, + LinkIcon, + LockIcon, + PaperclipIcon, + WrenchIcon, +} from 'lucide-react'; import { type ReactNode } from 'react'; import { memo, useCallback, useEffect, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -30,6 +38,13 @@ import { styles } from './style'; type Visibility = 'private' | 'link'; +const PRIVACY_WARNING_ITEMS = [ + { icon: WrenchIcon, labelKey: 'shareModal.popover.privacyWarning.items.toolCalls' }, + { icon: KeyRoundIcon, labelKey: 'shareModal.popover.privacyWarning.items.credentials' }, + { icon: ImageIcon, labelKey: 'shareModal.popover.privacyWarning.items.images' }, + { icon: PaperclipIcon, labelKey: 'shareModal.popover.privacyWarning.items.files' }, +] as const; + interface SharePopoverContentProps { onOpenModal?: () => void; topicId?: string; @@ -79,14 +94,20 @@ const SharePopoverContent = memo(({ onOpenModal, topic try { await topicService.updateShareVisibility(activeTopicId, visibility); await mutate(); - message.success(t('shareModal.link.visibilityUpdated')); + // Auto-copy the share link the moment link sharing is enabled + if (visibility === 'link' && shareUrl) { + await copyToClipboard(shareUrl); + message.success(t('shareModal.copyLinkSuccess')); + } else { + message.success(t('shareModal.link.visibilityUpdated')); + } } catch { message.error(t('shareModal.link.updateError')); } finally { setUpdating(false); } }, - [activeTopicId, mutate, message, t], + [activeTopicId, mutate, message, t, shareUrl], ); const handleVisibilityChange = useCallback( @@ -102,18 +123,25 @@ const SharePopoverContent = memo(({ onOpenModal, topic confirmModal({ cancelText: t('cancel', { ns: 'common' }), content: ( -
-

{t('shareModal.popover.privacyWarning.content')}

-
- { - doNotShowAgain = v; - }} - > - {t('shareModal.popover.privacyWarning.doNotShowAgain')} - -
-
+ + {t('shareModal.popover.privacyWarning.content')} + + {PRIVACY_WARNING_ITEMS.map(({ icon: ItemIcon, labelKey }) => ( + + + {t(labelKey)} + + ))} + + {t('shareModal.popover.privacyWarning.note')} + { + doNotShowAgain = v; + }} + > + {t('shareModal.popover.privacyWarning.doNotShowAgain')} + + ), okText: t('shareModal.popover.privacyWarning.confirm'), onOk: () => { @@ -223,13 +251,13 @@ const SharePopoverContent = memo(({ onOpenModal, topic {currentVisibility !== 'private' && (