From a0a763ae571d6d3f783d4a1a8de8d6e839fda0f7 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Wed, 7 Jan 2026 18:29:17 -0700 Subject: [PATCH] Remove the manage button and make it a right-click instead. And also change the button height/width. Along with more re-arranging in `layout.tsx` --- src/app/Globals.css | 2 +- src/app/game/page.tsx | 12 +++- src/app/layout.tsx | 117 ++++++++++++++++++++------------------ src/app/settings/page.tsx | 4 +- 4 files changed, 75 insertions(+), 60 deletions(-) diff --git a/src/app/Globals.css b/src/app/Globals.css index a764bb3..78d49b2 100644 --- a/src/app/Globals.css +++ b/src/app/Globals.css @@ -77,7 +77,7 @@ body { } .button { - @apply rounded-md cursor-pointer text-[16px] py-1.5 px-3 transition-colors border; + @apply rounded-md cursor-pointer text-[16px] py-1 px-2 transition-colors border; } .btntheme1 { diff --git a/src/app/game/page.tsx b/src/app/game/page.tsx index 9d25db0..a6af5e1 100644 --- a/src/app/game/page.tsx +++ b/src/app/game/page.tsx @@ -85,7 +85,7 @@ export default function Installs () { title={ normalConfig?.settings.useLegacyInteractButtons ? '' - : 'Click to launch game' + : 'Click to launch game. Right-click to manage this version install' } onClick={async () => { if (normalConfig?.settings.useLegacyInteractButtons) return @@ -99,6 +99,13 @@ export default function Installs () { displayName: `${gameInfo.name} v${verInfo.versionName}` }) }} + onContextMenu={e => { + e.preventDefault() + setManagingVersion(entry) + setPopupMode(2) + setShowPopup(true) + setFadeOut(false) + }} onMouseEnter={() => setHoveredIds(prev => [...prev, entry])} onMouseLeave={() => setHoveredIds(prev => prev.filter(i => i !== i)) @@ -145,6 +152,9 @@ export default function Installs () { className={`button ${ hoveredIds.includes(entry) ? 'btntheme3' : 'btntheme2' }`} + hidden={ + !normalConfig?.settings.useLegacyInteractButtons + } onClick={e => { e.stopPropagation() setManagingVersion(entry) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 4f58cbf..ffb0726 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -45,7 +45,7 @@ import { requestPermission } from '@tauri-apps/plugin-notification' import VersionChangelog from './componets/VersionChangelog' -import { BaseDirectory, remove } from '@tauri-apps/plugin-fs' +import { BaseDirectory, exists, remove } from '@tauri-apps/plugin-fs' const roboto = Roboto({ subsets: ['latin'] @@ -127,6 +127,52 @@ export default function RootLayout ({ return Array.from(gamesMap.values()) } + function getVersionsAmountData (gameId: number): { + installed: number + total: number + } | null { + if (!downloadedVersionsConfig || !serverVersionList) return null + + const installed = downloadedVersionsConfig.list.filter( + v => getGameInfo(getVersionInfo(v)?.game)?.id === gameId + ).length + + const total = serverVersionList.versions.filter( + v => getGameInfo(v?.game)?.id === gameId + ).length + + return { installed, total } + } + + function formatEtaSmart (seconds: number) { + if (seconds < 60) return `${Math.floor(seconds)}s` + if (seconds < 3600) + return `${Math.floor(seconds / 60)}m ${Math.floor(seconds % 60)}s` + if (seconds < 86400) { + const h = Math.floor(seconds / 3600) + const m = Math.floor((seconds % 3600) / 60) + return `${h}h ${m}m` + } + const d = Math.floor(seconds / 86400) + const h = Math.floor((seconds % 86400) / 3600) + return `${d}d ${h}h` + } + + function closePopup () { + if (popupMode == 0 && selectedGame && pathname === '/') { + setSelectedGame(null) + setSelectedVersionList([]) + } else if (viewingInfoFromDownloads) { + setViewingInfoFromDownloads(false) + setPopupMode(0) + } else if (popupMode == 4) { + setPopupMode(3) + } else { + setFadeOut(true) + setTimeout(() => setShowPopup(false), 200) + } + } + useEffect(() => { let unlistenProgress: (() => void) | null = null @@ -301,52 +347,6 @@ export default function RootLayout ({ await notifyUser('Downloads Finished', 'All downloads have finished.') } - function getVersionsAmountData (gameId: number): { - installed: number - total: number - } | null { - if (!downloadedVersionsConfig || !serverVersionList) return null - - const installed = downloadedVersionsConfig.list.filter( - v => getGameInfo(getVersionInfo(v)?.game)?.id === gameId - ).length - - const total = serverVersionList.versions.filter( - v => getGameInfo(v?.game)?.id === gameId - ).length - - return { installed, total } - } - - function formatEtaSmart (seconds: number) { - if (seconds < 60) return `${Math.floor(seconds)}s` - if (seconds < 3600) - return `${Math.floor(seconds / 60)}m ${Math.floor(seconds % 60)}s` - if (seconds < 86400) { - const h = Math.floor(seconds / 3600) - const m = Math.floor((seconds % 3600) / 60) - return `${h}h ${m}m` - } - const d = Math.floor(seconds / 86400) - const h = Math.floor((seconds % 86400) / 3600) - return `${d}d ${h}h` - } - - function closePopup () { - if (popupMode == 0 && selectedGame && pathname === '/') { - setSelectedGame(null) - setSelectedVersionList([]) - } else if (viewingInfoFromDownloads) { - setViewingInfoFromDownloads(false) - setPopupMode(0) - } else if (popupMode == 4) { - setPopupMode(3) - } else { - setFadeOut(true) - setTimeout(() => setShowPopup(false), 200) - } - } - return ( <> @@ -477,8 +477,8 @@ export default function RootLayout ({

{getGameInfo(v.game)?.name} v @@ -486,7 +486,7 @@ export default function RootLayout ({