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

@ -0,0 +1,58 @@
<script setup lang="ts">
import Button from 'primevue/button';
import { invoke } from '@tauri-apps/api/core';
import { Package } from '../types';
import { pkgKey } from '../util';
const props = defineProps({
pkg: Object as () => Package,
});
const install = async () => {
if (props.pkg === undefined) {
return;
}
await invoke('install_package', { key: pkgKey(props.pkg) });
//if (rv === 'Deferred') { /* download progress */ }
};
const remove = async () => {
if (props.pkg === undefined) {
return;
}
await invoke('delete_package', {
key: pkgKey(props.pkg),
});
};
</script>
<template>
<Button
v-if="pkg?.loc"
rounded
icon="pi pi-trash"
severity="danger"
aria-label="remove"
size="small"
class="self-center ml-4"
style="width: 2rem; height: 2rem"
:loading="false"
v-on:click="remove()"
/>
<Button
v-else
rounded
icon="pi pi-plus"
severity="success"
aria-label="install"
size="small"
class="self-center ml-4"
style="width: 2rem; height: 2rem"
:loading="false"
v-on:click="install()"
/>
</template>