Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
62489ef1
authored
Jun 27, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: share chat
parent
3d2043c1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
21 deletions
+30
-21
client/src/components/Layout/index.tsx
+19
-16
client/src/components/Layout/navbarPhone.tsx
+8
-1
client/src/pages/chat/share.tsx
+3
-4
No files found.
client/src/components/Layout/index.tsx
View file @
62489ef1
...
...
@@ -51,7 +51,7 @@ const Layout = ({ children }: { children: JSX.Element }) => {
return
()
=>
{
window
.
removeEventListener
(
'resize'
,
resize
);
};
},
[
setScreenWidth
]);
},
[]);
const
{
data
:
unread
=
0
}
=
useQuery
([
'getUnreadCount'
],
getUnreadCount
,
{
enabled
:
!!
userInfo
,
...
...
@@ -64,8 +64,8 @@ const Layout = ({ children }: { children: JSX.Element }) => {
h=
{
'100%'
}
bgGradient=
{
'linear(to-t,rgba(173, 206, 255, 0.05) 0%, rgba(173, 206, 255, 0.12) 100%)'
}
>
{
isPc
?
(
pcUnShowLayoutRoute
[
router
.
pathname
]
?
(
<
Box
h=
{
'100%'
}
display=
{
[
'none'
,
'block'
]
}
>
{
pcUnShowLayoutRoute
[
router
.
pathname
]
?
(
<
Auth
>
{
children
}
</
Auth
>
)
:
(
<>
...
...
@@ -76,19 +76,22 @@ const Layout = ({ children }: { children: JSX.Element }) => {
<
Auth
>
{
children
}
</
Auth
>
</
Box
>
</>
)
)
:
phoneUnShowLayoutRoute
[
router
.
pathname
]
||
isChatPage
?
(
<
Auth
>
{
children
}
</
Auth
>
)
:
(
<
Flex
h=
{
'100%'
}
flexDirection=
{
'column'
}
>
<
Box
flex=
{
'1 0 0'
}
h=
{
0
}
overflow=
{
'overlay'
}
>
<
Auth
>
{
children
}
</
Auth
>
</
Box
>
<
Box
h=
{
'50px'
}
borderTop=
{
'1px solid rgba(0,0,0,0.1)'
}
>
<
NavbarPhone
unread=
{
unread
}
/>
</
Box
>
</
Flex
>
)
}
)
}
</
Box
>
<
Box
h=
{
'100%'
}
display=
{
[
'block'
,
'none'
]
}
>
{
phoneUnShowLayoutRoute
[
router
.
pathname
]
||
isChatPage
?
(
<
Auth
>
{
children
}
</
Auth
>
)
:
(
<
Flex
h=
{
'100%'
}
flexDirection=
{
'column'
}
>
<
Box
flex=
{
'1 0 0'
}
h=
{
0
}
overflow=
{
'overlay'
}
>
<
Auth
>
{
children
}
</
Auth
>
</
Box
>
<
Box
h=
{
'50px'
}
borderTop=
{
'1px solid rgba(0,0,0,0.1)'
}
>
<
NavbarPhone
unread=
{
unread
}
/>
</
Box
>
</
Flex
>
)
}
</
Box
>
</
Box
>
<
Loading
loading=
{
loading
}
/>
</>
...
...
client/src/components/Layout/navbarPhone.tsx
View file @
62489ef1
import
React
,
{
useMemo
}
from
'react'
;
import
{
useRouter
}
from
'next/router'
;
import
MyIcon
from
'../Icon'
;
import
{
Flex
}
from
'@chakra-ui/react'
;
import
{
Flex
,
Box
}
from
'@chakra-ui/react'
;
import
{
useChatStore
}
from
'@/store/chat'
;
import
Badge
from
'../Badge'
;
...
...
@@ -11,24 +11,28 @@ const NavbarPhone = ({ unread }: { unread: number }) => {
const
navbarList
=
useMemo
(
()
=>
[
{
label
:
'聊天'
,
icon
:
'tabbarChat'
,
link
:
`/chat?modelId=
${
lastChatModelId
}
&chatId=
${
lastChatId
}
`
,
activeLink
:
[
'/chat'
],
unread
:
0
},
{
label
:
'应用'
,
icon
:
'tabbarModel'
,
link
:
`/model`
,
activeLink
:
[
'/model'
],
unread
:
0
},
{
label
:
'工具'
,
icon
:
'tabbarMore'
,
link
:
'/tools'
,
activeLink
:
[
'/tools'
],
unread
:
0
},
{
label
:
'我的'
,
icon
:
'tabbarMe'
,
link
:
'/number'
,
activeLink
:
[
'/number'
],
...
...
@@ -57,7 +61,9 @@ const NavbarPhone = ({ unread }: { unread: number }) => {
textAlign=
{
'center'
}
alignItems=
{
'center'
}
h=
{
'100%'
}
pt=
{
1
}
px=
{
3
}
transform=
{
'scale(0.9)'
}
{
...
(
item
.
activeLink
.
includes
(
router
.
asPath
)
?
{
color
:
'#7089
f1
'
...
...
@@ -89,6 +95,7 @@ const NavbarPhone = ({ unread }: { unread: number }) => {
>
<
Badge
isDot
count=
{
item
.
unread
}
>
<
MyIcon
name=
{
item
.
icon
as
any
}
width=
{
'20px'
}
height=
{
'20px'
}
/>
<
Box
fontSize=
{
'12px'
}
>
{
item
.
label
}
</
Box
>
</
Badge
>
</
Flex
>
))
}
...
...
client/src/pages/chat/share.tsx
View file @
62489ef1
...
...
@@ -62,7 +62,7 @@ const textareaMinH = '22px';
const
Chat
=
()
=>
{
const
router
=
useRouter
();
const
{
shareId
=
''
,
historyId
=
''
}
=
router
.
query
as
{
shareId
:
string
;
historyId
:
string
};
const
{
shareId
=
''
,
historyId
}
=
router
.
query
as
{
shareId
:
string
;
historyId
:
string
};
const
theme
=
useTheme
();
const
ChatBox
=
useRef
<
HTMLDivElement
>
(
null
);
...
...
@@ -491,14 +491,13 @@ const Chat = () => {
]);
// 初始化聊天框
useQuery(['init', historyId], () => {
useQuery(['init',
shareId,
historyId], () => {
if (!shareId) {
return null;
}
if (!historyId) {
router.replace(`/chat/share?shareId=${shareId}&historyId=${new Types.ObjectId()}`);
return null;
return router.replace(`/chat/share?shareId=${shareId}&historyId=${new Types.ObjectId()}`);
}
return loadChatInfo();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment