list warrens + explore nested folders

This commit is contained in:
2025-07-12 06:39:43 +02:00
parent f9f55895ed
commit 4d0765c53b
38 changed files with 1877 additions and 93 deletions

View File

@@ -14,18 +14,7 @@ import {
const route = useRoute();
const warrens = [
{
title: 'Thyr',
url: '/warrens/Thyr',
icon: h(Icon, { name: 'lucide:folder-root' }),
},
{
title: 'Serc',
url: '/warrens/Serc',
icon: h(Icon, { name: 'lucide:folder-root' }),
},
];
const store = useWarrenStore();
</script>
<template>
@@ -57,22 +46,24 @@ const warrens = [
<CollapsibleContent>
<SidebarMenuSub>
<SidebarMenuSubItem
v-for="warren in warrens"
:key="warren.title"
v-for="(warren, uuid) in store.warrens"
:key="uuid"
>
<SidebarMenuSubButton
as-child
:tooltip="warren.title"
:tooltip="warren.name"
:is-active="
warren.url === route.path
route.path.startsWith(
`/warrens/${uuid}`
)
"
class="transition-all"
>
<NuxtLink :to="warren.url">
<component
:is="warren.icon"
></component>
<span>{{ warren.title }}</span>
<NuxtLink :to="`/warrens/${uuid}`">
<Icon
name="lucide:folder-root"
/>
<span>{{ warren.name }}</span>
</NuxtLink>
</SidebarMenuSubButton>
</SidebarMenuSubItem>

View File

@@ -1,24 +1,30 @@
<script setup lang="ts">
import type { DirectoryEntryType } from '~/types';
import type { FileType } from '~/types';
const route = useRoute();
const { name, entryType } = defineProps<{
const { name, entryType, disabled } = defineProps<{
name: string;
entryType: DirectoryEntryType;
entryType: FileType;
disabled: boolean,
}>();
const iconName = entryType === 'file' ? 'lucide:file' : 'lucide:folder';
</script>
<template>
<Button class="w-36 h-12" variant="outline" size="lg">
<NuxtLink
class="flex flex-row items-center gap-1.5"
:to="joinPaths(route.path, name)"
<NuxtLink
:to="joinPaths(route.path, name)"
:class="['select-none', { 'pointer-events-none': disabled }]"
>
<Button
class="w-44 h-12"
variant="outline"
size="lg"
:disabled="disabled"
>
<Icon :name="iconName" />
<span>{{ name }}</span>
</NuxtLink>
</Button>
<span class="truncate">{{ name }}</span>
</Button>
</NuxtLink>
</template>

View File

@@ -1,34 +1,22 @@
<script setup lang="ts">
import { ScrollArea } from '@/components/ui/scroll-area';
import type { DirectoryEntryType } from '~/types';
const items: Array<{ name: string; entryType: DirectoryEntryType }> = [
/* {
name: 'File A',
entryType: 'file',
},
{
name: 'File B',
entryType: 'file',
}, */
{
name: 'Directory A',
entryType: 'directory',
},
{
name: 'Directory B',
entryType: 'directory',
},
];
import type { DirectoryEntry } from '~/types';
const { entries } = defineProps<{
entries: DirectoryEntry[];
}>();
const { isLoading } = useLoadingIndicator();
</script>
<template>
<ScrollArea class="w-full h-full">
<div class="flex flex-row gap-2">
<DirectoryEntry
v-for="item in items"
:key="item.name"
:name="item.name"
:entry-type="item.entryType"
v-for="entry in entries"
:key="entry.name"
:name="entry.name"
:entry-type="entry.fileType"
:disabled="isLoading"
/>
</div>
</ScrollArea>