feat: remember current tab

This commit is contained in:
2025-04-27 05:56:04 +00:00
parent bf4c06ee2d
commit 6cc7a537b6
10 changed files with 86 additions and 41 deletions

View File

@ -20,7 +20,6 @@ import OptionList from './OptionList.vue';
import PatchList from './PatchList.vue';
import ProfileList from './ProfileList.vue';
import StartButton from './StartButton.vue';
import { invoke } from '../invoke';
import {
useClientStore,
useGeneralStore,
@ -36,10 +35,10 @@ const prf = usePrfStore();
const general = useGeneralStore();
const client = useClientStore();
client.load();
pkg.setupListeners();
const currentTab: Ref<'users' | 'loc' | 'patches' | 'rmt' | 'cfg' | 'info'> =
ref('users');
const pkgSearchTerm = ref('');
const isProfileDisabled = computed(() => prf.current === null);
@ -60,7 +59,6 @@ onMounted(async () => {
await Promise.all([prf.reloadList(), prf.reload()]);
if (prf.current !== null) {
currentTab.value = 'loc';
await pkg.reloadAll();
}
@ -205,10 +203,11 @@ listen<DownloadingStatus>('download-progress', (event) => {
<Tabs
lazy
:value="currentTab"
:value="client.currentTab"
v-on:update:value="
(value) => {
currentTab = value as any;
client.currentTab = value as string;
client.save();
}
"
class="h-screen"
@ -216,6 +215,13 @@ listen<DownloadingStatus>('download-progress', (event) => {
<div class="fixed w-full flex z-100">
<TabList class="grow" :show-navigators="false">
<Tab value="users"><div class="pi pi-home"></div></Tab>
<Tab
:disabled="
isProfileDisabled || pkg.networkStatus !== 'online'
"
value="rmt"
><div class="pi pi-download"></div
></Tab>
<Tab :disabled="isProfileDisabled" value="loc"
><div class="pi pi-box"></div
></Tab>
@ -224,13 +230,7 @@ listen<DownloadingStatus>('download-progress', (event) => {
value="patches"
><div class="pi pi-ticket"></div
></Tab>
<Tab
:disabled="
isProfileDisabled || pkg.networkStatus !== 'online'
"
value="rmt"
><div class="pi pi-download"></div
></Tab>
<Tab :disabled="isProfileDisabled" value="cfg"
><div class="pi pi-cog"></div
></Tab>
@ -243,13 +243,17 @@ listen<DownloadingStatus>('download-progress', (event) => {
<div class="flex gap-4">
<div
class="flex"
v-if="['loc', 'rmt', 'cfg'].includes(currentTab)"
v-if="
['loc', 'rmt', 'cfg'].includes(
client.currentTab
)
"
>
<InputIcon class="self-center mr-2">
<i class="pi pi-search" />
</InputIcon>
<InputText
v-if="currentTab === 'cfg'"
v-if="client.currentTab === 'cfg'"
style="min-width: 0; width: 25dvw"
class="self-center"
size="small"
@ -342,7 +346,12 @@ listen<DownloadingStatus>('download-progress', (event) => {
<InfoPage />
</TabPanel>
</TabPanels>
<div v-if="currentTab === 'users' || currentTab === 'info'">
<div
v-if="
client.currentTab === 'users' ||
client.currentTab === 'info'
"
>
<img
v-if="prf.current?.meta.game === 'ongeki'"
src="/sticker-ongeki.svg"