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,48 +1,18 @@
<script setup lang="ts">
import { ref } from 'vue';
import Button from 'primevue/button';
import { invoke } from '@tauri-apps/api/core';
import { open } from '@tauri-apps/plugin-shell';
import InstallButton from './InstallButton.vue';
import ModTitlecard from './ModTitlecard.vue';
import { ModEntry } from '../types';
import { Package } from '../types';
const emit = defineEmits(['updated']);
const props = defineProps({
mod: Object as () => ModEntry,
isLocal: Boolean,
defineProps({
pkg: Object as () => Package,
});
const isLoading = ref(false);
const handlePackageButton = async () => {
isLoading.value = true;
if (!props.isLocal) {
await invoke('download_package', { pkg: props.mod });
} else {
await invoke('delete_package', {
namespace: props.mod?.namespace,
name: props.mod?.name,
});
}
await invoke('reload_packages');
emit('updated');
isLoading.value = false;
};
</script>
<template>
<ModTitlecard :mod="mod" showNamespace />
<Button
rounded
:icon="isLocal ? 'pi pi-trash' : 'pi pi-plus'"
:severity="isLocal ? 'danger' : 'success'"
aria-label="install"
size="small"
class="self-center"
style="width: 2rem; height: 2rem"
:loading="isLoading"
v-on:click="handlePackageButton()"
/>
<ModTitlecard :pkg="pkg" showNamespace />
<InstallButton :pkg="pkg" />
<Button
rounded
icon="pi pi-external-link"
@ -51,7 +21,8 @@ const handlePackageButton = async () => {
size="small"
class="self-center ml-2"
style="width: 2rem; height: 2rem"
v-on:click="open(mod?.package_url ?? '')"
:disabled="!pkg?.rmt"
v-on:click="open(pkg?.rmt?.package_url ?? '')"
/>
</template>