lobehub/src/features/PageEditor/Copilot/TopicSelector/TopicItem.tsx
Innei 04cfc0e9e0
♻️ refactor: migrate to new DropdownMenuV2 and showContextMenu API (#11079)
* ♻️ refactor: migrate to new DropdownMenuV2 and showContextMenu API

- Replace Dropdown with DropdownMenuV2 for action menus
- Use showContextMenu for context menu handling instead of Dropdown wrapper
- Update @lobehub/ui to preview version with new context menu API
- Add styles for popup-open state in NavItem component

* ♻️ refactor: migrate to new DropdownMenuV2 and showContextMenu API

* chore: Update @lobehub/ui dependency to version ^4.6.3.

Signed-off-by: Innei <tukon479@gmail.com>

* ♻️ refactor: migrate to new DropdownMenuV2 and showContextMenu API

- Remove deprecated ContextMenu component
- Migrate all context menu usages to DropdownMenuV2 and showContextMenu API
- Update multiple Action components across Conversation features
- Update ResourceManager toolbar components
- Clean up related styles

🤖 Generated with [Claude Code](https://claude.com/claude-code)

* feat: Update `@lobehub/ui` dependency, simplify `ActionIconGroup` menu prop, and ensure action group visibility when popups are open.

Signed-off-by: Innei <tukon479@gmail.com>

* fix: Add null check for context menu items, include debug log, and update `@lobehub/ui` dependency.

Signed-off-by: Innei <tukon479@gmail.com>

* ♻️ refactor: migrate TopicSelector to new DropdownMenuV2 API

Migrate from antd/Dropdown to @lobehub/ui DropdownMenu component
with checkbox items pattern.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-01-02 01:14:30 +08:00

43 lines
1 KiB
TypeScript

import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import NavItem from '@/features/NavPanel/components/NavItem';
import Actions from './Actions';
import { useDropdownMenu } from './useDropdownMenu';
interface TopicItemProps {
active: boolean;
onClose: () => void;
onTopicChange: (topicId: string) => void;
topicId: string;
topicTitle: string;
}
const TopicItem = memo<TopicItemProps>(
({ active, onClose, onTopicChange, topicId, topicTitle }) => {
const { t } = useTranslation('topic');
const dropdownMenu = useDropdownMenu({
onClose,
topicId,
topicTitle,
});
return (
<NavItem
actions={<Actions dropdownMenu={dropdownMenu} />}
active={active}
contextMenuItems={dropdownMenu}
onClick={() => {
onTopicChange(topicId);
onClose();
}}
style={{ flexShrink: 0 }}
title={topicTitle || t('untitled', { defaultValue: 'Untitled' })}
/>
);
},
);
export default TopicItem;