fix sidebar warren buttons

This commit is contained in:
2025-07-18 11:07:56 +02:00
parent ecb201dc69
commit 026f84b870

View File

@@ -15,6 +15,13 @@ import {
const route = useRoute(); const route = useRoute();
const store = useWarrenStore(); const store = useWarrenStore();
async function selectWarren(id: string) {
await store.setCurrentWarren(id, '/');
await navigateTo({
path: '/warrens/files',
});
}
</script> </script>
<template> <template>
@@ -46,25 +53,20 @@ const store = useWarrenStore();
<CollapsibleContent> <CollapsibleContent>
<SidebarMenuSub> <SidebarMenuSub>
<SidebarMenuSubItem <SidebarMenuSubItem
v-for="(warren, uuid) in store.warrens" v-for="(warren, id) in store.warrens"
:key="uuid" :key="id"
> >
<SidebarMenuSubButton <SidebarMenuSubButton
as-child
:tooltip="warren.name" :tooltip="warren.name"
:is-active=" :is-active="
route.path.startsWith( store.current != null &&
`/warrens/${uuid}` store.current.warrenId === id
)
" "
class="transition-all" class="transition-all"
@click="() => selectWarren(id)"
> >
<NuxtLink :to="`/warrens/${uuid}`"> <Icon name="lucide:folder-root" />
<Icon <span>{{ warren.name }}</span>
name="lucide:folder-root"
/>
<span>{{ warren.name }}</span>
</NuxtLink>
</SidebarMenuSubButton> </SidebarMenuSubButton>
</SidebarMenuSubItem> </SidebarMenuSubItem>
</SidebarMenuSub> </SidebarMenuSub>