Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(topic): share open-in-new-window and export labels across topic menus (#21918)

AmAzing-f008ae0c0b7f
diff --git a/src/features/PageEditor/Copilot/TopicSelector/useDropdownMenu.test.tsx b/src/features/PageEditor/Copilot/TopicSelector/useDropdownMenu.test.tsx
index 3760007588b..1d53b11b8f1 100644
--- a/src/features/PageEditor/Copilot/TopicSelector/useDropdownMenu.test.tsx
+++ b/src/features/PageEditor/Copilot/TopicSelector/useDropdownMenu.test.tsx
@@ -127,6 +127,19 @@ describe('PageEditor Copilot TopicSelector useDropdownMenu', () => {
]);
});
+ it('labels the share action like the sidebar topic menu', () => {
+ const { result } = renderHook(() =>
+ useDropdownMenu({
+ agentId: 'agent-1',
+ onClose: vi.fn(),
+ topicId: 'topic-1',
+ topicTitle: 'Topic 1',
+ }),
+ );
+
+ expect(getMenuItem(result.current(), 'share')).toMatchObject({ label: 'shareModal.title' });
+ });
+
it('disables write actions for viewers but keeps copy actions available', () => {
permissionMock.create_content = false;
permissionMock.edit_own_content = false;
diff --git a/src/features/PageEditor/Copilot/TopicSelector/useDropdownMenu.tsx b/src/features/PageEditor/Copilot/TopicSelector/useDropdownMenu.tsx
index 462c574ad89..ecaa4aac8b1 100644
--- a/src/features/PageEditor/Copilot/TopicSelector/useDropdownMenu.tsx
+++ b/src/features/PageEditor/Copilot/TopicSelector/useDropdownMenu.tsx
@@ -13,7 +13,7 @@ import {
PencilLine,
Pin,
PinOff,
- Share2,
+ Share,
Trash,
Wand2,
} from 'lucide-react';
@@ -52,7 +52,7 @@ export const useDropdownMenu = ({
topicId,
topicTitle,
}: UseDropdownMenuProps): (() => DropdownItem[]) => {
- const { t } = useTranslation(['common', 'topic']);
+ const { t } = useTranslation(['common', 'topic', 'chat']);
const appOrigin = useAppOrigin();
const navigate = useWorkspaceAwareNavigate();
@@ -223,9 +223,9 @@ export const useDropdownMenu = ({
},
{
disabled: !canEditTopic,
- icon: <Icon icon={Share2} />,
+ icon: <Icon icon={Share} />,
key: 'share',
- label: t('share'),
+ label: t('shareModal.title', { ns: 'chat' }),
onClick: handleOpenShareModal,
sfSymbol: 'square.and.arrow.up',
},
diff --git a/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/useMenu.test.tsx b/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/useMenu.test.tsx
index 82111f21186..bdfefe3626b 100644
--- a/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/useMenu.test.tsx
+++ b/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/useMenu.test.tsx
@@ -161,20 +161,20 @@ describe('Conversation header action menu', () => {
expect(copiedText).toBe('topic-1');
expect(document.querySelector('textarea')).toBeNull();
});
- it('includes the desktop popup-window action for the active topic', () => {
+ it('reuses the sidebar open-in-new-window action for the active topic', () => {
useLocationMock.mockReturnValue({ pathname: '/agent/agent-1' });
const { result } = renderHook(() => useMenu());
const popupItem = result.current
.menuItems()
- .find((item) => isActionItem(item) && item.key === 'openInPopupWindow');
+ .find((item) => isActionItem(item) && item.key === 'openInNewWindow');
expect(popupItem).toBeDefined();
if (!isActionItem(popupItem)) {
throw new Error('Expected popup menu item to be a clickable action item');
}
- expect(popupItem?.label).toBe('topic:inPopup.title');
+ expect(popupItem?.label).toBe('topic:actions.openInNewWindow');
act(() => {
popupItem?.onClick?.();
@@ -190,7 +190,7 @@ describe('Conversation header action menu', () => {
const popupItem = result.current
.menuItems()
- .find((item) => isActionItem(item) && item.key === 'openInPopupWindow');
+ .find((item) => isActionItem(item) && item.key === 'openInNewWindow');
expect(popupItem).toBeUndefined();
});
diff --git a/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/useMenu.tsx b/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/useMenu.tsx
index 7207741fe72..3c77dc7ba29 100644
--- a/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/useMenu.tsx
+++ b/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/useMenu.tsx
@@ -286,8 +286,8 @@ export const useMenu = (): { menuHeader?: ReactNode; menuItems: () => DropdownIt
if (isDesktop && activeAgentId && !pathname.startsWith('/popup')) {
items.push({
icon: <Icon icon={ExternalLink} />,
- key: 'openInPopupWindow',
- label: t('inPopup.title', { ns: 'topic' }),
+ key: 'openInNewWindow',
+ label: t('actions.openInNewWindow', { ns: 'topic' }),
onClick: () => {
openTopicInNewWindow(activeAgentId, topicId);
},