Skip to content

Commit 5b59c7a

Browse files
authored
Merge pull request #6560 from menloresearch/fix/layout-downlod-management
fix: download management ui and double refresh model
2 parents 4d43841 + 3a5580c commit 5b59c7a

File tree

4 files changed

+282
-192
lines changed

4 files changed

+282
-192
lines changed

web-app/src/containers/DownloadManegement.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -400,20 +400,23 @@ export function DownloadManagement() {
400400
className="text-main-view-fg/70 cursor-pointer"
401401
title="Cancel download"
402402
onClick={() => {
403-
serviceHub.models().abortDownload(download.name).then(() => {
404-
toast.info(
405-
t('common:toast.downloadCancelled.title'),
406-
{
407-
id: 'cancel-download',
408-
description: t(
409-
'common:toast.downloadCancelled.description'
410-
),
403+
serviceHub
404+
.models()
405+
.abortDownload(download.name)
406+
.then(() => {
407+
toast.info(
408+
t('common:toast.downloadCancelled.title'),
409+
{
410+
id: 'cancel-download',
411+
description: t(
412+
'common:toast.downloadCancelled.description'
413+
),
414+
}
415+
)
416+
if (downloadProcesses.length === 0) {
417+
setIsPopoverOpen(false)
411418
}
412-
)
413-
if (downloadProcesses.length === 0) {
414-
setIsPopoverOpen(false)
415-
}
416-
})
419+
})
417420
}}
418421
/>
419422
</div>

web-app/src/containers/LeftPanel.tsx

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { toast } from 'sonner'
3535
import { DownloadManagement } from '@/containers/DownloadManegement'
3636
import { useSmallScreen } from '@/hooks/useMediaQuery'
3737
import { useClickOutside } from '@/hooks/useClickOutside'
38-
import { useDownloadStore } from '@/hooks/useDownloadStore'
38+
3939
import { DeleteAllThreadsDialog } from '@/containers/dialogs'
4040

4141
const mainMenus = [
@@ -122,7 +122,7 @@ const LeftPanel = () => {
122122
) {
123123
if (currentIsSmallScreen && open) {
124124
setLeftPanel(false)
125-
} else if(!open) {
125+
} else if (!open) {
126126
setLeftPanel(true)
127127
}
128128
prevScreenSizeRef.current = currentIsSmallScreen
@@ -179,8 +179,6 @@ const LeftPanel = () => {
179179
}
180180
}, [isSmallScreen, open])
181181

182-
const { downloads, localDownloadingModels } = useDownloadStore()
183-
184182
return (
185183
<>
186184
{/* Backdrop overlay for small screens */}
@@ -262,15 +260,8 @@ const LeftPanel = () => {
262260
)}
263261
</div>
264262

265-
<div className="flex flex-col justify-between overflow-hidden mt-0 !h-[calc(100%-42px)]">
266-
<div
267-
className={cn(
268-
'flex flex-col',
269-
Object.keys(downloads).length > 0 || localDownloadingModels.size > 0
270-
? 'h-[calc(100%-200px)]'
271-
: 'h-[calc(100%-140px)]'
272-
)}
273-
>
263+
<div className="flex flex-col justify-between overflow-hidden mt-0 !h-[calc(100%-42px)] ">
264+
<div className={cn('flex flex-col !h-[calc(100%-200px)]')}>
274265
{IS_MACOS && (
275266
<div
276267
ref={searchContainerMacRef}
@@ -379,7 +370,9 @@ const LeftPanel = () => {
379370
</button>
380371
</DropdownMenuTrigger>
381372
<DropdownMenuContent side="bottom" align="end">
382-
<DeleteAllThreadsDialog onDeleteAll={deleteAllThreads} />
373+
<DeleteAllThreadsDialog
374+
onDeleteAll={deleteAllThreads}
375+
/>
383376
</DropdownMenuContent>
384377
</DropdownMenu>
385378
</div>
@@ -469,8 +462,9 @@ const LeftPanel = () => {
469462
</Link>
470463
)
471464
})}
472-
<DownloadManagement />
473465
</div>
466+
467+
<DownloadManagement />
474468
</div>
475469
</aside>
476470
</>

0 commit comments

Comments
 (0)