feat: phase 2

Newfound motivation
This commit is contained in:
2025-02-23 05:12:21 +01:00
parent fdf3679fbe
commit a29bce2227
36 changed files with 1367 additions and 615 deletions

View File

@ -1,6 +1,5 @@
<script setup lang="ts">
import { Ref, onMounted, ref } from 'vue';
import { updatePrimaryPalette } from '@primevue/themes';
import { computed, onMounted, ref } from 'vue';
import Button from 'primevue/button';
import Tab from 'primevue/tab';
import TabList from 'primevue/tablist';
@ -8,37 +7,23 @@ import TabPanel from 'primevue/tabpanel';
import TabPanels from 'primevue/tabpanels';
import Tabs from 'primevue/tabs';
import { invoke } from '@tauri-apps/api/core';
import { onOpenUrl } from '@tauri-apps/plugin-deep-link';
import { open } from '@tauri-apps/plugin-dialog';
import ModList from './ModList.vue';
import ModStore from './ModStore.vue';
import Options from './Options.vue';
import { Profile } from '../types';
import { usePkgStore } from '../stores';
import { changePrimaryColor } from '../util';
const changePrimaryColor = (game: 'ongeki' | 'chunithm') => {
const color = game === 'ongeki' ? 'pink' : 'yellow';
const store = usePkgStore();
store.setupListeners();
updatePrimaryPalette({
50: `{${color}.50}`,
100: `{${color}.100}`,
200: `{${color}.200}`,
300: `{${color}.300}`,
400: `{${color}.400}`,
500: `{${color}.500}`,
600: `{${color}.600}`,
700: `{${color}.700}`,
800: `{${color}.800}`,
900: `{${color}.900}`,
950: `{${color}.950}`,
});
};
let profile: Ref<Profile | null> = ref(null);
let key = ref(0);
const currentTab = ref('3');
const loadProfile = async () => {
profile = await invoke('get_current_profile');
await store.reloadProfile();
if (profile === null) {
if (store.profile === null) {
const file = await open({
multiple: false,
directory: false,
@ -50,33 +35,46 @@ const loadProfile = async () => {
],
});
if (file !== null) {
profile = await invoke('init_profile', { path: file });
await store.initProfile(file);
}
}
key.value += 1;
if (store.profile !== null) {
changePrimaryColor(store.profile.game);
currentTab.value = '0';
}
await store.reloadAll();
};
const isDisabled = () => profile === null;
const isProfileDisabled = computed(() => store.profile === null);
const startline = () => {
invoke('startline');
//startDisabled.value = true;
};
onOpenUrl((urls) => {
console.log('deep link:', urls);
});
onMounted(async () => {
await loadProfile();
});
changePrimaryColor('ongeki');
</script>
<template>
<main>
<Tabs lazy value="3" class="h-screen">
<Tabs lazy :value="currentTab" class="h-screen">
<div class="fixed w-full flex z-100">
<TabList class="grow">
<Tab :disabled="isDisabled()" :key="key" value="0"
<Tab :disabled="isProfileDisabled" value="0"
><div class="pi pi-list-check"></div
></Tab>
<Tab :disabled="isDisabled()" :key="key" value="1"
<Tab :disabled="isProfileDisabled" value="1"
><div class="pi pi-download"></div
></Tab>
<Tab :disabled="isDisabled()" :key="key" value="2"
<Tab :disabled="isProfileDisabled" value="2"
><div class="pi pi-cog"></div
></Tab>
<Tab value="3"
@ -84,18 +82,19 @@ changePrimaryColor('ongeki');
></Tab>
<div class="grow"></div>
<Button
disabled
:disabled="false"
icon="pi pi-play"
label="START"
aria-label="start"
size="small"
class="m-2.5"
@click="startline()"
/>
</TabList>
</div>
<TabPanels class="w-full grow mt-[3rem]">
<TabPanel value="0">
<ModList :profile="profile!" />
<ModList />
</TabPanel>
<TabPanel value="1">
<ModStore />
@ -106,6 +105,7 @@ changePrimaryColor('ongeki');
<TabPanel value="3">
UNDER CONSTRUCTION<br /><br />
<Button
:disabled="!isProfileDisabled"
label="Create profile"
icon="pi pi-plus"
aria-label="open-executable"