-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0ab565
commit 059d73d
Showing
7 changed files
with
82 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
declare module "#app" { | ||
interface PageMeta { | ||
stickyNav?: boolean; | ||
childOverflow?: boolean; | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<script setup lang="ts"> | ||
import { type UserCollectionsResponse } from "@/types/collections"; | ||
const { $pb } = useNuxtApp(); | ||
const { currentUser } = useAuthentication(); | ||
const { open } = useLibraryCollectionCreate(); | ||
const route = useRoute(); | ||
const { data: links, refresh } = await useAsyncData( | ||
() => { | ||
return $pb.send<UserCollectionsResponse>( | ||
`/api/user-collections/${currentUser.value?.id}`, | ||
{ | ||
method: "GET", | ||
expand: "collection", | ||
}, | ||
); | ||
}, | ||
{ | ||
transform: (collections) => [ | ||
collections.items.map( | ||
( | ||
item, | ||
): { | ||
icon?: string; | ||
label: string; | ||
to?: string; | ||
click?: () => void; | ||
} => ({ | ||
label: item.collection!.name, | ||
to: item.collection!.id, | ||
}), | ||
), | ||
], | ||
}, | ||
); | ||
const sticky = computed(() => route.meta.stickyNav as boolean); | ||
const overflow = computed(() => route.meta.childOverflow ?? true); | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<NavigationBar :sticky="sticky" /> | ||
|
||
<main class="container mx-auto min-h-[80vh] overflow-x-hidden px-6 pb-6"> | ||
<div class="flex flex-col gap-6 sm:flex-row"> | ||
<aside v-if="links" class="hidden w-48 flex-shrink-0 sm:w-48 lg:block"> | ||
<AppSideNavigation :links="links" /> | ||
<UButton | ||
class="mt-3 w-full" | ||
active-class="bg-gray-200 text-gray-700 dark:bg-gray-800 dark:text-gray-100" | ||
icon="i-fluent-collections-20-filled" | ||
color="gray" | ||
variant="ghost" | ||
@click="() => open(refresh)" | ||
> | ||
{{ $t("library.createCollection") }} | ||
</UButton> | ||
</aside> | ||
<div class="flex-1" :class="{ 'overflow-x-auto': overflow }"> | ||
<slot /> | ||
</div> | ||
</div> | ||
</main> | ||
|
||
<TheFooter /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters