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,19 +1,29 @@
<script setup lang="ts">
import { convertFileSrc } from '@tauri-apps/api/core';
import { ModEntry } from '../types';
import { Package } from '../types';
defineProps({
mod: Object as () => ModEntry,
modelValue: Boolean,
localIcon: Boolean,
const props = defineProps({
pkg: Object as () => Package,
showNamespace: Boolean,
showVersion: Boolean,
});
const iconSrc = () => {
const icon = props.pkg?.icon;
if (icon === undefined) {
return '';
} else if (icon.startsWith('https://')) {
return icon;
} else {
return convertFileSrc(icon);
}
};
</script>
<template>
<img
:src="localIcon ? convertFileSrc(mod?.icon ?? '') : mod?.icon"
:src="iconSrc()"
class="self-center rounded-sm"
width="32px"
height="32px"
@ -21,23 +31,23 @@ defineProps({
<label class="m-3 align-middle text grow z-5 h-50px" for="switch">
<div>
<span class="text-lg">
{{ mod?.name ?? 'Untitled' }}
{{ pkg?.name ?? 'Untitled' }}
</span>
<span
v-if="showNamespace && mod?.namespace"
v-if="showNamespace && pkg?.namespace"
class="text-sm opacity-75"
>
by&nbsp;{{ mod.namespace }}
by&nbsp;{{ pkg.namespace }}
</span>
<span
v-if="showVersion && mod?.version"
v-if="showVersion && pkg?.loc?.version"
class="text-sm opacity-75 m-2"
>
{{ mod.version ?? '?.?.?' }}
{{ pkg?.loc?.version ?? '?.?.?' }}
</span>
</div>
<div class="text-sm opacity-75">
{{ mod?.description ?? 'No description' }}
{{ pkg?.description ?? 'No description' }}
</div>
</label>
</template>