From 0f8e9dcbdfc7e304ffda8f11fe15cfdc467d8951 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Tue, 28 Jul 2026 11:37:41 -0700 Subject: [PATCH] Add launch history tracking --- src/app/main/layout.tsx | 17 ++++++++++++++++- src/providers/GlobalProvider.tsx | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/app/main/layout.tsx b/src/app/main/layout.tsx index 66c43d7..3854473 100644 --- a/src/app/main/layout.tsx +++ b/src/app/main/layout.tsx @@ -100,6 +100,9 @@ export default function RootLayout ({ const [modsList, setModsList] = useState< Record> >({}) + const [launchesList, setLaunchesList] = useState< + Record> + >({}) const [accountSession, setAccountSession] = useState(null) const [accountId, setAccountId] = useState(null) @@ -458,6 +461,13 @@ export default function RootLayout ({ useWine: !!(platform() == 'linux' && versionInfo.wine && linuxUseWine), wineCommand: linuxWineCommand }) + await versions?.set('launches', { + ...launchesList, + [versionInfo.game]: { + ...launchesList[versionInfo.game], + [versionInfo.id]: Date.now() + } + }) } useEffect(() => { @@ -632,7 +642,8 @@ export default function RootLayout ({ defaults: { version: client, list: {}, - mods: {} + mods: {}, + launches: {} } }) const accountLocal = await load('account.json', { @@ -830,6 +841,9 @@ export default function RootLayout ({ watchVersions>>('mods', v => setModsList(v ?? {}) ) + watchVersions>>('launches', v => + setLaunchesList(v ?? {}) + ) watchAccount('session', v => setAccountSession(v ?? null)) watchAccount('id', v => setAccountId(v ?? null)) @@ -887,6 +901,7 @@ export default function RootLayout ({ developerMode, versionsList, modsList, + launchesList, accountSession, accountId, accountName, diff --git a/src/providers/GlobalProvider.tsx b/src/providers/GlobalProvider.tsx index 9bdf3f4..4b21436 100644 --- a/src/providers/GlobalProvider.tsx +++ b/src/providers/GlobalProvider.tsx @@ -62,6 +62,7 @@ type GlobalCtxType = { developerMode: boolean versionsList: Record modsList: Record> + launchesList: Record> accountSession: string | null accountId: string | null accountName: string | null