@lobehub/chat 1.18.1 → 1.18.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.
Potentially problematic release.
This version of @lobehub/chat might be problematic. Click here for more details.
- package/CHANGELOG.md +25 -0
- package/package.json +2 -1
- package/src/app/(main)/discover/(detail)/assistant/[slug]/features/InfoSidebar/index.tsx +5 -8
- package/src/app/(main)/discover/(detail)/features/Back.tsx +0 -5
- package/src/app/(main)/discover/(detail)/features/DetailLayout.tsx +2 -34
- package/src/app/(main)/discover/(detail)/model/[...slugs]/features/InfoSidebar/index.tsx +3 -6
- package/src/app/(main)/discover/(detail)/model/[...slugs]/features/ProviderList/ProviderItem.tsx +14 -15
- package/src/app/(main)/discover/(detail)/plugin/[slug]/features/InfoSidebar/index.tsx +3 -6
- package/src/app/(main)/discover/(detail)/provider/[slug]/features/InfoSidebar/index.tsx +3 -6
- package/src/app/(main)/discover/(detail)/provider/[slug]/features/ModelList/ModelItem.tsx +14 -11
- package/src/app/(main)/discover/(list)/(home)/features/AssistantList.tsx +5 -11
- package/src/app/(main)/discover/(list)/(home)/features/ModelList.tsx +3 -3
- package/src/app/(main)/discover/(list)/(home)/features/PluginList.tsx +3 -6
- package/src/app/(main)/discover/(list)/assistants/features/List.tsx +7 -16
- package/src/app/(main)/discover/(list)/models/features/List.tsx +5 -11
- package/src/app/(main)/discover/(list)/plugins/features/List.tsx +7 -16
- package/src/app/(main)/discover/(list)/providers/features/List.tsx +5 -11
- package/src/app/(main)/discover/_layout/Desktop/index.tsx +3 -0
- package/src/app/(main)/discover/_layout/Mobile/index.tsx +8 -1
- package/src/app/layout.tsx +2 -1
- package/src/components/NProgress/index.tsx +12 -0
- package/src/features/Conversation/components/InboxWelcome/AgentsSuggest.tsx +3 -6
- package/src/hooks/useInterceptingRoutes.ts +1 -16
- package/src/app/@modal/(.)discover/assistant/[slug]/page.tsx +0 -1
- package/src/app/@modal/(.)discover/layout.tsx +0 -29
- package/src/app/@modal/(.)discover/loading.tsx +0 -3
- package/src/app/@modal/(.)discover/model/[...slugs]/page.tsx +0 -1
- package/src/app/@modal/(.)discover/plugin/[slug]/page.tsx +0 -1
- package/src/app/@modal/(.)discover/provider/[slug]/page.tsx +0 -1
- package/src/app/redirect/page.tsx +0 -15
- package/src/components/InterceptingLink/index.tsx +0 -27
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,31 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.18.2](https://github.com/lobehub/lobe-chat/compare/v1.18.1...v1.18.2)
|
6
|
+
|
7
|
+
<sup>Released on **2024-09-18**</sup>
|
8
|
+
|
9
|
+
#### 🐛 Bug Fixes
|
10
|
+
|
11
|
+
- **misc**: Fix InterceptingRoutes in discover.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### What's fixed
|
19
|
+
|
20
|
+
- **misc**: Fix InterceptingRoutes in discover, closes [#4011](https://github.com/lobehub/lobe-chat/issues/4011) ([2b75040](https://github.com/lobehub/lobe-chat/commit/2b75040))
|
21
|
+
|
22
|
+
</details>
|
23
|
+
|
24
|
+
<div align="right">
|
25
|
+
|
26
|
+
[](#readme-top)
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
5
30
|
### [Version 1.18.1](https://github.com/lobehub/lobe-chat/compare/v1.18.0...v1.18.1)
|
6
31
|
|
7
32
|
<sup>Released on **2024-09-18**</sup>
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.18.
|
3
|
+
"version": "1.18.2",
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
5
5
|
"keywords": [
|
6
6
|
"framework",
|
@@ -172,6 +172,7 @@
|
|
172
172
|
"next-auth": "beta",
|
173
173
|
"next-mdx-remote": "^4.4.1",
|
174
174
|
"next-sitemap": "^4.2.3",
|
175
|
+
"nextjs-toploader": "^3.6.15",
|
175
176
|
"numeral": "^2.0.6",
|
176
177
|
"nuqs": "^1.17.8",
|
177
178
|
"officeparser": "^4.1.1",
|
@@ -1,12 +1,12 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { Skeleton } from 'antd';
|
4
|
+
import Link from 'next/link';
|
4
5
|
import { memo } from 'react';
|
5
6
|
import { useTranslation } from 'react-i18next';
|
6
7
|
import { Flexbox, FlexboxProps } from 'react-layout-kit';
|
7
8
|
import urlJoin from 'url-join';
|
8
9
|
|
9
|
-
import InterceptingLink from '@/components/InterceptingLink';
|
10
10
|
import { DiscoverAssistantItem, DiscoverPlugintem } from '@/types/discover';
|
11
11
|
|
12
12
|
import Block from '../../../../features/Block';
|
@@ -28,13 +28,13 @@ const InfoSidebar = memo<InfoSidebarProps>(({ pluginData, data, ...rest }) => {
|
|
28
28
|
{pluginData && pluginData?.length > 0 && (
|
29
29
|
<Block gap={12} title={t('assistants.plugins')}>
|
30
30
|
{pluginData.map((item) => (
|
31
|
-
<
|
31
|
+
<Link
|
32
32
|
href={urlJoin('/discover/plugin', item.identifier)}
|
33
33
|
key={item.identifier}
|
34
34
|
style={{ color: 'inherit' }}
|
35
35
|
>
|
36
36
|
<ToolItem {...item} />
|
37
|
-
</
|
37
|
+
</Link>
|
38
38
|
))}
|
39
39
|
</Block>
|
40
40
|
)}
|
@@ -46,12 +46,9 @@ const InfoSidebar = memo<InfoSidebarProps>(({ pluginData, data, ...rest }) => {
|
|
46
46
|
>
|
47
47
|
{data?.suggestions?.length > 0 ? (
|
48
48
|
data?.suggestions.map((item) => (
|
49
|
-
<
|
50
|
-
href={urlJoin('/discover/assistant', item.identifier)}
|
51
|
-
key={item.identifier}
|
52
|
-
>
|
49
|
+
<Link href={urlJoin('/discover/assistant', item.identifier)} key={item.identifier}>
|
53
50
|
<SuggestionItem {...item} />
|
54
|
-
</
|
51
|
+
</Link>
|
55
52
|
))
|
56
53
|
) : (
|
57
54
|
<Skeleton active paragraph={{ rows: 5 }} title={false} />
|
@@ -8,8 +8,6 @@ import { CSSProperties, memo } from 'react';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
9
9
|
import { Flexbox } from 'react-layout-kit';
|
10
10
|
|
11
|
-
import { useInterceptingRoutes } from '@/hooks/useInterceptingRoutes';
|
12
|
-
|
13
11
|
const useStyles = createStyles(({ css, token }) => {
|
14
12
|
return {
|
15
13
|
back: css`
|
@@ -23,12 +21,9 @@ const useStyles = createStyles(({ css, token }) => {
|
|
23
21
|
});
|
24
22
|
|
25
23
|
const Back = memo<{ href: string; style?: CSSProperties }>(({ href, style }) => {
|
26
|
-
const { isIntercepted } = useInterceptingRoutes();
|
27
24
|
const { t } = useTranslation('discover');
|
28
25
|
const { styles } = useStyles();
|
29
26
|
|
30
|
-
if (isIntercepted) return null;
|
31
|
-
|
32
27
|
return (
|
33
28
|
<Link className={styles.back} href={href} style={{ marginBottom: 8, ...style }}>
|
34
29
|
<Flexbox align={'center'} gap={8} horizontal>
|
@@ -5,7 +5,6 @@ import { ReactNode, memo } from 'react';
|
|
5
5
|
import { Flexbox } from 'react-layout-kit';
|
6
6
|
|
7
7
|
import Footer from '@/features/Setting/Footer';
|
8
|
-
import { useInterceptingRoutes } from '@/hooks/useInterceptingRoutes';
|
9
8
|
|
10
9
|
import SidebarContainer from './SidebarContainer';
|
11
10
|
|
@@ -20,10 +19,9 @@ interface DetailLayoutProps {
|
|
20
19
|
|
21
20
|
const DetailLayout = memo<DetailLayoutProps>(
|
22
21
|
({ statistics, mobile, header, sidebar, children, actions }) => {
|
23
|
-
const { md = true
|
24
|
-
const { isIntercepted } = useInterceptingRoutes();
|
22
|
+
const { md = true } = useResponsive();
|
25
23
|
|
26
|
-
if (mobile || !md
|
24
|
+
if (mobile || !md)
|
27
25
|
return (
|
28
26
|
<>
|
29
27
|
{header}
|
@@ -37,36 +35,6 @@ const DetailLayout = memo<DetailLayoutProps>(
|
|
37
35
|
</>
|
38
36
|
);
|
39
37
|
|
40
|
-
if (isIntercepted) {
|
41
|
-
return (
|
42
|
-
<>
|
43
|
-
<Flexbox flex={1} gap={24} style={{ overflow: 'hidden', position: 'relative' }}>
|
44
|
-
<Flexbox style={{ paddingRight: 16 }}>{header}</Flexbox>
|
45
|
-
<Flexbox
|
46
|
-
gap={24}
|
47
|
-
style={{
|
48
|
-
overflowX: 'hidden',
|
49
|
-
overflowY: 'auto',
|
50
|
-
paddingBottom: 48,
|
51
|
-
paddingRight: 16,
|
52
|
-
position: 'relative',
|
53
|
-
}}
|
54
|
-
>
|
55
|
-
{children}
|
56
|
-
<Footer />
|
57
|
-
</Flexbox>
|
58
|
-
</Flexbox>
|
59
|
-
<SidebarContainer style={{ position: 'sticky', top: '0' }}>
|
60
|
-
<Flexbox gap={16} width={'100%'}>
|
61
|
-
{actions}
|
62
|
-
{statistics}
|
63
|
-
</Flexbox>
|
64
|
-
{sidebar}
|
65
|
-
</SidebarContainer>
|
66
|
-
</>
|
67
|
-
);
|
68
|
-
}
|
69
|
-
|
70
38
|
return (
|
71
39
|
<>
|
72
40
|
{header}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { Skeleton } from 'antd';
|
4
|
+
import Link from 'next/link';
|
4
5
|
import { memo } from 'react';
|
5
6
|
import { useTranslation } from 'react-i18next';
|
6
7
|
import { Flexbox, FlexboxProps } from 'react-layout-kit';
|
7
8
|
import urlJoin from 'url-join';
|
8
9
|
|
9
|
-
import InterceptingLink from '@/components/InterceptingLink';
|
10
10
|
import { DiscoverModelItem } from '@/types/discover';
|
11
11
|
|
12
12
|
import Block from '../../../../features/Block';
|
@@ -31,12 +31,9 @@ const InfoSidebar = memo<InfoSidebarProps>(({ data, ...rest }) => {
|
|
31
31
|
>
|
32
32
|
{data?.suggestions?.length > 0 ? (
|
33
33
|
data?.suggestions.map((item) => (
|
34
|
-
<
|
35
|
-
href={urlJoin('/discover/model', item.identifier)}
|
36
|
-
key={item.identifier}
|
37
|
-
>
|
34
|
+
<Link href={urlJoin('/discover/model', item.identifier)} key={item.identifier}>
|
38
35
|
<SuggestionItem {...item} />
|
39
|
-
</
|
36
|
+
</Link>
|
40
37
|
))
|
41
38
|
) : (
|
42
39
|
<Skeleton active paragraph={{ rows: 5 }} title={false} />
|
package/src/app/(main)/discover/(detail)/model/[...slugs]/features/ProviderList/ProviderItem.tsx
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { ModelTag, ProviderCombine } from '@lobehub/icons';
|
2
2
|
import { ActionIcon, Grid, Icon, Tooltip } from '@lobehub/ui';
|
3
3
|
import { Tag } from 'antd';
|
4
|
-
import { createStyles } from 'antd-style';
|
4
|
+
import { createStyles, useResponsive } from 'antd-style';
|
5
5
|
import { BadgeCheck, BookIcon, ChevronRightIcon, KeyIcon } from 'lucide-react';
|
6
6
|
import Link from 'next/link';
|
7
7
|
import { memo, useMemo } from 'react';
|
@@ -9,7 +9,6 @@ import { useTranslation } from 'react-i18next';
|
|
9
9
|
import { Flexbox } from 'react-layout-kit';
|
10
10
|
import urlJoin from 'url-join';
|
11
11
|
|
12
|
-
import InterceptingLink from '@/components/InterceptingLink';
|
13
12
|
import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';
|
14
13
|
import { BASE_PROVIDER_DOC_URL } from '@/const/url';
|
15
14
|
import { DiscoverProviderItem } from '@/types/discover';
|
@@ -31,9 +30,12 @@ interface ProviderItemProps extends DiscoverProviderItem {
|
|
31
30
|
|
32
31
|
const ProviderItem = memo<ProviderItemProps>(({ mobile, modelId, identifier }) => {
|
33
32
|
const { t } = useTranslation('discover');
|
33
|
+
const { xl = true } = useResponsive();
|
34
34
|
const { styles, theme } = useStyles();
|
35
35
|
const isLobeHub = identifier === 'lobehub';
|
36
36
|
|
37
|
+
const isMobile = mobile || !xl;
|
38
|
+
|
37
39
|
const model = useMemo(() => {
|
38
40
|
const prividerItem = DEFAULT_MODEL_PROVIDER_LIST.find((v) => v.id === identifier);
|
39
41
|
if (!prividerItem) return;
|
@@ -70,13 +72,10 @@ const ProviderItem = memo<ProviderItemProps>(({ mobile, modelId, identifier }) =
|
|
70
72
|
|
71
73
|
const header = (
|
72
74
|
<Flexbox gap={4} style={{ minWidth: 240 }}>
|
73
|
-
<
|
74
|
-
href={urlJoin('/discover/provider', identifier)}
|
75
|
-
style={{ color: 'inherit' }}
|
76
|
-
>
|
75
|
+
<Link href={urlJoin('/discover/provider', identifier)} style={{ color: 'inherit' }}>
|
77
76
|
<ProviderCombine provider={identifier} size={24} />
|
78
|
-
</
|
79
|
-
<Flexbox align={'center'} gap={6} horizontal>
|
77
|
+
</Link>
|
78
|
+
<Flexbox align={'center'} gap={6} horizontal wrap={'wrap'}>
|
80
79
|
<ModelTag model={modelId} style={{ background: theme.colorFillQuaternary, margin: 0 }} />
|
81
80
|
{isLobeHub && (
|
82
81
|
<Tooltip title={t('models.providerInfo.officialTooltip')}>
|
@@ -103,9 +102,9 @@ const ProviderItem = memo<ProviderItemProps>(({ mobile, modelId, identifier }) =
|
|
103
102
|
);
|
104
103
|
|
105
104
|
const button = (
|
106
|
-
<
|
105
|
+
<Link href={urlJoin('/discover/provider', identifier)} style={{ color: 'inherit' }}>
|
107
106
|
<ActionIcon color={theme.colorTextDescription} icon={ChevronRightIcon} />
|
108
|
-
</
|
107
|
+
</Link>
|
109
108
|
);
|
110
109
|
|
111
110
|
return (
|
@@ -117,7 +116,7 @@ const ProviderItem = memo<ProviderItemProps>(({ mobile, modelId, identifier }) =
|
|
117
116
|
padding={16}
|
118
117
|
wrap={'wrap'}
|
119
118
|
>
|
120
|
-
{
|
119
|
+
{isMobile && (
|
121
120
|
<Flexbox align={'center'} horizontal justify={'space-between'}>
|
122
121
|
{header}
|
123
122
|
{button}
|
@@ -129,13 +128,13 @@ const ProviderItem = memo<ProviderItemProps>(({ mobile, modelId, identifier }) =
|
|
129
128
|
gap={16}
|
130
129
|
horizontal
|
131
130
|
maxItemWidth={100}
|
132
|
-
rows={
|
131
|
+
rows={isMobile ? 2 : items.length + 1}
|
133
132
|
style={{ minWidth: 240 }}
|
134
133
|
>
|
135
|
-
{!
|
134
|
+
{!isMobile && header}
|
136
135
|
{items.map((item, index) => (
|
137
136
|
<Statistic
|
138
|
-
align={
|
137
|
+
align={isMobile ? 'flex-start' : 'center'}
|
139
138
|
gap={4}
|
140
139
|
key={index}
|
141
140
|
valuePlacement={'bottom'}
|
@@ -144,7 +143,7 @@ const ProviderItem = memo<ProviderItemProps>(({ mobile, modelId, identifier }) =
|
|
144
143
|
/>
|
145
144
|
))}
|
146
145
|
</Grid>
|
147
|
-
{!
|
146
|
+
{!isMobile && button}
|
148
147
|
</Flexbox>
|
149
148
|
);
|
150
149
|
});
|
@@ -1,12 +1,12 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { Skeleton } from 'antd';
|
4
|
+
import Link from 'next/link';
|
4
5
|
import { memo } from 'react';
|
5
6
|
import { useTranslation } from 'react-i18next';
|
6
7
|
import { Flexbox, FlexboxProps } from 'react-layout-kit';
|
7
8
|
import urlJoin from 'url-join';
|
8
9
|
|
9
|
-
import InterceptingLink from '@/components/InterceptingLink';
|
10
10
|
import { DiscoverPlugintem } from '@/types/discover';
|
11
11
|
|
12
12
|
import Block from '../../../../features/Block';
|
@@ -31,12 +31,9 @@ const InfoSidebar = memo<InfoSidebarProps>(({ data, ...rest }) => {
|
|
31
31
|
>
|
32
32
|
{data?.suggestions?.length > 0 ? (
|
33
33
|
data?.suggestions.map((item) => (
|
34
|
-
<
|
35
|
-
href={urlJoin('/discover/plugin', item.identifier)}
|
36
|
-
key={item.identifier}
|
37
|
-
>
|
34
|
+
<Link href={urlJoin('/discover/plugin', item.identifier)} key={item.identifier}>
|
38
35
|
<SuggestionItem {...item} />
|
39
|
-
</
|
36
|
+
</Link>
|
40
37
|
))
|
41
38
|
) : (
|
42
39
|
<Skeleton active paragraph={{ rows: 5 }} title={false} />
|
@@ -1,12 +1,12 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { Skeleton } from 'antd';
|
4
|
+
import Link from 'next/link';
|
4
5
|
import { memo } from 'react';
|
5
6
|
import { useTranslation } from 'react-i18next';
|
6
7
|
import { Flexbox, FlexboxProps } from 'react-layout-kit';
|
7
8
|
import urlJoin from 'url-join';
|
8
9
|
|
9
|
-
import InterceptingLink from '@/components/InterceptingLink';
|
10
10
|
import { DiscoverProviderItem } from '@/types/discover';
|
11
11
|
|
12
12
|
import Block from '../../../../features/Block';
|
@@ -31,12 +31,9 @@ const InfoSidebar = memo<InfoSidebarProps>(({ data, ...rest }) => {
|
|
31
31
|
>
|
32
32
|
{data?.suggestions?.length > 0 ? (
|
33
33
|
data?.suggestions.map((item) => (
|
34
|
-
<
|
35
|
-
href={urlJoin('/discover/provider', item.identifier)}
|
36
|
-
key={item.identifier}
|
37
|
-
>
|
34
|
+
<Link href={urlJoin('/discover/provider', item.identifier)} key={item.identifier}>
|
38
35
|
<SuggestionItem {...item} />
|
39
|
-
</
|
36
|
+
</Link>
|
40
37
|
))
|
41
38
|
) : (
|
42
39
|
<Skeleton active paragraph={{ rows: 5 }} title={false} />
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { ModelIcon } from '@lobehub/icons';
|
2
2
|
import { ActionIcon, Grid } from '@lobehub/ui';
|
3
3
|
import { Typography } from 'antd';
|
4
|
-
import { createStyles } from 'antd-style';
|
4
|
+
import { createStyles, useResponsive } from 'antd-style';
|
5
5
|
import { ChevronRightIcon } from 'lucide-react';
|
6
|
+
import Link from 'next/link';
|
6
7
|
import { memo } from 'react';
|
7
8
|
import { useTranslation } from 'react-i18next';
|
8
9
|
import { Flexbox, FlexboxProps } from 'react-layout-kit';
|
9
10
|
import urlJoin from 'url-join';
|
10
11
|
|
11
|
-
import InterceptingLink from '@/components/InterceptingLink';
|
12
12
|
import { DiscoverModelItem } from '@/types/discover';
|
13
13
|
import { formatPriceByCurrency, formatTokenNumber } from '@/utils/format';
|
14
14
|
|
@@ -48,9 +48,12 @@ export interface SuggestionItemProps
|
|
48
48
|
|
49
49
|
const ModelItem = memo<SuggestionItemProps>(({ mobile, meta, identifier }) => {
|
50
50
|
const { title, tokens, vision, functionCall } = meta;
|
51
|
+
const { xl = true } = useResponsive();
|
51
52
|
const { t } = useTranslation('discover');
|
52
53
|
const { styles, theme } = useStyles();
|
53
54
|
|
55
|
+
const isMobile = mobile || !xl;
|
56
|
+
|
54
57
|
const items: StatisticProps[] = [
|
55
58
|
{
|
56
59
|
title: t('models.contentLength'),
|
@@ -81,7 +84,7 @@ const ModelItem = memo<SuggestionItemProps>(({ mobile, meta, identifier }) => {
|
|
81
84
|
|
82
85
|
const header = (
|
83
86
|
<Flexbox gap={12}>
|
84
|
-
<
|
87
|
+
<Link href={urlJoin('/discover/model', identifier)} style={{ color: 'inherit' }}>
|
85
88
|
<Flexbox align={'center'} gap={12} horizontal width={'100%'}>
|
86
89
|
<ModelIcon model={identifier} size={36} type={'avatar'} />
|
87
90
|
<Flexbox style={{ overflow: 'hidden' }}>
|
@@ -93,15 +96,15 @@ const ModelItem = memo<SuggestionItemProps>(({ mobile, meta, identifier }) => {
|
|
93
96
|
</Paragraph>
|
94
97
|
</Flexbox>
|
95
98
|
</Flexbox>
|
96
|
-
</
|
99
|
+
</Link>
|
97
100
|
<ModelFeatureTags functionCall={functionCall} tokens={tokens} vision={vision} />
|
98
101
|
</Flexbox>
|
99
102
|
);
|
100
103
|
|
101
104
|
const button = (
|
102
|
-
<
|
105
|
+
<Link href={urlJoin('/discover/model', identifier)} style={{ color: 'inherit' }}>
|
103
106
|
<ActionIcon color={theme.colorTextDescription} icon={ChevronRightIcon} />
|
104
|
-
</
|
107
|
+
</Link>
|
105
108
|
);
|
106
109
|
|
107
110
|
return (
|
@@ -113,7 +116,7 @@ const ModelItem = memo<SuggestionItemProps>(({ mobile, meta, identifier }) => {
|
|
113
116
|
padding={16}
|
114
117
|
wrap={'wrap'}
|
115
118
|
>
|
116
|
-
{
|
119
|
+
{isMobile && (
|
117
120
|
<Flexbox align={'center'} horizontal justify={'space-between'}>
|
118
121
|
{header}
|
119
122
|
{button}
|
@@ -125,13 +128,13 @@ const ModelItem = memo<SuggestionItemProps>(({ mobile, meta, identifier }) => {
|
|
125
128
|
gap={16}
|
126
129
|
horizontal
|
127
130
|
maxItemWidth={100}
|
128
|
-
rows={
|
131
|
+
rows={isMobile ? 2 : items.length + 1}
|
129
132
|
style={{ minWidth: 240 }}
|
130
133
|
>
|
131
|
-
{!
|
134
|
+
{!isMobile && header}
|
132
135
|
{items.map((item, index) => (
|
133
136
|
<Statistic
|
134
|
-
align={
|
137
|
+
align={isMobile ? 'flex-start' : 'center'}
|
135
138
|
gap={4}
|
136
139
|
key={index}
|
137
140
|
valuePlacement={'bottom'}
|
@@ -140,7 +143,7 @@ const ModelItem = memo<SuggestionItemProps>(({ mobile, meta, identifier }) => {
|
|
140
143
|
/>
|
141
144
|
))}
|
142
145
|
</Grid>
|
143
|
-
{!
|
146
|
+
{!isMobile && button}
|
144
147
|
</Flexbox>
|
145
148
|
);
|
146
149
|
});
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Grid } from '@lobehub/ui';
|
2
|
+
import Link from 'next/link';
|
2
3
|
import { memo } from 'react';
|
3
4
|
import urlJoin from 'url-join';
|
4
5
|
|
5
|
-
import InterceptingLink from '@/components/InterceptingLink';
|
6
6
|
import { DiscoverAssistantItem } from '@/types/discover';
|
7
7
|
|
8
8
|
import Card from '../../assistants/features/Card';
|
@@ -11,20 +11,14 @@ const AssistantList = memo<{ data: DiscoverAssistantItem[] }>(({ data }) => {
|
|
11
11
|
return (
|
12
12
|
<Grid maxItemWidth={280} rows={4}>
|
13
13
|
{data.slice(0, 8).map((item) => (
|
14
|
-
<
|
15
|
-
href={urlJoin('/discover/assistant/', item.identifier)}
|
16
|
-
key={item.identifier}
|
17
|
-
>
|
14
|
+
<Link href={urlJoin('/discover/assistant/', item.identifier)} key={item.identifier}>
|
18
15
|
<Card showCategory {...item} />
|
19
|
-
</
|
16
|
+
</Link>
|
20
17
|
))}
|
21
18
|
{data.slice(8, 16).map((item) => (
|
22
|
-
<
|
23
|
-
href={urlJoin('/discover/assistant/', item.identifier)}
|
24
|
-
key={item.identifier}
|
25
|
-
>
|
19
|
+
<Link href={urlJoin('/discover/assistant/', item.identifier)} key={item.identifier}>
|
26
20
|
<Card showCategory variant={'compact'} {...item} />
|
27
|
-
</
|
21
|
+
</Link>
|
28
22
|
))}
|
29
23
|
</Grid>
|
30
24
|
);
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Grid } from '@lobehub/ui';
|
2
|
+
import Link from 'next/link';
|
2
3
|
import { memo } from 'react';
|
3
4
|
import urlJoin from 'url-join';
|
4
5
|
|
5
|
-
import InterceptingLink from '@/components/InterceptingLink';
|
6
6
|
import { DiscoverModelItem } from '@/types/discover';
|
7
7
|
|
8
8
|
import Card from '../../models/features/Card';
|
@@ -11,9 +11,9 @@ const ModelList = memo<{ data: DiscoverModelItem[] }>(({ data }) => {
|
|
11
11
|
return (
|
12
12
|
<Grid maxItemWidth={280} rows={4}>
|
13
13
|
{data.map((item) => (
|
14
|
-
<
|
14
|
+
<Link href={urlJoin('/discover/model/', item.identifier)} key={item.identifier}>
|
15
15
|
<Card {...item} />
|
16
|
-
</
|
16
|
+
</Link>
|
17
17
|
))}
|
18
18
|
</Grid>
|
19
19
|
);
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Grid } from '@lobehub/ui';
|
2
|
+
import Link from 'next/link';
|
2
3
|
import { memo } from 'react';
|
3
4
|
import urlJoin from 'url-join';
|
4
5
|
|
5
|
-
import InterceptingLink from '@/components/InterceptingLink';
|
6
6
|
import { DiscoverPlugintem } from '@/types/discover';
|
7
7
|
|
8
8
|
import Card from '../../plugins/features/Card';
|
@@ -11,12 +11,9 @@ const PluginList = memo<{ data: DiscoverPlugintem[] }>(({ data }) => {
|
|
11
11
|
return (
|
12
12
|
<Grid maxItemWidth={280} rows={4}>
|
13
13
|
{data.map((item) => (
|
14
|
-
<
|
15
|
-
href={urlJoin('/discover/plugin/', item.identifier)}
|
16
|
-
key={item.identifier}
|
17
|
-
>
|
14
|
+
<Link href={urlJoin('/discover/plugin/', item.identifier)} key={item.identifier}>
|
18
15
|
<Card showCategory variant={'compact'} {...item} />
|
19
|
-
</
|
16
|
+
</Link>
|
20
17
|
))}
|
21
18
|
</Grid>
|
22
19
|
);
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
import { Grid } from '@lobehub/ui';
|
4
4
|
import { Empty } from 'antd';
|
5
|
+
import Link from 'next/link';
|
5
6
|
import { memo, useMemo } from 'react';
|
6
7
|
import { useTranslation } from 'react-i18next';
|
7
8
|
import urlJoin from 'url-join';
|
8
9
|
|
9
|
-
import InterceptingLink from '@/components/InterceptingLink';
|
10
10
|
import { DiscoverAssistantItem } from '@/types/discover';
|
11
11
|
|
12
12
|
import SearchResultCount from '../../../components/SearchResultCount';
|
@@ -42,12 +42,9 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
|
|
42
42
|
data={all}
|
43
43
|
initialItemCount={24}
|
44
44
|
itemContent={(_, item) => (
|
45
|
-
<
|
46
|
-
href={urlJoin('/discover/assistant/', item.identifier)}
|
47
|
-
key={item.identifier}
|
48
|
-
>
|
45
|
+
<Link href={urlJoin('/discover/assistant/', item.identifier)} key={item.identifier}>
|
49
46
|
<Card showCategory variant={'compact'} {...item} />
|
50
|
-
</
|
47
|
+
</Link>
|
51
48
|
)}
|
52
49
|
style={{
|
53
50
|
minHeight: '75vh',
|
@@ -62,12 +59,9 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
|
|
62
59
|
<Title>{t('assistants.recentSubmits')}</Title>
|
63
60
|
<Grid maxItemWidth={280} rows={4}>
|
64
61
|
{recent.map((item) => (
|
65
|
-
<
|
66
|
-
href={urlJoin('/discover/assistant/', item.identifier)}
|
67
|
-
key={item.identifier}
|
68
|
-
>
|
62
|
+
<Link href={urlJoin('/discover/assistant/', item.identifier)} key={item.identifier}>
|
69
63
|
<Card showCategory={!category} {...item} />
|
70
|
-
</
|
64
|
+
</Link>
|
71
65
|
))}
|
72
66
|
</Grid>
|
73
67
|
{last && last?.length > 0 && (
|
@@ -77,12 +71,9 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
|
|
77
71
|
data={last}
|
78
72
|
initialItemCount={12}
|
79
73
|
itemContent={(_, item) => (
|
80
|
-
<
|
81
|
-
href={urlJoin('/discover/assistant/', item.identifier)}
|
82
|
-
key={item.identifier}
|
83
|
-
>
|
74
|
+
<Link href={urlJoin('/discover/assistant/', item.identifier)} key={item.identifier}>
|
84
75
|
<Card showCategory={!category} variant={'compact'} {...item} />
|
85
|
-
</
|
76
|
+
</Link>
|
86
77
|
)}
|
87
78
|
style={{
|
88
79
|
minHeight: '75vh',
|
@@ -1,11 +1,11 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { Empty } from 'antd';
|
4
|
+
import Link from 'next/link';
|
4
5
|
import { memo } from 'react';
|
5
6
|
import { useTranslation } from 'react-i18next';
|
6
7
|
import urlJoin from 'url-join';
|
7
8
|
|
8
|
-
import InterceptingLink from '@/components/InterceptingLink';
|
9
9
|
import { DiscoverModelItem } from '@/types/discover';
|
10
10
|
|
11
11
|
import SearchResultCount from '../../../components/SearchResultCount';
|
@@ -32,12 +32,9 @@ const List = memo<ListProps>(({ category, searchKeywords, items = [] }) => {
|
|
32
32
|
data={items}
|
33
33
|
initialItemCount={24}
|
34
34
|
itemContent={(_, item) => (
|
35
|
-
<
|
36
|
-
href={urlJoin('/discover/model/', item.identifier)}
|
37
|
-
key={item.identifier}
|
38
|
-
>
|
35
|
+
<Link href={urlJoin('/discover/model/', item.identifier)} key={item.identifier}>
|
39
36
|
<Card showCategory {...item} />
|
40
|
-
</
|
37
|
+
</Link>
|
41
38
|
)}
|
42
39
|
style={{
|
43
40
|
minHeight: '75vh',
|
@@ -54,12 +51,9 @@ const List = memo<ListProps>(({ category, searchKeywords, items = [] }) => {
|
|
54
51
|
data={items}
|
55
52
|
initialItemCount={24}
|
56
53
|
itemContent={(_, item) => (
|
57
|
-
<
|
58
|
-
href={urlJoin('/discover/model/', item.identifier)}
|
59
|
-
key={item.identifier}
|
60
|
-
>
|
54
|
+
<Link href={urlJoin('/discover/model/', item.identifier)} key={item.identifier}>
|
61
55
|
<Card showCategory={!category} {...item} />
|
62
|
-
</
|
56
|
+
</Link>
|
63
57
|
)}
|
64
58
|
style={{
|
65
59
|
minHeight: '75vh',
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
import { Grid } from '@lobehub/ui';
|
4
4
|
import { Empty } from 'antd';
|
5
|
+
import Link from 'next/link';
|
5
6
|
import { memo, useMemo } from 'react';
|
6
7
|
import { useTranslation } from 'react-i18next';
|
7
8
|
import urlJoin from 'url-join';
|
8
9
|
|
9
|
-
import InterceptingLink from '@/components/InterceptingLink';
|
10
10
|
import { DiscoverPlugintem } from '@/types/discover';
|
11
11
|
|
12
12
|
import SearchResultCount from '../../../components/SearchResultCount';
|
@@ -41,12 +41,9 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
|
|
41
41
|
data={all}
|
42
42
|
initialItemCount={24}
|
43
43
|
itemContent={(_, item) => (
|
44
|
-
<
|
45
|
-
href={urlJoin('/discover/plugin/', item.identifier)}
|
46
|
-
key={item.identifier}
|
47
|
-
>
|
44
|
+
<Link href={urlJoin('/discover/plugin/', item.identifier)} key={item.identifier}>
|
48
45
|
<Card showCategory variant={'compact'} {...item} />
|
49
|
-
</
|
46
|
+
</Link>
|
50
47
|
)}
|
51
48
|
style={{
|
52
49
|
minHeight: '75vh',
|
@@ -61,12 +58,9 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
|
|
61
58
|
<Title>{t('plugins.recentSubmits')}</Title>
|
62
59
|
<Grid maxItemWidth={280} rows={4}>
|
63
60
|
{recent.map((item) => (
|
64
|
-
<
|
65
|
-
href={urlJoin('/discover/plugin/', item.identifier)}
|
66
|
-
key={item.identifier}
|
67
|
-
>
|
61
|
+
<Link href={urlJoin('/discover/plugin/', item.identifier)} key={item.identifier}>
|
68
62
|
<Card showCategory={!category} {...item} />
|
69
|
-
</
|
63
|
+
</Link>
|
70
64
|
))}
|
71
65
|
</Grid>
|
72
66
|
{last && last?.length > 0 && (
|
@@ -76,12 +70,9 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
|
|
76
70
|
data={last}
|
77
71
|
initialItemCount={12}
|
78
72
|
itemContent={(_, item) => (
|
79
|
-
<
|
80
|
-
href={urlJoin('/discover/plugin/', item.identifier)}
|
81
|
-
key={item.identifier}
|
82
|
-
>
|
73
|
+
<Link href={urlJoin('/discover/plugin/', item.identifier)} key={item.identifier}>
|
83
74
|
<Card showCategory={!category} variant={'compact'} {...item} />
|
84
|
-
</
|
75
|
+
</Link>
|
85
76
|
)}
|
86
77
|
style={{
|
87
78
|
minHeight: '75vh',
|
@@ -1,11 +1,11 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { Empty } from 'antd';
|
4
|
+
import Link from 'next/link';
|
4
5
|
import { memo } from 'react';
|
5
6
|
import { useTranslation } from 'react-i18next';
|
6
7
|
import urlJoin from 'url-join';
|
7
8
|
|
8
|
-
import InterceptingLink from '@/components/InterceptingLink';
|
9
9
|
import { DiscoverProviderItem } from '@/types/discover';
|
10
10
|
|
11
11
|
import SearchResultCount from '../../../components/SearchResultCount';
|
@@ -31,12 +31,9 @@ const List = memo<ListProps>(({ searchKeywords, items = [], mobile }) => {
|
|
31
31
|
data={items}
|
32
32
|
initialItemCount={6}
|
33
33
|
itemContent={(_, item) => (
|
34
|
-
<
|
35
|
-
href={urlJoin('/discover/provider/', item.identifier)}
|
36
|
-
key={item.identifier}
|
37
|
-
>
|
34
|
+
<Link href={urlJoin('/discover/provider/', item.identifier)} key={item.identifier}>
|
38
35
|
<Card {...item} mobile={mobile} style={{ minHeight: 'unset' }} />
|
39
|
-
</
|
36
|
+
</Link>
|
40
37
|
)}
|
41
38
|
style={{
|
42
39
|
minHeight: '75vh',
|
@@ -53,12 +50,9 @@ const List = memo<ListProps>(({ searchKeywords, items = [], mobile }) => {
|
|
53
50
|
data={items}
|
54
51
|
initialItemCount={6}
|
55
52
|
itemContent={(_, item) => (
|
56
|
-
<
|
57
|
-
href={urlJoin('/discover/provider/', item.identifier)}
|
58
|
-
key={item.identifier}
|
59
|
-
>
|
53
|
+
<Link href={urlJoin('/discover/provider/', item.identifier)} key={item.identifier}>
|
60
54
|
<Card {...item} mobile={mobile} style={{ minHeight: 'unset' }} />
|
61
|
-
</
|
55
|
+
</Link>
|
62
56
|
)}
|
63
57
|
style={{
|
64
58
|
minHeight: '75vh',
|
@@ -1,11 +1,14 @@
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
2
2
|
import { Flexbox } from 'react-layout-kit';
|
3
3
|
|
4
|
+
import NProgress from '@/components/NProgress';
|
5
|
+
|
4
6
|
import Header from './Header';
|
5
7
|
|
6
8
|
const Layout = ({ children }: PropsWithChildren) => {
|
7
9
|
return (
|
8
10
|
<>
|
11
|
+
<NProgress />
|
9
12
|
<Flexbox height={'100%'} style={{ overflow: 'hidden', position: 'relative' }} width={'100%'}>
|
10
13
|
<Header />
|
11
14
|
{children}
|
@@ -1,7 +1,14 @@
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
2
2
|
|
3
|
+
import NProgress from '@/components/NProgress';
|
4
|
+
|
3
5
|
const Layout = ({ children }: PropsWithChildren) => {
|
4
|
-
return
|
6
|
+
return (
|
7
|
+
<>
|
8
|
+
<NProgress />
|
9
|
+
{children}
|
10
|
+
</>
|
11
|
+
);
|
5
12
|
};
|
6
13
|
|
7
14
|
Layout.displayName = 'MobileDiscoverStoreLayout';
|
package/src/app/layout.tsx
CHANGED
@@ -24,6 +24,7 @@ const RootLayout = async ({ children, modal }: RootLayoutProps) => {
|
|
24
24
|
|
25
25
|
const lang = cookieStore.get(LOBE_LOCALE_COOKIE);
|
26
26
|
const direction = isRtlLang(lang?.value || DEFAULT_LANG) ? 'rtl' : 'ltr';
|
27
|
+
const mobile = isMobileDevice();
|
27
28
|
|
28
29
|
return (
|
29
30
|
<html dir={direction} lang={lang?.value || DEFAULT_LANG} suppressHydrationWarning>
|
@@ -31,7 +32,7 @@ const RootLayout = async ({ children, modal }: RootLayoutProps) => {
|
|
31
32
|
<GlobalProvider>
|
32
33
|
<AuthProvider>
|
33
34
|
{children}
|
34
|
-
{modal}
|
35
|
+
{!mobile && modal}
|
35
36
|
</AuthProvider>
|
36
37
|
<PWAInstall />
|
37
38
|
</GlobalProvider>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { useTheme } from 'antd-style';
|
4
|
+
import NextTopLoader from 'nextjs-toploader';
|
5
|
+
import { memo } from 'react';
|
6
|
+
|
7
|
+
const NProgress = memo(() => {
|
8
|
+
const theme = useTheme();
|
9
|
+
return <NextTopLoader color={theme.colorText} height={2} shadow={false} showSpinner={false} />;
|
10
|
+
});
|
11
|
+
|
12
|
+
export default NProgress;
|
@@ -4,13 +4,13 @@ import { ActionIcon, Avatar, Grid } from '@lobehub/ui';
|
|
4
4
|
import { Skeleton, Typography } from 'antd';
|
5
5
|
import { createStyles } from 'antd-style';
|
6
6
|
import { RefreshCw } from 'lucide-react';
|
7
|
+
import Link from 'next/link';
|
7
8
|
import { memo, useState } from 'react';
|
8
9
|
import { useTranslation } from 'react-i18next';
|
9
10
|
import { Flexbox } from 'react-layout-kit';
|
10
11
|
import useSWR from 'swr';
|
11
12
|
import urlJoin from 'url-join';
|
12
13
|
|
13
|
-
import InterceptingLink from '@/components/InterceptingLink';
|
14
14
|
import { assistantService } from '@/services/assistant';
|
15
15
|
import { useUserStore } from '@/store/user';
|
16
16
|
import { userGeneralSettingsSelectors } from '@/store/user/selectors';
|
@@ -105,10 +105,7 @@ const AgentsSuggest = memo<{ mobile?: boolean }>(({ mobile }) => {
|
|
105
105
|
: assistantList
|
106
106
|
.slice(sliceStart, sliceStart + agentLength)
|
107
107
|
.map((item: DiscoverAssistantItem) => (
|
108
|
-
<
|
109
|
-
href={urlJoin('/discover/assistant/', item.identifier)}
|
110
|
-
key={item.identifier}
|
111
|
-
>
|
108
|
+
<Link href={urlJoin('/discover/assistant/', item.identifier)} key={item.identifier}>
|
112
109
|
<Flexbox className={styles.card} gap={8} horizontal>
|
113
110
|
<Avatar avatar={item.meta.avatar} style={{ flex: 'none' }} />
|
114
111
|
<Flexbox gap={mobile ? 2 : 8} style={{ overflow: 'hidden', width: '100%' }}>
|
@@ -120,7 +117,7 @@ const AgentsSuggest = memo<{ mobile?: boolean }>(({ mobile }) => {
|
|
120
117
|
</Paragraph>
|
121
118
|
</Flexbox>
|
122
119
|
</Flexbox>
|
123
|
-
</
|
120
|
+
</Link>
|
124
121
|
))}
|
125
122
|
</Grid>
|
126
123
|
</Flexbox>
|
@@ -47,20 +47,5 @@ export const useOpenChatSettings = (tab: ChatSettingsTabs = ChatSettingsTabs.Met
|
|
47
47
|
};
|
48
48
|
|
49
49
|
export const useInterceptingRoutes = () => {
|
50
|
-
|
51
|
-
const mobile = useIsMobile();
|
52
|
-
const isIntercepted = useContext(InterceptContext);
|
53
|
-
return useMemo(
|
54
|
-
() => ({
|
55
|
-
isIntercepted,
|
56
|
-
push: (url: string, disableIntercepting?: boolean) => {
|
57
|
-
if (disableIntercepting || mobile) {
|
58
|
-
router.push(`/redirect`, { query: { url } });
|
59
|
-
return;
|
60
|
-
}
|
61
|
-
router.push(url);
|
62
|
-
},
|
63
|
-
}),
|
64
|
-
[mobile, router, isIntercepted],
|
65
|
-
);
|
50
|
+
return useContext(InterceptContext);
|
66
51
|
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from '@/app/(main)/discover/(detail)/assistant/[slug]/page';
|
@@ -1,29 +0,0 @@
|
|
1
|
-
'use client';
|
2
|
-
|
3
|
-
import { useResponsive } from 'antd-style';
|
4
|
-
import { PropsWithChildren, memo } from 'react';
|
5
|
-
import { Flexbox } from 'react-layout-kit';
|
6
|
-
|
7
|
-
const Layout = memo<PropsWithChildren>(({ children }) => {
|
8
|
-
const { xl = true } = useResponsive();
|
9
|
-
|
10
|
-
return (
|
11
|
-
<Flexbox
|
12
|
-
flex={1}
|
13
|
-
gap={16}
|
14
|
-
horizontal={xl}
|
15
|
-
paddingInline={48}
|
16
|
-
style={{
|
17
|
-
overflow: xl ? 'hidden' : 'auto',
|
18
|
-
paddingBottom: xl ? 0 : 24,
|
19
|
-
paddingTop: 48,
|
20
|
-
position: 'relative',
|
21
|
-
}}
|
22
|
-
width={'100%'}
|
23
|
-
>
|
24
|
-
{children}
|
25
|
-
</Flexbox>
|
26
|
-
);
|
27
|
-
});
|
28
|
-
|
29
|
-
export default Layout;
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from '@/app/(main)/discover/(detail)/model/[...slugs]/page';
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from '@/app/(main)/discover/(detail)/plugin/[slug]/page';
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from '@/app/(main)/discover/(detail)/provider/[slug]/page';
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import type { Metadata } from 'next';
|
2
|
-
import { redirect } from 'next/navigation';
|
3
|
-
|
4
|
-
export default function Page({ searchParams }: { searchParams: { url: string } }) {
|
5
|
-
redirect(searchParams.url);
|
6
|
-
}
|
7
|
-
|
8
|
-
export function generateMetadata(): Metadata {
|
9
|
-
return {
|
10
|
-
robots: {
|
11
|
-
follow: false,
|
12
|
-
index: false,
|
13
|
-
},
|
14
|
-
};
|
15
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import Link, { LinkProps } from 'next/link';
|
2
|
-
import { CSSProperties, ReactNode, memo } from 'react';
|
3
|
-
|
4
|
-
import { useInterceptingRoutes } from '@/hooks/useInterceptingRoutes';
|
5
|
-
|
6
|
-
interface InterceptingLinkProps extends LinkProps {
|
7
|
-
children: ReactNode;
|
8
|
-
className?: string;
|
9
|
-
disableIntercepting?: boolean;
|
10
|
-
style?: CSSProperties;
|
11
|
-
}
|
12
|
-
|
13
|
-
const InterceptingLink = memo<InterceptingLinkProps>(({ href, disableIntercepting, ...rest }) => {
|
14
|
-
const router = useInterceptingRoutes();
|
15
|
-
return (
|
16
|
-
<Link
|
17
|
-
href={href}
|
18
|
-
onClick={(e) => {
|
19
|
-
e.preventDefault();
|
20
|
-
router.push(href as any, disableIntercepting);
|
21
|
-
}}
|
22
|
-
{...rest}
|
23
|
-
/>
|
24
|
-
);
|
25
|
-
});
|
26
|
-
|
27
|
-
export default InterceptingLink;
|