Skip to content

Commit d3fff15

Browse files
committed
fix: download management ui and double refresh model
1 parent 3f51c35 commit d3fff15

File tree

3 files changed

+203
-146
lines changed

3 files changed

+203
-146
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>
@@ -468,8 +461,9 @@ const LeftPanel = () => {
468461
</Link>
469462
)
470463
})}
471-
<DownloadManagement />
472464
</div>
465+
466+
<DownloadManagement />
473467
</div>
474468
</aside>
475469
</>

0 commit comments

Comments
 (0)