@lobehub/chat 0.152.0 → 0.152.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/locales/ar/common.json +14 -0
- package/locales/ar/setting.json +4 -1
- package/locales/bg-BG/common.json +14 -0
- package/locales/bg-BG/setting.json +4 -1
- package/locales/de-DE/common.json +14 -0
- package/locales/de-DE/setting.json +4 -1
- package/locales/en-US/common.json +14 -0
- package/locales/en-US/setting.json +4 -1
- package/locales/es-ES/common.json +14 -0
- package/locales/es-ES/setting.json +4 -1
- package/locales/fr-FR/common.json +14 -0
- package/locales/fr-FR/setting.json +4 -1
- package/locales/it-IT/common.json +14 -0
- package/locales/it-IT/setting.json +4 -1
- package/locales/ja-JP/common.json +14 -0
- package/locales/ja-JP/setting.json +4 -1
- package/locales/ko-KR/common.json +14 -0
- package/locales/ko-KR/setting.json +4 -1
- package/locales/nl-NL/common.json +14 -0
- package/locales/nl-NL/setting.json +4 -1
- package/locales/pl-PL/common.json +14 -0
- package/locales/pl-PL/setting.json +4 -1
- package/locales/pt-BR/common.json +14 -0
- package/locales/pt-BR/setting.json +4 -1
- package/locales/ru-RU/common.json +14 -0
- package/locales/ru-RU/setting.json +4 -1
- package/locales/tr-TR/common.json +14 -0
- package/locales/tr-TR/setting.json +4 -1
- package/locales/vi-VN/common.json +14 -0
- package/locales/vi-VN/setting.json +4 -1
- package/locales/zh-CN/common.json +14 -0
- package/locales/zh-CN/setting.json +4 -1
- package/locales/zh-TW/common.json +14 -0
- package/locales/zh-TW/setting.json +4 -1
- package/package.json +1 -1
- package/src/app/(main)/(mobile)/me/features/AvatarBanner.tsx +52 -0
- package/src/app/(main)/(mobile)/me/features/Cate.tsx +34 -0
- package/src/app/(main)/(mobile)/me/features/ExtraCate.tsx +26 -0
- package/src/app/(main)/(mobile)/me/features/useExtraCate.tsx +68 -0
- package/src/app/(main)/(mobile)/me/layout.tsx +11 -0
- package/src/app/(main)/(mobile)/me/loading.tsx +17 -0
- package/src/app/(main)/(mobile)/me/page.tsx +31 -0
- package/src/app/(main)/@nav/_layout/Desktop/BottomActions.tsx +7 -120
- package/src/app/(main)/@nav/_layout/Desktop/index.tsx +7 -2
- package/src/app/(main)/@nav/_layout/Mobile.tsx +3 -3
- package/src/app/(main)/@nav/features/UserAvatar.tsx +24 -0
- package/src/app/(main)/@nav/features/UserPanel/LangButton.tsx +55 -0
- package/src/app/(main)/@nav/features/UserPanel/Popover.tsx +34 -0
- package/src/app/(main)/@nav/features/UserPanel/ThemeButton.tsx +70 -0
- package/src/app/(main)/@nav/features/UserPanel/UserInfo.tsx +35 -0
- package/src/app/(main)/@nav/features/UserPanel/index.tsx +69 -0
- package/src/app/(main)/@nav/features/UserPanel/useMenu.tsx +144 -0
- package/src/app/(main)/@nav/features/UserPanel/useNewVersion.tsx +12 -0
- package/src/app/(main)/chat/(mobile)/features/SessionHeader.tsx +1 -1
- package/src/app/(main)/chat/_layout/Desktop/index.tsx +6 -8
- package/src/app/(main)/chat/_layout/Mobile/index.tsx +5 -3
- package/src/app/(main)/chat/_layout/type.ts +5 -0
- package/src/app/(main)/chat/features/SettingButton.tsx +5 -2
- package/src/app/(main)/chat/layout.ts +5 -2
- package/src/app/(main)/chat/settings/{(desktop) → _layout/Desktop}/Header.tsx +2 -0
- package/src/app/(main)/chat/settings/_layout/Desktop/index.tsx +32 -0
- package/src/app/(main)/chat/settings/{(mobile) → _layout/Mobile}/Header.tsx +3 -2
- package/src/app/(main)/chat/settings/_layout/Mobile/index.tsx +15 -0
- package/src/app/(main)/chat/settings/error.tsx +5 -0
- package/src/app/(main)/chat/settings/features/HeaderContent.tsx +15 -9
- package/src/app/(main)/chat/settings/features/SubmitAgentButton/SubmitAgentModal.tsx +2 -0
- package/src/app/(main)/chat/settings/features/SubmitAgentButton/index.tsx +16 -8
- package/src/app/(main)/chat/settings/layout.tsx +9 -2
- package/src/app/(main)/chat/settings/loading.tsx +3 -0
- package/src/app/(main)/chat/settings/not-found.tsx +3 -0
- package/src/app/(main)/chat/settings/page.tsx +2 -9
- package/src/app/(main)/market/@detail/default.tsx +12 -0
- package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Header.tsx +30 -21
- package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/index.tsx +10 -4
- package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/style.ts +7 -11
- package/src/app/(main)/market/@detail/loading.tsx +1 -0
- package/src/app/(main)/market/_layout/Desktop/{AgentDetail.tsx → DetailSidebar.tsx} +17 -12
- package/src/app/(main)/market/_layout/Desktop/Header.tsx +3 -6
- package/src/app/(main)/market/_layout/Desktop/Hero.tsx +39 -0
- package/src/app/(main)/market/_layout/Desktop/index.tsx +24 -44
- package/src/app/(main)/market/{(mobile)/features/AgentDetail.tsx → _layout/Mobile/DetailModal.tsx} +9 -7
- package/src/app/(main)/market/_layout/Mobile/Header.tsx +2 -2
- package/src/app/(main)/market/_layout/Mobile/index.tsx +17 -9
- package/src/app/(main)/market/_layout/type.ts +6 -0
- package/src/app/(main)/market/features/AgentCard/AgentCardBanner.tsx +10 -9
- package/src/app/(main)/market/features/AgentCard/index.tsx +133 -58
- package/src/app/(main)/market/features/AgentList.tsx +94 -0
- package/src/app/(main)/market/features/AgentSearchBar.tsx +42 -0
- package/src/app/(main)/market/features/ShareAgentButton/Inner.tsx +9 -7
- package/src/app/(main)/market/features/ShareAgentButton/index.tsx +22 -15
- package/src/app/(main)/market/features/TagList.tsx +65 -0
- package/src/app/(main)/market/layout.tsx +11 -0
- package/src/app/(main)/market/loading.tsx +2 -2
- package/src/app/(main)/market/page.tsx +22 -12
- package/src/app/(main)/settings/@category/default.tsx +16 -0
- package/src/app/(main)/settings/@category/features/CategoryContent.tsx +35 -0
- package/src/app/(main)/settings/@category/features/UpgradeAlert.tsx +38 -0
- package/src/app/(main)/settings/_layout/Desktop/Header.tsx +78 -23
- package/src/app/(main)/settings/_layout/Desktop/SideBar.tsx +39 -27
- package/src/app/(main)/settings/_layout/Desktop/index.tsx +41 -17
- package/src/app/(main)/settings/_layout/Mobile/{SubSettingHeader.tsx → Header.tsx} +3 -1
- package/src/app/(main)/settings/_layout/Mobile/index.tsx +7 -18
- package/src/app/(main)/settings/_layout/type.ts +6 -0
- package/src/app/(main)/settings/about/features/AboutList.tsx +122 -0
- package/src/app/(main)/settings/about/features/Analytics.tsx +42 -0
- package/src/app/(main)/settings/about/layout.tsx +26 -0
- package/src/app/(main)/settings/about/loading.tsx +5 -0
- package/src/app/(main)/settings/about/page.tsx +20 -25
- package/src/app/(main)/settings/agent/layout.tsx +35 -0
- package/src/app/(main)/settings/agent/loading.tsx +4 -2
- package/src/app/(main)/settings/agent/page.tsx +25 -12
- package/src/app/(main)/settings/common/{Common.tsx → features/Common.tsx} +7 -5
- package/src/app/(main)/settings/common/{Theme.tsx → features/Theme/index.tsx} +8 -6
- package/src/app/(main)/settings/common/page.tsx +21 -4
- package/src/app/(main)/settings/error.tsx +5 -0
- package/src/app/(main)/settings/features/Footer.tsx +2 -0
- package/src/app/(main)/settings/features/UpgradeAlert.tsx +21 -13
- package/src/app/(main)/settings/hooks/useCategory.tsx +54 -0
- package/src/app/(main)/settings/hooks/useSyncSettings.ts +2 -2
- package/src/app/(main)/settings/layout.ts +4 -1
- package/src/app/(main)/settings/llm/Anthropic/index.tsx +4 -10
- package/src/app/(main)/settings/llm/Azure/index.tsx +3 -1
- package/src/app/(main)/settings/llm/Bedrock/index.tsx +3 -1
- package/src/app/(main)/settings/llm/Google/index.tsx +4 -2
- package/src/app/(main)/settings/llm/Groq/index.tsx +3 -1
- package/src/app/(main)/settings/llm/Minimax/index.tsx +3 -9
- package/src/app/(main)/settings/llm/Mistral/index.tsx +3 -9
- package/src/app/(main)/settings/llm/Moonshot/index.tsx +3 -1
- package/src/app/(main)/settings/llm/Ollama/index.tsx +3 -1
- package/src/app/(main)/settings/llm/OpenAI/index.tsx +2 -0
- package/src/app/(main)/settings/llm/OpenRouter/index.tsx +3 -9
- package/src/app/(main)/settings/llm/Perplexity/index.tsx +3 -9
- package/src/app/(main)/settings/llm/TogetherAI/index.tsx +3 -9
- package/src/app/(main)/settings/llm/ZeroOne/index.tsx +3 -9
- package/src/app/(main)/settings/llm/Zhipu/index.tsx +3 -10
- package/src/app/(main)/settings/llm/components/Checker.tsx +2 -0
- package/src/app/(main)/settings/llm/components/Footer.tsx +26 -0
- package/src/app/(main)/settings/llm/components/ProviderConfig/index.tsx +16 -1
- package/src/app/(main)/settings/llm/page.tsx +57 -3
- package/src/app/(main)/settings/loading.tsx +9 -0
- package/src/app/(main)/settings/not-found.tsx +3 -0
- package/src/app/(main)/settings/page.tsx +2 -14
- package/src/app/(main)/settings/sync/{DeviceInfo → features/DeviceInfo}/Card.tsx +6 -5
- package/src/app/(main)/settings/sync/features/DeviceInfo/DeviceName.tsx +63 -0
- package/src/app/(main)/settings/sync/{components → features/DeviceInfo}/SystemIcon.tsx +6 -14
- package/src/app/(main)/settings/sync/{DeviceInfo → features/DeviceInfo}/index.tsx +22 -36
- package/src/app/(main)/settings/sync/{WebRTC → features/WebRTC}/ChannelNameInput.tsx +3 -3
- package/src/app/(main)/settings/sync/{WebRTC → features/WebRTC}/index.tsx +10 -9
- package/src/app/(main)/settings/sync/page.tsx +19 -11
- package/src/app/(main)/settings/tts/features/OpenAI.tsx +54 -0
- package/src/app/(main)/settings/tts/{TTS/index.tsx → features/STT.tsx} +11 -27
- package/src/app/(main)/settings/tts/page.tsx +17 -11
- package/src/app/@modal/(.)settings/about/layout.tsx +1 -0
- package/src/app/@modal/(.)settings/about/page.tsx +1 -0
- package/src/app/@modal/(.)settings/agent/layout.tsx +1 -0
- package/src/app/@modal/(.)settings/agent/page.tsx +1 -0
- package/src/app/@modal/(.)settings/common/page.tsx +1 -0
- package/src/app/@modal/(.)settings/layout.tsx +28 -0
- package/src/app/@modal/(.)settings/llm/page.tsx +1 -0
- package/src/app/@modal/(.)settings/loading.tsx +5 -0
- package/src/app/@modal/(.)settings/sync/page.tsx +1 -0
- package/src/app/@modal/(.)settings/tts/page.tsx +1 -0
- package/src/app/@modal/_layout/SettingModalLayout.tsx +59 -0
- package/src/app/@modal/chat/(.)settings/features/CategoryContent.tsx +36 -0
- package/src/app/@modal/chat/(.)settings/features/useCategory.tsx +62 -0
- package/src/app/@modal/chat/(.)settings/layout.tsx +55 -0
- package/src/app/@modal/chat/(.)settings/loading.tsx +5 -0
- package/src/app/@modal/chat/(.)settings/page.tsx +40 -0
- package/src/app/@modal/default.tsx +1 -0
- package/src/app/@modal/layout.tsx +30 -0
- package/src/app/@modal/loading.tsx +5 -0
- package/src/app/layout.tsx +11 -3
- package/src/components/BrandWatermark/index.tsx +39 -0
- package/src/components/Cell/Divider.tsx +19 -0
- package/src/components/Cell/index.tsx +38 -0
- package/src/components/Menu/index.tsx +97 -0
- package/src/components/SkeletonLoading/index.tsx +21 -0
- package/src/const/url.ts +1 -0
- package/src/features/AgentSetting/AgentChat/index.tsx +135 -0
- package/src/features/AgentSetting/AgentMeta/index.tsx +4 -3
- package/src/features/AgentSetting/AgentModal/index.tsx +95 -0
- package/src/features/AgentSetting/AgentPlugin/index.tsx +65 -66
- package/src/features/AgentSetting/AgentPrompt/index.tsx +101 -47
- package/src/features/AgentSetting/AgentTTS/index.tsx +4 -0
- package/src/features/AgentSetting/StoreUpdater.tsx +2 -0
- package/src/features/AgentSetting/index.tsx +6 -6
- package/src/features/AgentSetting/store/index.ts +2 -0
- package/src/features/AvatarWithUpload/index.tsx +2 -0
- package/src/features/ChatInput/STT/browser.tsx +1 -1
- package/src/features/ChatInput/STT/openai.tsx +1 -1
- package/src/features/Conversation/components/InboxWelcome/AgentsSuggest.tsx +2 -2
- package/src/hooks/useQuery.ts +7 -0
- package/src/hooks/useQueryRoute.ts +16 -0
- package/src/locales/default/common.ts +14 -0
- package/src/locales/default/setting.ts +3 -0
- package/src/locales/resources.ts +1 -0
- package/src/server/redirectHard.ts +9 -0
- package/src/server/translation.ts +20 -0
- package/src/services/__tests__/chat.test.ts +1 -1
- package/src/store/global/initialState.ts +1 -0
- package/src/store/market/action.ts +1 -1
- package/src/store/session/slices/session/action.ts +1 -1
- package/src/utils/difference.ts +2 -1
- package/src/app/(main)/@nav/_layout/Desktop/Avatar.tsx +0 -11
- package/src/app/(main)/chat/settings/(desktop)/index.tsx +0 -23
- package/src/app/(main)/chat/settings/(mobile)/index.tsx +0 -16
- package/src/app/(main)/market/(desktop)/index.tsx +0 -20
- package/src/app/(main)/market/(mobile)/features/AgentCard.tsx +0 -31
- package/src/app/(main)/market/(mobile)/index.tsx +0 -25
- package/src/app/(main)/market/components/Loading.tsx +0 -13
- package/src/app/(main)/market/features/AgentCard/AgentCardItem.tsx +0 -54
- package/src/app/(main)/market/features/AgentCard/style.ts +0 -33
- package/src/app/(main)/market/features/AgentDetailContent/index.tsx +0 -12
- package/src/app/(main)/market/features/AgentSearchBar/index.tsx +0 -40
- package/src/app/(main)/market/features/PageTitle/index.tsx +0 -13
- package/src/app/(main)/market/features/TagList/Inner.tsx +0 -28
- package/src/app/(main)/market/features/TagList/index.tsx +0 -23
- package/src/app/(main)/market/layout.ts +0 -8
- package/src/app/(main)/settings/(desktop)/index.tsx +0 -23
- package/src/app/(main)/settings/(mobile)/features/AvatarBanner.tsx +0 -68
- package/src/app/(main)/settings/(mobile)/features/ExtraList.tsx +0 -65
- package/src/app/(main)/settings/(mobile)/index.tsx +0 -53
- package/src/app/(main)/settings/about/AboutList.tsx +0 -53
- package/src/app/(main)/settings/about/Analytics.tsx +0 -40
- package/src/app/(main)/settings/about/style.ts +0 -22
- package/src/app/(main)/settings/agent/Agent.tsx +0 -29
- package/src/app/(main)/settings/common/index.tsx +0 -24
- package/src/app/(main)/settings/common/loading.tsx +0 -3
- package/src/app/(main)/settings/features/SettingList/index.tsx +0 -47
- package/src/app/(main)/settings/llm/index.tsx +0 -59
- package/src/app/(main)/settings/llm/layout.tsx +0 -11
- package/src/app/(main)/settings/llm/loading.tsx +0 -3
- package/src/app/(main)/settings/sync/DeviceInfo/DeviceName.tsx +0 -66
- package/src/app/(main)/settings/sync/PageTitle.tsx +0 -11
- package/src/app/(main)/settings/sync/layout.tsx +0 -12
- package/src/app/(main)/settings/sync/loading.tsx +0 -3
- package/src/app/(main)/settings/tts/loading.tsx +0 -3
- package/src/features/AgentSetting/AgentConfig/index.tsx +0 -202
- package/src/features/AgentSetting/AgentConfig/useSyncConfig.ts +0 -23
- /package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Comment.tsx +0 -0
- /package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Loading.tsx +0 -0
- /package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/TokenTag.tsx +0 -0
- /package/src/app/(main)/settings/{features/SettingList → about/features}/Item.tsx +0 -0
- /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/ThemeSwatchesNeutral.tsx +0 -0
- /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/ThemeSwatchesPrimary.tsx +0 -0
- /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/index.ts +0 -0
- /package/src/app/(main)/settings/sync/{Alert.tsx → features/Alert.tsx} +0 -0
- /package/src/app/(main)/settings/sync/{components → features/WebRTC}/SyncSwitch/index.css +0 -0
- /package/src/app/(main)/settings/sync/{components → features/WebRTC}/SyncSwitch/index.tsx +0 -0
- /package/src/app/(main)/settings/sync/{util.ts → features/WebRTC/generateRandomRoomName.ts} +0 -0
- /package/src/app/(main)/settings/tts/{TTS/options.ts → features/const.ts} +0 -0
- /package/src/features/AgentSetting/{AgentConfig → AgentModal}/ModelSelect.tsx +0 -0
|
@@ -3,8 +3,6 @@ import { createStyles } from 'antd-style';
|
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
import { Flexbox } from 'react-layout-kit';
|
|
5
5
|
|
|
6
|
-
import { MetaData } from '@/types/meta';
|
|
7
|
-
|
|
8
6
|
export const useStyles = createStyles(({ css, token }) => ({
|
|
9
7
|
banner: css`
|
|
10
8
|
position: relative;
|
|
@@ -15,25 +13,22 @@ export const useStyles = createStyles(({ css, token }) => ({
|
|
|
15
13
|
margin-bottom: -56px;
|
|
16
14
|
|
|
17
15
|
background: ${token.colorFillSecondary};
|
|
18
|
-
|
|
19
|
-
mask-image: linear-gradient(to bottom, #fff, transparent);
|
|
20
16
|
`,
|
|
21
17
|
bannerImg: css`
|
|
22
18
|
position: absolute;
|
|
23
|
-
|
|
24
|
-
filter: blur(50px) saturate(2);
|
|
19
|
+
filter: blur(40px) saturate(1.5);
|
|
25
20
|
`,
|
|
26
21
|
}));
|
|
27
22
|
|
|
28
23
|
interface AgentCardBannerProps extends DivProps {
|
|
24
|
+
avatar?: string;
|
|
29
25
|
mask?: boolean;
|
|
30
26
|
maskColor?: string;
|
|
31
|
-
meta: MetaData;
|
|
32
27
|
size?: number;
|
|
33
28
|
}
|
|
34
29
|
|
|
35
30
|
const AgentCardBanner = memo<AgentCardBannerProps>(
|
|
36
|
-
({
|
|
31
|
+
({ avatar, className, size = 600, children, ...props }) => {
|
|
37
32
|
const { styles, cx } = useStyles();
|
|
38
33
|
|
|
39
34
|
return (
|
|
@@ -43,7 +38,13 @@ const AgentCardBanner = memo<AgentCardBannerProps>(
|
|
|
43
38
|
justify={'center'}
|
|
44
39
|
{...props}
|
|
45
40
|
>
|
|
46
|
-
<Avatar
|
|
41
|
+
<Avatar
|
|
42
|
+
alt={'banner'}
|
|
43
|
+
avatar={avatar}
|
|
44
|
+
className={styles.bannerImg}
|
|
45
|
+
shape={'square'}
|
|
46
|
+
size={size}
|
|
47
|
+
/>
|
|
47
48
|
{children}
|
|
48
49
|
</Flexbox>
|
|
49
50
|
);
|
|
@@ -1,62 +1,137 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { Avatar, Tag } from '@lobehub/ui';
|
|
2
|
+
import { Typography } from 'antd';
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
import { startCase } from 'lodash-es';
|
|
5
|
+
import Link from 'next/link';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { Center, Flexbox } from 'react-layout-kit';
|
|
8
|
+
|
|
9
|
+
import { useMarketStore } from '@/store/market';
|
|
10
|
+
import { AgentsMarketIndexItem } from '@/types/market';
|
|
11
|
+
|
|
12
|
+
import AgentCardBanner from './AgentCardBanner';
|
|
13
|
+
|
|
14
|
+
const { Paragraph, Title } = Typography;
|
|
15
|
+
|
|
16
|
+
const useStyles = createStyles(({ css, token, isDarkMode }) => ({
|
|
17
|
+
banner: css`
|
|
18
|
+
opacity: ${isDarkMode ? 0.9 : 0.4};
|
|
19
|
+
`,
|
|
20
|
+
container: css`
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
|
|
23
|
+
position: relative;
|
|
24
|
+
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
|
|
27
|
+
height: 100%;
|
|
28
|
+
|
|
29
|
+
background: ${token.colorBgContainer};
|
|
30
|
+
border-radius: ${token.borderRadiusLG}px;
|
|
31
|
+
box-shadow: 0 0 1px 1px ${token.colorFillQuaternary} inset;
|
|
32
|
+
|
|
33
|
+
transition: box-shadow 0.2s ${token.motionEaseInOut};
|
|
34
|
+
|
|
35
|
+
&:hover {
|
|
36
|
+
box-shadow: 0 0 1px 1px ${token.colorFillSecondary} inset;
|
|
37
|
+
}
|
|
38
|
+
`,
|
|
39
|
+
desc: css`
|
|
40
|
+
min-height: 44px;
|
|
41
|
+
margin-bottom: 0 !important;
|
|
42
|
+
color: ${token.colorTextDescription};
|
|
43
|
+
`,
|
|
44
|
+
inner: css`
|
|
45
|
+
padding: 16px;
|
|
46
|
+
`,
|
|
47
|
+
time: css`
|
|
48
|
+
color: ${token.colorTextDescription};
|
|
49
|
+
`,
|
|
50
|
+
title: css`
|
|
51
|
+
margin-bottom: 0 !important;
|
|
52
|
+
font-size: 18px !important;
|
|
53
|
+
`,
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
interface AgentCardProps extends AgentsMarketIndexItem {
|
|
57
|
+
variant?: 'default' | 'compact';
|
|
18
58
|
}
|
|
19
59
|
|
|
20
|
-
const AgentCard = memo<AgentCardProps>(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
s.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
60
|
+
const AgentCard = memo<AgentCardProps>(
|
|
61
|
+
({ meta, createAt, author, homepage, identifier, variant }) => {
|
|
62
|
+
const { avatar, title, description, tags } = meta;
|
|
63
|
+
|
|
64
|
+
const onAgentCardClick = useMarketStore((s) => s.activateAgent);
|
|
65
|
+
const { styles, theme } = useStyles();
|
|
66
|
+
const isCompact = variant === 'compact';
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<Flexbox
|
|
70
|
+
className={styles.container}
|
|
71
|
+
gap={24}
|
|
72
|
+
key={identifier}
|
|
73
|
+
onClick={() => onAgentCardClick(identifier)}
|
|
74
|
+
>
|
|
75
|
+
{!isCompact && <AgentCardBanner avatar={avatar} />}
|
|
76
|
+
<Flexbox className={styles.inner} gap={12}>
|
|
77
|
+
<Flexbox align={'flex-end'} gap={16} horizontal justify={'space-between'} width={'100%'}>
|
|
78
|
+
<Title className={styles.title} ellipsis={{ rows: 1, tooltip: title }} level={3}>
|
|
79
|
+
{title}
|
|
80
|
+
</Title>
|
|
81
|
+
{isCompact ? (
|
|
82
|
+
<Avatar
|
|
83
|
+
alt={title}
|
|
84
|
+
avatar={avatar}
|
|
85
|
+
size={40}
|
|
86
|
+
style={{ alignSelf: 'flex-end' }}
|
|
87
|
+
title={title}
|
|
88
|
+
/>
|
|
89
|
+
) : (
|
|
90
|
+
<Center
|
|
91
|
+
flex={'none'}
|
|
92
|
+
height={64}
|
|
93
|
+
style={{
|
|
94
|
+
background: theme.colorBgContainer,
|
|
95
|
+
borderRadius: '50%',
|
|
96
|
+
marginTop: -6,
|
|
97
|
+
overflow: 'hidden',
|
|
98
|
+
zIndex: 2,
|
|
99
|
+
}}
|
|
100
|
+
width={64}
|
|
101
|
+
>
|
|
102
|
+
<Avatar alt={title} avatar={avatar} size={56} title={title} />
|
|
103
|
+
</Center>
|
|
104
|
+
)}
|
|
105
|
+
</Flexbox>
|
|
106
|
+
{!isCompact && (
|
|
107
|
+
<Flexbox gap={12} horizontal style={{ fontSize: 12 }}>
|
|
108
|
+
<Link aria-label={author} href={homepage} target={'_blank'}>
|
|
109
|
+
@{author}
|
|
110
|
+
</Link>
|
|
111
|
+
<time className={styles.time} dateTime={new Date(createAt).toISOString()}>
|
|
112
|
+
{createAt}
|
|
113
|
+
</time>
|
|
114
|
+
</Flexbox>
|
|
115
|
+
)}
|
|
116
|
+
<Paragraph className={styles.desc} ellipsis={{ rows: 2 }}>
|
|
117
|
+
{description}
|
|
118
|
+
</Paragraph>
|
|
119
|
+
<Flexbox gap={6} horizontal style={{ flexWrap: 'wrap' }}>
|
|
120
|
+
{(tags as string[])
|
|
121
|
+
.slice(0, 4)
|
|
122
|
+
.filter(Boolean)
|
|
123
|
+
.map((tag: string, index) => (
|
|
124
|
+
<Tag key={index} style={{ margin: 0 }}>
|
|
125
|
+
{startCase(tag).trim()}
|
|
126
|
+
</Tag>
|
|
127
|
+
))}
|
|
128
|
+
</Flexbox>
|
|
129
|
+
</Flexbox>
|
|
130
|
+
</Flexbox>
|
|
131
|
+
);
|
|
132
|
+
},
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
AgentCard.displayName = 'AgentCard';
|
|
61
136
|
|
|
62
137
|
export default AgentCard;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Grid, SpotlightCardProps } from '@lobehub/ui';
|
|
4
|
+
import { Empty, Skeleton } from 'antd';
|
|
5
|
+
import { createStyles } from 'antd-style';
|
|
6
|
+
import isEqual from 'fast-deep-equal';
|
|
7
|
+
import { memo, useCallback, useLayoutEffect } from 'react';
|
|
8
|
+
import { useTranslation } from 'react-i18next';
|
|
9
|
+
import LazyLoad from 'react-lazy-load';
|
|
10
|
+
|
|
11
|
+
import { agentMarketSelectors, useMarketStore } from '@/store/market';
|
|
12
|
+
|
|
13
|
+
import AgentCard from './AgentCard';
|
|
14
|
+
|
|
15
|
+
const useStyles = createStyles(({ css, responsive }) => ({
|
|
16
|
+
compactLazy: css`
|
|
17
|
+
min-height: 120px;
|
|
18
|
+
`,
|
|
19
|
+
lazy: css`
|
|
20
|
+
min-height: 332px;
|
|
21
|
+
`,
|
|
22
|
+
title: css`
|
|
23
|
+
margin-top: 0.5em;
|
|
24
|
+
font-size: 24px;
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
${responsive.mobile} {
|
|
27
|
+
font-size: 20px;
|
|
28
|
+
}
|
|
29
|
+
`,
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
export interface AgentListProps {
|
|
33
|
+
mobile?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const AgentList = memo<AgentListProps>(({ mobile }) => {
|
|
37
|
+
const { t } = useTranslation('market');
|
|
38
|
+
const [searchKeywords, useFetchAgentList] = useMarketStore((s) => [
|
|
39
|
+
s.searchKeywords,
|
|
40
|
+
s.useFetchAgentList,
|
|
41
|
+
]);
|
|
42
|
+
const { isLoading } = useFetchAgentList();
|
|
43
|
+
const agentList = useMarketStore(agentMarketSelectors.getAgentList, isEqual);
|
|
44
|
+
const { styles } = useStyles();
|
|
45
|
+
const recentLength = mobile ? 3 : 6;
|
|
46
|
+
|
|
47
|
+
useLayoutEffect(() => {
|
|
48
|
+
// refs: https://github.com/pmndrs/zustand/blob/main/docs/integrations/persisting-store-data.md#hashydrated
|
|
49
|
+
useMarketStore.persist.rehydrate();
|
|
50
|
+
}, []);
|
|
51
|
+
|
|
52
|
+
const GridCompactRender: SpotlightCardProps['renderItem'] = useCallback(
|
|
53
|
+
(props: any) => (
|
|
54
|
+
<LazyLoad className={styles.compactLazy} offset={332}>
|
|
55
|
+
<AgentCard variant={'compact'} {...props} />
|
|
56
|
+
</LazyLoad>
|
|
57
|
+
),
|
|
58
|
+
[],
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
if (isLoading) return <Skeleton paragraph={{ rows: 8 }} title={false} />;
|
|
62
|
+
|
|
63
|
+
if (searchKeywords) {
|
|
64
|
+
if (agentList.length === 0) return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
|
|
65
|
+
return (
|
|
66
|
+
<Grid rows={3}>
|
|
67
|
+
{agentList.map((item) => (
|
|
68
|
+
<GridCompactRender key={item.identifier} {...item} />
|
|
69
|
+
))}
|
|
70
|
+
</Grid>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
<h2 className={styles.title}>{t('title.recentSubmits')}</h2>
|
|
77
|
+
<Grid rows={3}>
|
|
78
|
+
{agentList.slice(0, recentLength).map((item) => (
|
|
79
|
+
<AgentCard key={item.identifier} {...item} />
|
|
80
|
+
))}
|
|
81
|
+
</Grid>
|
|
82
|
+
<h2 className={styles.title}>{t('title.allAgents')}</h2>
|
|
83
|
+
<Grid rows={3}>
|
|
84
|
+
{agentList.slice(recentLength).map((item) => (
|
|
85
|
+
<GridCompactRender key={item.identifier} {...item} />
|
|
86
|
+
))}
|
|
87
|
+
</Grid>
|
|
88
|
+
</>
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
AgentList.displayName = 'AgentList';
|
|
93
|
+
|
|
94
|
+
export default AgentList;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { SearchBar } from '@lobehub/ui';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import useControlledState from 'use-merge-value';
|
|
7
|
+
|
|
8
|
+
import { useMarketStore } from '@/store/market';
|
|
9
|
+
|
|
10
|
+
interface AgentSearchBarProps {
|
|
11
|
+
mobile?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const AgentSearchBar = memo<AgentSearchBarProps>(({ mobile }) => {
|
|
15
|
+
const { t } = useTranslation('market');
|
|
16
|
+
const [searchKeywords, setSearchKeywords] = useMarketStore((s) => [
|
|
17
|
+
s.searchKeywords,
|
|
18
|
+
s.setSearchKeywords,
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
const [keyword, setKeyword] = useControlledState(searchKeywords, {
|
|
22
|
+
onChange: setSearchKeywords,
|
|
23
|
+
value: searchKeywords,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<SearchBar
|
|
28
|
+
allowClear
|
|
29
|
+
enableShortKey={!mobile}
|
|
30
|
+
onChange={(e) => {
|
|
31
|
+
setKeyword(e.target.value);
|
|
32
|
+
}}
|
|
33
|
+
placeholder={t('search.placeholder')}
|
|
34
|
+
shortKey={'k'}
|
|
35
|
+
spotlight={!mobile}
|
|
36
|
+
type={mobile ? 'block' : 'ghost'}
|
|
37
|
+
value={keyword}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export default AgentSearchBar;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Icon } from '@lobehub/ui';
|
|
1
|
+
import { Icon, Typography } from '@lobehub/ui';
|
|
2
2
|
import { Button, Divider, Tag } from 'antd';
|
|
3
3
|
import { Github, Settings, Share2 } from 'lucide-react';
|
|
4
4
|
import Image from 'next/image';
|
|
@@ -10,7 +10,7 @@ import { AGENTS_INDEX_GITHUB, imageUrl } from '@/const/url';
|
|
|
10
10
|
const Inner = memo(() => {
|
|
11
11
|
const { t } = useTranslation('market');
|
|
12
12
|
return (
|
|
13
|
-
|
|
13
|
+
<Typography fontSize={14} headerMultiple={0.5} marginMultiple={0.4}>
|
|
14
14
|
<Image
|
|
15
15
|
alt={'banner'}
|
|
16
16
|
height={602}
|
|
@@ -23,12 +23,14 @@ const Inner = memo(() => {
|
|
|
23
23
|
<span>{t('guide.func1.title')}</span>
|
|
24
24
|
</h3>
|
|
25
25
|
<p>
|
|
26
|
-
<
|
|
27
|
-
|
|
26
|
+
<kbd>
|
|
27
|
+
<Icon icon={Settings} />
|
|
28
|
+
</kbd>
|
|
28
29
|
{t('guide.func1.desc1')}
|
|
29
30
|
<br />
|
|
30
|
-
<
|
|
31
|
-
|
|
31
|
+
<kbd>
|
|
32
|
+
<Icon icon={Share2} />
|
|
33
|
+
</kbd>
|
|
32
34
|
{t('guide.func1.desc2')}
|
|
33
35
|
</p>
|
|
34
36
|
<Divider />
|
|
@@ -45,7 +47,7 @@ const Inner = memo(() => {
|
|
|
45
47
|
>
|
|
46
48
|
{t('guide.func2.button')}
|
|
47
49
|
</Button>
|
|
48
|
-
|
|
50
|
+
</Typography>
|
|
49
51
|
);
|
|
50
52
|
});
|
|
51
53
|
|
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
import { ActionIcon, Icon, Modal } from '@lobehub/ui';
|
|
2
|
-
import { Button } from 'antd';
|
|
3
|
-
import {
|
|
2
|
+
import { Button, Skeleton } from 'antd';
|
|
3
|
+
import { useResponsive } from 'antd-style';
|
|
4
|
+
import { Upload } from 'lucide-react';
|
|
5
|
+
import dynamic from 'next/dynamic';
|
|
4
6
|
import { memo, useState } from 'react';
|
|
5
7
|
import { useTranslation } from 'react-i18next';
|
|
6
8
|
|
|
7
9
|
import { MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens';
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
const Inner = dynamic(() => import('./Inner'), {
|
|
12
|
+
loading: () => <Skeleton paragraph={{ rows: 8 }} title={false} />,
|
|
13
|
+
});
|
|
10
14
|
|
|
11
15
|
const ShareAgentButton = memo<{ mobile?: boolean }>(({ mobile }) => {
|
|
16
|
+
const { mobile: resMobile } = useResponsive();
|
|
12
17
|
const { t } = useTranslation('market');
|
|
13
18
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
14
19
|
|
|
15
|
-
const buttonContent =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
{
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
const buttonContent =
|
|
21
|
+
mobile || resMobile ? (
|
|
22
|
+
<ActionIcon
|
|
23
|
+
icon={Upload}
|
|
24
|
+
onClick={() => setIsModalOpen(true)}
|
|
25
|
+
size={MOBILE_HEADER_ICON_SIZE}
|
|
26
|
+
title={t('submitAgent')}
|
|
27
|
+
/>
|
|
28
|
+
) : (
|
|
29
|
+
<Button icon={<Icon icon={Upload} />} onClick={() => setIsModalOpen(true)}>
|
|
30
|
+
{t('submitAgent')}
|
|
31
|
+
</Button>
|
|
32
|
+
);
|
|
27
33
|
|
|
28
34
|
return (
|
|
29
35
|
<>
|
|
30
36
|
{buttonContent}
|
|
31
37
|
<Modal
|
|
38
|
+
allowFullscreen
|
|
32
39
|
footer={null}
|
|
33
40
|
onCancel={() => setIsModalOpen(false)}
|
|
34
41
|
open={isModalOpen}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Button } from 'antd';
|
|
4
|
+
import { createStyles, useResponsive } from 'antd-style';
|
|
5
|
+
import isEqual from 'fast-deep-equal';
|
|
6
|
+
import { startCase } from 'lodash-es';
|
|
7
|
+
import { memo } from 'react';
|
|
8
|
+
import { Flexbox } from 'react-layout-kit';
|
|
9
|
+
|
|
10
|
+
import { agentMarketSelectors, useMarketStore } from '@/store/market';
|
|
11
|
+
|
|
12
|
+
const useStyles = createStyles(({ css, token }) => ({
|
|
13
|
+
active: css`
|
|
14
|
+
color: ${token.colorBgLayout};
|
|
15
|
+
background: ${token.colorPrimary};
|
|
16
|
+
|
|
17
|
+
&:hover {
|
|
18
|
+
color: ${token.colorBgLayout} !important;
|
|
19
|
+
background: ${token.colorPrimary} !important;
|
|
20
|
+
}
|
|
21
|
+
`,
|
|
22
|
+
tag: css`
|
|
23
|
+
background: ${token.colorBgContainer};
|
|
24
|
+
border: none;
|
|
25
|
+
|
|
26
|
+
&:hover {
|
|
27
|
+
background: ${token.colorBgElevated} !important;
|
|
28
|
+
}
|
|
29
|
+
`,
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
const TagList = memo(() => {
|
|
33
|
+
const { cx, styles } = useStyles();
|
|
34
|
+
const { md = true } = useResponsive();
|
|
35
|
+
const [searchKeywords, setSearchKeywords] = useMarketStore((s) => [
|
|
36
|
+
s.searchKeywords,
|
|
37
|
+
s.setSearchKeywords,
|
|
38
|
+
]);
|
|
39
|
+
const agentTagList = useMarketStore(agentMarketSelectors.getAgentTagList, isEqual);
|
|
40
|
+
|
|
41
|
+
const list = md ? agentTagList : agentTagList.slice(0, 20);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Flexbox gap={6} horizontal style={{ flexWrap: 'wrap' }}>
|
|
45
|
+
{list.map((item) => {
|
|
46
|
+
const isActive = searchKeywords === item;
|
|
47
|
+
return (
|
|
48
|
+
<Button
|
|
49
|
+
className={cx(styles.tag, isActive && styles.active)}
|
|
50
|
+
key={item}
|
|
51
|
+
onClick={() => {
|
|
52
|
+
setSearchKeywords(isActive ? '' : item);
|
|
53
|
+
}}
|
|
54
|
+
shape={'round'}
|
|
55
|
+
size={'small'}
|
|
56
|
+
>
|
|
57
|
+
{startCase(item)}
|
|
58
|
+
</Button>
|
|
59
|
+
);
|
|
60
|
+
})}
|
|
61
|
+
</Flexbox>
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export default TagList;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import ServerLayout from '@/components/server/ServerLayout';
|
|
2
|
+
|
|
3
|
+
import Desktop from './_layout/Desktop';
|
|
4
|
+
import Mobile from './_layout/Mobile';
|
|
5
|
+
import { LayoutProps } from './_layout/type';
|
|
6
|
+
|
|
7
|
+
const MainLayout = ServerLayout<LayoutProps>({ Desktop, Mobile });
|
|
8
|
+
|
|
9
|
+
MainLayout.displayName = 'MarketLayout';
|
|
10
|
+
|
|
11
|
+
export default MainLayout;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Skeleton } from 'antd';
|
|
2
2
|
|
|
3
|
-
export default () => <
|
|
3
|
+
export default () => <Skeleton paragraph={{ rows: 8 }} style={{ marginBlock: 24 }} title={false} />;
|
|
@@ -1,25 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flexbox } from 'react-layout-kit';
|
|
2
2
|
|
|
3
3
|
import { getCanonicalUrl } from '@/const/url';
|
|
4
|
+
import { translation } from '@/server/translation';
|
|
4
5
|
import { isMobileDevice } from '@/utils/responsive';
|
|
5
6
|
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import AgentList from './features/AgentList';
|
|
8
|
+
import AgentSearchBar from './features/AgentSearchBar';
|
|
9
|
+
import TagList from './features/TagList';
|
|
9
10
|
|
|
10
|
-
export
|
|
11
|
-
const
|
|
11
|
+
export const generateMetadata = async () => {
|
|
12
|
+
const { t } = await translation('common');
|
|
13
|
+
return {
|
|
14
|
+
alternates: { canonical: getCanonicalUrl('/market') },
|
|
15
|
+
title: t('tab.market'),
|
|
16
|
+
};
|
|
17
|
+
};
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
const Page = () => {
|
|
20
|
+
const mobile = isMobileDevice();
|
|
14
21
|
|
|
15
22
|
return (
|
|
16
23
|
<>
|
|
17
|
-
<
|
|
18
|
-
<
|
|
24
|
+
<AgentSearchBar mobile={mobile} />
|
|
25
|
+
<Flexbox gap={mobile ? 16 : 24}>
|
|
26
|
+
<TagList />
|
|
27
|
+
<AgentList mobile={mobile} />
|
|
28
|
+
</Flexbox>
|
|
19
29
|
</>
|
|
20
30
|
);
|
|
21
31
|
};
|
|
22
32
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
Page.DisplayName = 'Market';
|
|
34
|
+
|
|
35
|
+
export default Page;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import UpgradeAlert from '@/app/(main)/settings//features/UpgradeAlert';
|
|
2
|
+
|
|
3
|
+
import CategoryContent from './features/CategoryContent';
|
|
4
|
+
|
|
5
|
+
const Category = () => {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<CategoryContent />
|
|
9
|
+
<UpgradeAlert />
|
|
10
|
+
</>
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
Category.displayName = 'SettingCategory';
|
|
15
|
+
|
|
16
|
+
export default Category;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import urlJoin from 'url-join';
|
|
5
|
+
|
|
6
|
+
import Menu from '@/components/Menu';
|
|
7
|
+
import { useActiveSettingsKey } from '@/hooks/useActiveSettingsKey';
|
|
8
|
+
import { useQueryRoute } from '@/hooks/useQueryRoute';
|
|
9
|
+
|
|
10
|
+
import { useCategory } from '../../hooks/useCategory';
|
|
11
|
+
|
|
12
|
+
const CategoryContent = memo<{ modal?: boolean }>(({ modal }) => {
|
|
13
|
+
const activeTab = useActiveSettingsKey();
|
|
14
|
+
const cateItems = useCategory();
|
|
15
|
+
const router = useQueryRoute();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Menu
|
|
19
|
+
items={cateItems}
|
|
20
|
+
onClick={({ key }) => {
|
|
21
|
+
const path = urlJoin('/settings', key);
|
|
22
|
+
if (modal) {
|
|
23
|
+
router.replace(path);
|
|
24
|
+
} else {
|
|
25
|
+
router.push(path);
|
|
26
|
+
}
|
|
27
|
+
}}
|
|
28
|
+
selectable
|
|
29
|
+
selectedKeys={[activeTab as any]}
|
|
30
|
+
variant={'compact'}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export default CategoryContent;
|