improve file select content

This commit is contained in:
Georges-Antoine Assi
2025-01-16 14:24:39 -05:00
parent 346bbb2db3
commit f553e8d06e
3 changed files with 36 additions and 1 deletions

View File

@@ -102,6 +102,7 @@ class RomFileSchema(BaseModel):
file_name: str
file_path: str
file_size_bytes: int
full_path: str
created_at: datetime
updated_at: datetime
last_modified: datetime

View File

@@ -11,6 +11,8 @@ export type RomFileSchema = {
file_name: string;
file_path: string;
file_size_bytes: number;
full_path: string;
relative_path: string;
created_at: string;
updated_at: string;
last_modified: string;

View File

@@ -1,4 +1,5 @@
<script setup lang="ts">
import type { RomFileSchema } from "@/__generated__";
import VersionSwitcher from "@/components/Details/VersionSwitcher.vue";
import romApi from "@/services/api/rom";
import storeAuth from "@/stores/auth";
@@ -28,6 +29,14 @@ async function toggleMainSibling() {
});
}
function itemProps(item: RomFileSchema) {
return {
key: item.id,
title: item.full_path.replace(props.rom.full_path, ""),
value: item,
};
}
watch(
() => props.rom,
async () => (romUser.value = props.rom.rom_user),
@@ -93,7 +102,7 @@ watch(
v-model="downloadStore.filesToDownload"
:label="rom.fs_name"
:items="rom.files"
item-title="file_name"
:itemProps="itemProps"
rounded="0"
density="compact"
variant="outlined"
@@ -103,6 +112,29 @@ watch(
clearable
chips
>
<template #item="{ item, props }">
<v-list-item v-bind="props">
<template v-slot:prepend="{ isSelected }">
<v-checkbox-btn
:model-value="isSelected"
density="compact"
class="mr-2"
/>
</template>
<v-list-item-subtitle class="mt-1">
<v-chip
color="romm-accent-1"
size="x-small"
class="mr-1"
v-if="item.raw.category"
>{{ item.raw.category.toLocaleUpperCase() }}</v-chip
>
<v-chip size="x-small">{{
formatBytes(item.raw.file_size_bytes)
}}</v-chip>
</v-list-item-subtitle>
</v-list-item>
</template>
</v-select>
</v-col>
</v-row>