mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-31 19:33:26 +08:00
60 lines
1.6 KiB
TypeScript
60 lines
1.6 KiB
TypeScript
import { ActionIcon } from '@lobehub/ui';
|
|
import { Compass, Library, MessageSquare } from 'lucide-react';
|
|
import Link from 'next/link';
|
|
import { memo } from 'react';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { GlobalStore, useGlobalStore } from '@/store/global';
|
|
import { SidebarTabKey } from '@/store/global/initialState';
|
|
import { useSessionStore } from '@/store/session';
|
|
|
|
export interface TopActionProps {
|
|
tab?: GlobalStore['sidebarKey'];
|
|
}
|
|
|
|
const TopActions = memo<TopActionProps>(({ tab }) => {
|
|
const { t } = useTranslation('common');
|
|
const switchBackToChat = useGlobalStore((s) => s.switchBackToChat);
|
|
|
|
return (
|
|
<>
|
|
<Link
|
|
aria-label={t('tab.chat')}
|
|
href={'/chat'}
|
|
onClick={(e) => {
|
|
e.preventDefault();
|
|
switchBackToChat(useSessionStore.getState().activeId);
|
|
}}
|
|
>
|
|
<ActionIcon
|
|
active={tab === SidebarTabKey.Chat}
|
|
icon={MessageSquare}
|
|
placement={'right'}
|
|
size="large"
|
|
title={t('tab.chat')}
|
|
/>
|
|
</Link>
|
|
<Link aria-label={t('tab.market')} href={'/market'}>
|
|
<ActionIcon
|
|
active={tab === SidebarTabKey.Market}
|
|
icon={Compass}
|
|
placement={'right'}
|
|
size="large"
|
|
title={t('tab.market')}
|
|
/>
|
|
</Link>
|
|
<Link aria-label={'知识库'} href={'/knowledge'}>
|
|
<ActionIcon
|
|
active={tab === SidebarTabKey.Knowledge}
|
|
icon={Library}
|
|
placement={'right'}
|
|
size="large"
|
|
title={'知识库'}
|
|
/>
|
|
</Link>
|
|
</>
|
|
);
|
|
});
|
|
|
|
export default TopActions;
|