Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
89121861
Unverified
Commit
89121861
authored
Jan 04, 2024
by
Joel
Committed by
GitHub
Jan 04, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: window size changed causes result regeneration (#1908)
parent
a938e1f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
17 deletions
+25
-17
index.tsx
web/app/components/share/text-generation/index.tsx
+25
-17
No files found.
web/app/components/share/text-generation/index.tsx
View file @
89121861
...
@@ -374,7 +374,13 @@ const TextGeneration: FC<IMainProps> = ({
...
@@ -374,7 +374,13 @@ const TextGeneration: FC<IMainProps> = ({
}
}
},
[
siteInfo
?.
title
,
canReplaceLogo
])
},
[
siteInfo
?.
title
,
canReplaceLogo
])
const
[
isShowResSidebar
,
{
setTrue
:
showResSidebar
,
setFalse
:
hideResSidebar
}]
=
useBoolean
(
false
)
const
[
isShowResSidebar
,
{
setTrue
:
doShowResSidebar
,
setFalse
:
hideResSidebar
}]
=
useBoolean
(
false
)
const
showResSidebar
=
()
=>
{
// fix: useClickAway hideResSidebar will close sidebar
setTimeout
(()
=>
{
doShowResSidebar
()
},
0
)
}
const
resRef
=
useRef
<
HTMLDivElement
>
(
null
)
const
resRef
=
useRef
<
HTMLDivElement
>
(
null
)
useClickAway
(()
=>
{
useClickAway
(()
=>
{
hideResSidebar
()
hideResSidebar
()
...
@@ -406,6 +412,16 @@ const TextGeneration: FC<IMainProps> = ({
...
@@ -406,6 +412,16 @@ const TextGeneration: FC<IMainProps> = ({
return
(
showTaskList
.
map
(
task
=>
renderRes
(
task
)))
return
(
showTaskList
.
map
(
task
=>
renderRes
(
task
)))
}
}
const
resWrapClassNames
=
(()
=>
{
if
(
isPC
)
return
'grow h-full'
if
(
!
isShowResSidebar
)
return
'none'
return
cn
(
'fixed z-50 inset-0'
,
isTablet
?
'pl-[128px]'
:
'pl-6'
)
})()
const
renderResWrap
=
(
const
renderResWrap
=
(
<
div
<
div
ref=
{
resRef
}
ref=
{
resRef
}
...
@@ -578,22 +594,14 @@ const TextGeneration: FC<IMainProps> = ({
...
@@ -578,22 +594,14 @@ const TextGeneration: FC<IMainProps> = ({
</
div
>
</
div
>
{
/* Result */
}
{
/* Result */
}
{
isPC
&&
(
<
div
<
div
className=
'grow h-full'
>
className=
{
resWrapClassNames
}
{
renderResWrap
}
style=
{
{
</
div
>
background
:
(
!
isPC
&&
isShowResSidebar
)
?
'rgba(35, 56, 118, 0.2)'
:
'none'
,
)
}
}
}
>
{
(
!
isPC
&&
isShowResSidebar
)
&&
(
{
renderResWrap
}
<
div
</
div
>
className=
{
cn
(
'fixed z-50 inset-0'
,
isTablet
?
'pl-[128px]'
:
'pl-6'
)
}
style=
{
{
background
:
'rgba(35, 56, 118, 0.2)'
,
}
}
>
{
renderResWrap
}
</
div
>
)
}
</
div
>
</
div
>
</>
</>
)
)
...
...
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