mirror of
				https://github.com/hydralauncher/hydra.git
				synced 2025-03-09 15:40:26 +00:00 
			
		
		
		
	fix: adding sorting to download list
This commit is contained in:
		
							parent
							
								
									73b4b2c13c
								
							
						
					
					
						commit
						588cb983c2
					
				
					 2 changed files with 20 additions and 9 deletions
				
			
		|  | @ -11,7 +11,7 @@ import { LibraryGame } from "@types"; | |||
| import { orderBy } from "lodash-es"; | ||||
| 
 | ||||
| export function Downloads() { | ||||
|   const { library, updateLibrary } = useLibrary(); | ||||
|   const { library } = useLibrary(); | ||||
| 
 | ||||
|   const { t } = useTranslation("downloads"); | ||||
| 
 | ||||
|  | @ -41,18 +41,27 @@ export function Downloads() { | |||
|         return { ...prev, downloading: [...prev.downloading, next] }; | ||||
|       } | ||||
| 
 | ||||
|       if (next.downloadQueue) { | ||||
|       if (next.downloadQueue || next.status === "paused") { | ||||
|         return { ...prev, queued: [...prev.queued, next] }; | ||||
|       } | ||||
| 
 | ||||
|       return { ...prev, complete: [...prev.complete, next] }; | ||||
|     }, initialValue); | ||||
| 
 | ||||
|     const queued = orderBy( | ||||
|       result.queued, | ||||
|       (game) => game.downloadQueue?.id ?? -1, | ||||
|       ["desc"] | ||||
|     ); | ||||
| 
 | ||||
|     const complete = orderBy(result.complete, (game) => | ||||
|       game.status === "complete" ? 0 : 1 | ||||
|     ); | ||||
| 
 | ||||
|     return { | ||||
|       ...result, | ||||
|       queued: orderBy(result.queued, (game) => game.downloadQueue?.id, [ | ||||
|         "desc", | ||||
|       ]), | ||||
|       queued, | ||||
|       complete, | ||||
|     }; | ||||
|   }, [library, lastPacket?.game.id]); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue