mirror of
https://github.com/versia-pub/frontend.git
synced 2025-12-06 16:38:20 +01:00
refactor: ♻️ Improve sidebar and background design
This commit is contained in:
parent
9b5187207b
commit
9ba59cfd21
|
|
@ -14,16 +14,16 @@
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
|
|
||||||
<DropdownMenuItem @click="editName">
|
<DropdownMenuItem @click="editName">
|
||||||
<TextCursorInput class="mr-2 h-4 w-4" />
|
<TextCursorInput class="mr-2 size-4" />
|
||||||
<span>Rename</span>
|
<span>Rename</span>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem @click="editCaption">
|
<DropdownMenuItem @click="editCaption">
|
||||||
<Captions class="mr-2 h-4 w-4" />
|
<Captions class="mr-2 size-4" />
|
||||||
<span>Add caption</span>
|
<span>Add caption</span>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuItem @click="emit('remove')">
|
<DropdownMenuItem @click="emit('remove')">
|
||||||
<Delete class="mr-2 h-4 w-4" />
|
<Delete class="mr-2 size-4" />
|
||||||
<span>Remove</span>
|
<span>Remove</span>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
|
|
@ -123,4 +123,4 @@ const formatBytes = (bytes: number) => {
|
||||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||||
return `${Number.parseFloat((bytes / k ** i).toFixed(digitsAfterPoint))} ${sizes[i]}`;
|
return `${Number.parseFloat((bytes / k ** i).toFixed(digitsAfterPoint))} ${sizes[i]}`;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<svg class="absolute inset-0 h-full w-full stroke-primary/[0.07] [mask-image:radial-gradient(100%_100%_at_top_right,hsl(var(--primary-foreground)),transparent)] pointer-events-none"
|
<svg class="absolute inset-x-0 top-0 h-full w-full stroke-primary/[0.07] [mask-image:radial-gradient(100%_100%_at_top_right,hsl(var(--primary-foreground)),transparent)] pointer-events-none"
|
||||||
aria-hidden="true">
|
aria-hidden="true">
|
||||||
<defs>
|
<defs>
|
||||||
<pattern id="983e3e4c-de6d-4c3f-8d64-b9761d1534cc" width="200" height="200" x="50%" y="-1"
|
<pattern id="983e3e4c-de6d-4c3f-8d64-b9761d1534cc" width="200" height="200" x="50%" y="-1"
|
||||||
|
|
@ -16,4 +16,4 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
maxHeight: collapsed ? '18rem' : `${container?.scrollHeight}px`,
|
maxHeight: collapsed ? '18rem' : `${container?.scrollHeight}px`,
|
||||||
}">
|
}">
|
||||||
<div :class="[
|
<div :class="[
|
||||||
'prose prose-sm block relative dark:prose-invert duration-200 !max-w-full break-words prose-a:no-underline prose-a:hover:underline',
|
'prose prose-sm block relative dark:prose-invert duration-200 !max-w-full break-words prose-a:no-underline hover:prose-a:underline',
|
||||||
$style.content,
|
$style.content,
|
||||||
]" v-html="content" v-render-emojis="emojis"></div>
|
]" v-html="content" v-render-emojis="emojis"></div>
|
||||||
<div v-if="isOverflowing && collapsed"
|
<div v-if="isOverflowing && collapsed"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import {
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuGroup,
|
DropdownMenuGroup,
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuLabel,
|
|
||||||
DropdownMenuSeparator,
|
DropdownMenuSeparator,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "@/components/ui/dropdown-menu";
|
} from "@/components/ui/dropdown-menu";
|
||||||
|
|
@ -86,8 +85,6 @@ const _delete = async () => {
|
||||||
<slot />
|
<slot />
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent class="min-w-56">
|
<DropdownMenuContent class="min-w-56">
|
||||||
<DropdownMenuLabel>{{ m.many_misty_parakeet_fall() }}</DropdownMenuLabel>
|
|
||||||
<DropdownMenuSeparator />
|
|
||||||
<DropdownMenuGroup>
|
<DropdownMenuGroup>
|
||||||
<DropdownMenuItem v-if="authorIsMe" as="button" @click="emit('edit')">
|
<DropdownMenuItem v-if="authorIsMe" as="button" @click="emit('edit')">
|
||||||
<Pencil class="mr-2 size-4" />
|
<Pencil class="mr-2 size-4" />
|
||||||
|
|
@ -141,4 +138,4 @@ const _delete = async () => {
|
||||||
</DropdownMenuGroup>
|
</DropdownMenuGroup>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,11 @@
|
||||||
<Check class="size-4" />
|
<Check class="size-4" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="grid grid-cols-2 p-2 gap-2">
|
<div v-else class="grid grid-cols-2 p-2 gap-2">
|
||||||
<Button variant="outline" size="sm" @click="accept">
|
<Button variant="secondary" size="sm" @click="accept" :title="m.slow_these_kestrel_sail()">
|
||||||
<Check />
|
<Check />
|
||||||
{{ m.slow_these_kestrel_sail() }}
|
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" size="sm" @click="reject">
|
<Button variant="ghost" size="sm" @click="reject" :title="m.weary_steep_yak_embrace()">
|
||||||
<X />
|
<X />
|
||||||
{{ m.weary_steep_yak_embrace() }}
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -84,4 +82,4 @@ const reject = async () => {
|
||||||
relationship.value = data;
|
relationship.value = data;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ const issuerRedirectUrl = (issuerId: string) => {
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
<Button :disabled="isLoading" type="submit">
|
<Button :disabled="isLoading" type="submit">
|
||||||
<Loader v-if="isLoading" class="mr-2 h-4 w-4 animate-spin" />
|
<Loader v-if="isLoading" class="mr-2 size-4 animate-spin" />
|
||||||
{{ m.fuzzy_sea_moth_absorb() }}
|
{{ m.fuzzy_sea_moth_absorb() }}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -135,4 +135,4 @@ const issuerRedirectUrl = (issuerId: string) => {
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -22,20 +22,17 @@
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
</Card>
|
</Card>
|
||||||
<DropdownMenuContent class="min-w-48">
|
<DropdownMenuContent class="min-w-48">
|
||||||
<DropdownMenuLabel class="font-mono">{{ emoji.shortcode }}</DropdownMenuLabel>
|
|
||||||
<DropdownMenuSeparator />
|
|
||||||
|
|
||||||
<DropdownMenuItem @click="editName">
|
<DropdownMenuItem @click="editName">
|
||||||
<TextCursorInput class="mr-2 h-4 w-4" />
|
<TextCursorInput class="mr-2 size-4" />
|
||||||
{{ m.cuddly_such_swallow_hush() }}
|
{{ m.cuddly_such_swallow_hush() }}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<!-- <DropdownMenuItem @click="editCaption">
|
<!-- <DropdownMenuItem @click="editCaption">
|
||||||
<Captions class="mr-2 h-4 w-4" />
|
<Captions class="mr-2 size-4" />
|
||||||
<span>Add caption</span>
|
<span>Add caption</span>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuSeparator /> -->
|
<DropdownMenuSeparator /> -->
|
||||||
<DropdownMenuItem @click="_delete">
|
<DropdownMenuItem @click="_delete">
|
||||||
<Delete class="mr-2 h-4 w-4" />
|
<Delete class="mr-2 size-4" />
|
||||||
{{ m.tense_quick_cod_favor() }}
|
{{ m.tense_quick_cod_favor() }}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
|
|
@ -60,8 +57,6 @@ import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuLabel,
|
|
||||||
DropdownMenuSeparator,
|
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "~/components/ui/dropdown-menu";
|
} from "~/components/ui/dropdown-menu";
|
||||||
import * as m from "~/paraglide/messages.js";
|
import * as m from "~/paraglide/messages.js";
|
||||||
|
|
@ -133,4 +128,4 @@ const _delete = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@
|
||||||
<slot />
|
<slot />
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent class="min-w-56">
|
<DropdownMenuContent class="min-w-56">
|
||||||
<DropdownMenuLabel>{{ m.spicy_loved_giraffe_empower() }}</DropdownMenuLabel>
|
|
||||||
<DropdownMenuSeparator />
|
|
||||||
<DropdownMenuGroup>
|
<DropdownMenuGroup>
|
||||||
<DropdownMenuItem as="button" @click="copyText(account.username)">
|
<DropdownMenuItem as="button" @click="copyText(account.username)">
|
||||||
<AtSign class="mr-2 size-4" />
|
<AtSign class="mr-2 size-4" />
|
||||||
|
|
@ -70,7 +68,6 @@ import {
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuGroup,
|
DropdownMenuGroup,
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuLabel,
|
|
||||||
DropdownMenuSeparator,
|
DropdownMenuSeparator,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "@/components/ui/dropdown-menu";
|
} from "@/components/ui/dropdown-menu";
|
||||||
|
|
@ -128,4 +125,4 @@ const refresh = async () => {
|
||||||
|
|
||||||
toast.success(m.many_cool_fox_love());
|
toast.success(m.many_cool_fox_love());
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<div v-for="provider of ssoConfig?.providers" :key="provider.id"
|
<div v-for="provider of ssoConfig?.providers" :key="provider.id"
|
||||||
class="flex items-center justify-between p-4 bg-dark-700 rounded">
|
class="flex items-center justify-between p-4 bg-dark-700 rounded">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
<Avatar :src="provider.icon" :alt="provider.name" class="h-8 w-8" />
|
<Avatar :src="provider.icon" :alt="provider.name" class="size-8" />
|
||||||
<span class="font-semibold text-gray-300">{{ provider.name }}</span>
|
<span class="font-semibold text-gray-300">{{ provider.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<Sidebar :variant="(sidebarStyle.value as 'sidebar' | 'floating' | 'inset')" collapsible="icon">
|
<Sidebar collapsible="none" class="hidden md:flex">
|
||||||
<SidebarHeader>
|
<SidebarHeader>
|
||||||
<SidebarMenu>
|
<SidebarMenu>
|
||||||
<SidebarMenuItem>
|
<SidebarMenuItem>
|
||||||
|
|
@ -136,13 +136,10 @@ import {
|
||||||
SidebarRail,
|
SidebarRail,
|
||||||
} from "~/components/ui/sidebar";
|
} from "~/components/ui/sidebar";
|
||||||
import * as m from "~/paraglide/messages.js";
|
import * as m from "~/paraglide/messages.js";
|
||||||
import { type EnumSetting, SettingIds } from "~/settings";
|
|
||||||
import Avatar from "../profiles/avatar.vue";
|
import Avatar from "../profiles/avatar.vue";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../ui/button";
|
||||||
import AccountSwitcher from "./account-switcher.vue";
|
import AccountSwitcher from "./account-switcher.vue";
|
||||||
|
|
||||||
const sidebarStyle = useSetting(SettingIds.SidebarStyle) as Ref<EnumSetting>;
|
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
navMain: [
|
navMain: [
|
||||||
{
|
{
|
||||||
|
|
@ -209,4 +206,4 @@ const data = {
|
||||||
|
|
||||||
const instance = useInstance();
|
const instance = useInstance();
|
||||||
const { $pwa } = useNuxtApp();
|
const { $pwa } = useNuxtApp();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<Sidebar variant="inset" collapsible="none" side="right" class="[--sidebar-width:24rem] hidden lg:flex">
|
<Sidebar side="right" collapsible="none" class="w-96 hidden lg:flex">
|
||||||
<SidebarContent class="p-2 overflow-y-auto">
|
<SidebarContent class="p-2 overflow-y-auto">
|
||||||
<NotificationsTimeline />
|
<NotificationsTimeline />
|
||||||
</SidebarContent>
|
</SidebarContent>
|
||||||
|
|
@ -10,4 +10,4 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import NotificationsTimeline from "../timelines/notifications.vue";
|
import NotificationsTimeline from "../timelines/notifications.vue";
|
||||||
import { Sidebar, SidebarContent, SidebarRail } from "../ui/sidebar";
|
import { Sidebar, SidebarContent, SidebarRail } from "../ui/sidebar";
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const showTimelines = computed(
|
||||||
<template>
|
<template>
|
||||||
<SidebarProvider>
|
<SidebarProvider>
|
||||||
<LeftSidebar />
|
<LeftSidebar />
|
||||||
<SidebarInset :class="cn('relative !overflow-y-auto !h-svh', !isMd && 'pt-4')">
|
<SidebarInset :class="cn('relative overflow-y-auto overflow-x-hidden', !isMd && 'pt-4')">
|
||||||
<header v-if="showTimelines" class="flex h-16 items-center bg-background/80 backdrop-blur-2xl sticky top-0 inset-x-0 z-10 p-4">
|
<header v-if="showTimelines" class="flex h-16 items-center bg-background/80 backdrop-blur-2xl sticky top-0 inset-x-0 z-10 p-4">
|
||||||
<Timelines />
|
<Timelines />
|
||||||
</header>
|
</header>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { type VariantProps, cva } from "class-variance-authority";
|
||||||
export { default as Button } from "./Button.vue";
|
export { default as Button } from "./Button.vue";
|
||||||
|
|
||||||
export const buttonVariants = cva(
|
export const buttonVariants = cva(
|
||||||
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
||||||
{
|
{
|
||||||
variants: {
|
variants: {
|
||||||
variant: {
|
variant: {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ const props = withDefaults(
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Primitive :as="props.as" :as-child="props.asChild" :class="cn(
|
<Primitive :as="props.as" :as-child="props.asChild" :class="cn(
|
||||||
'rounded-lg border bg-card/20 backdrop-blur-xl text-card-foreground shadow-sm',
|
'rounded-lg border bg-card/90 backdrop-blur-xl text-card-foreground shadow-sm',
|
||||||
props.class,
|
props.class,
|
||||||
)
|
)
|
||||||
" data-component="card">
|
" data-component="card">
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,11 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CheckboxRoot v-bind="forwarded" :class="cn('peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',
|
<CheckboxRoot v-bind="forwarded" :class="cn('peer size-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',
|
||||||
props.class)">
|
props.class)">
|
||||||
<CheckboxIndicator class="flex h-full w-full items-center justify-center text-current">
|
<CheckboxIndicator class="flex h-full w-full items-center justify-center text-current">
|
||||||
<slot>
|
<slot>
|
||||||
<Check class="h-4 w-4" />
|
<Check class="size-4" />
|
||||||
</slot>
|
</slot>
|
||||||
</CheckboxIndicator>
|
</CheckboxIndicator>
|
||||||
</CheckboxRoot>
|
</CheckboxRoot>
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ const forwardedProps = useForwardProps(delegatedProps);
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex items-center border-b px-3" cmdk-input-wrapper>
|
<div class="flex items-center border-b px-3" cmdk-input-wrapper>
|
||||||
<Search class="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
<Search class="mr-2 size-4 shrink-0 opacity-50" />
|
||||||
<ComboboxInput v-bind="{ ...forwardedProps, ...$attrs }" auto-focus
|
<ComboboxInput v-bind="{ ...forwardedProps, ...$attrs }" auto-focus
|
||||||
:class="cn('flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50', props.class)" />
|
:class="cn('flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50', props.class)" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,8 @@ const forwardedProps = useForwardProps(delegatedProps);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DropdownMenuLabel
|
<DropdownMenuLabel v-bind="forwardedProps"
|
||||||
v-bind="forwardedProps"
|
:class="cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', props.class)">
|
||||||
:class="cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', props.class)"
|
<slot />
|
||||||
>
|
</DropdownMenuLabel>
|
||||||
<slot />
|
|
||||||
</DropdownMenuLabel>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,6 @@ const forwardedProps = useForwardProps(delegatedProps);
|
||||||
)"
|
)"
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
<ChevronRight class="ml-auto h-4 w-4" />
|
<ChevronRight class="ml-auto size-4" />
|
||||||
</DropdownMenuSubTrigger>
|
</DropdownMenuSubTrigger>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ const forwardedProps = useForwardProps(delegatedProps);
|
||||||
<template>
|
<template>
|
||||||
<SelectScrollDownButton v-bind="forwardedProps" :class="cn('flex cursor-default items-center justify-center py-1', props.class)">
|
<SelectScrollDownButton v-bind="forwardedProps" :class="cn('flex cursor-default items-center justify-center py-1', props.class)">
|
||||||
<slot>
|
<slot>
|
||||||
<ChevronDown class="h-4 w-4" />
|
<ChevronDown class="size-4" />
|
||||||
</slot>
|
</slot>
|
||||||
</SelectScrollDownButton>
|
</SelectScrollDownButton>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ const forwardedProps = useForwardProps(delegatedProps);
|
||||||
<template>
|
<template>
|
||||||
<SelectScrollUpButton v-bind="forwardedProps" :class="cn('flex cursor-default items-center justify-center py-1', props.class)">
|
<SelectScrollUpButton v-bind="forwardedProps" :class="cn('flex cursor-default items-center justify-center py-1', props.class)">
|
||||||
<slot>
|
<slot>
|
||||||
<ChevronUp class="h-4 w-4" />
|
<ChevronUp class="size-4" />
|
||||||
</slot>
|
</slot>
|
||||||
</SelectScrollUpButton>
|
</SelectScrollUpButton>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import type { HTMLAttributes } from "vue";
|
import type { HTMLAttributes } from "vue";
|
||||||
import Sheet from "~/components/ui/sheet/Sheet.vue";
|
|
||||||
import SheetContent from "~/components/ui/sheet/SheetContent.vue";
|
|
||||||
import { SIDEBAR_WIDTH_MOBILE, useSidebar } from "./utils";
|
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
|
|
@ -22,76 +19,12 @@ const props = withDefaults(
|
||||||
collapsible: "offcanvas",
|
collapsible: "offcanvas",
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<aside
|
<aside
|
||||||
v-if="collapsible === 'none'"
|
:class="cn('flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground p-1', props.class)"
|
||||||
:class="cn('flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground', props.class)"
|
v-bind="$attrs" data-component="sidebar">
|
||||||
v-bind="$attrs"
|
|
||||||
data-component="sidebar"
|
|
||||||
>
|
|
||||||
<slot />
|
|
||||||
</aside>
|
|
||||||
|
|
||||||
<Sheet v-else-if="isMobile" :open="openMobile" v-bind="$attrs" @update:open="setOpenMobile">
|
|
||||||
<SheetContent
|
|
||||||
data-sidebar="sidebar"
|
|
||||||
data-mobile="true"
|
|
||||||
:side="side"
|
|
||||||
class="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
|
|
||||||
:style="{
|
|
||||||
'--sidebar-width': SIDEBAR_WIDTH_MOBILE,
|
|
||||||
}"
|
|
||||||
as="aside"
|
|
||||||
>
|
|
||||||
<div class="flex h-full w-full flex-col">
|
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</aside>
|
||||||
</SheetContent>
|
|
||||||
</Sheet>
|
|
||||||
|
|
||||||
<aside
|
|
||||||
v-else class="group peer hidden md:block"
|
|
||||||
:data-state="state"
|
|
||||||
:data-collapsible="state === 'collapsed' ? collapsible : ''"
|
|
||||||
:data-variant="variant"
|
|
||||||
:data-side="side"
|
|
||||||
data-component="sidebar"
|
|
||||||
>
|
|
||||||
<!-- This is what handles the sidebar gap on desktop -->
|
|
||||||
<div
|
|
||||||
:class="cn(
|
|
||||||
'duration-200 relative h-svh w-[--sidebar-width] bg-transparent transition-[width] ease-linear',
|
|
||||||
'group-data-[collapsible=offcanvas]:w-0',
|
|
||||||
'group-data-[side=right]:rotate-180',
|
|
||||||
variant === 'floating' || variant === 'inset'
|
|
||||||
? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'
|
|
||||||
: 'group-data-[collapsible=icon]:w-[--sidebar-width-icon]',
|
|
||||||
)"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
:class="cn(
|
|
||||||
'duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex',
|
|
||||||
side === 'left'
|
|
||||||
? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
|
|
||||||
: 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
|
|
||||||
// Adjust the padding for floating and inset variants.
|
|
||||||
variant === 'floating' || variant === 'inset'
|
|
||||||
? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'
|
|
||||||
: 'group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l',
|
|
||||||
props.class,
|
|
||||||
)"
|
|
||||||
v-bind="$attrs"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
data-sidebar="sidebar"
|
|
||||||
class="flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow"
|
|
||||||
>
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</aside>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -7,24 +7,24 @@ const props = defineProps<{
|
||||||
class?: HTMLAttributes["class"];
|
class?: HTMLAttributes["class"];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const backgroundImage = useSetting(SettingIds.BackgroundURL);
|
const bgSetting = useSetting(SettingIds.BackgroundURL);
|
||||||
|
const bgImage = computed(() =>
|
||||||
const canParseUrl = URL.canParse;
|
bgSetting.value.value && URL.canParse(bgSetting.value.value as string)
|
||||||
|
? bgSetting.value.value
|
||||||
|
: "/images/banner.webp",
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main :class="cn(
|
<main :class="cn(
|
||||||
'relative flex min-h-svh max-w-full flex-1 flex-col bg-background',
|
'relative flex min-h-svh max-w-full flex-1 flex-col bg-background',
|
||||||
'peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:overflow-hidden md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow',
|
'peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:overflow-hidden md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow bg-cover bg-center bg-no-repeat',
|
||||||
props.class,
|
props.class,
|
||||||
)" :style="{
|
)" :style="{
|
||||||
backgroundImage: canParseUrl(backgroundImage.value as string) ? `url(${backgroundImage.value})` : undefined,
|
backgroundImage: `url('${bgImage}')`,
|
||||||
backgroundSize: canParseUrl(backgroundImage.value as string) ? 'cover' : undefined,
|
|
||||||
backgroundPosition: canParseUrl(backgroundImage.value as string) ? 'center' : undefined,
|
|
||||||
backgroundRepeat: canParseUrl(backgroundImage.value as string) ? 'no-repeat' : undefined,
|
|
||||||
}">
|
}">
|
||||||
<!-- Overlay for the background image -->
|
<!-- Overlay for the background image -->
|
||||||
<div v-if="canParseUrl(backgroundImage.value as string)" class="absolute -z-10 inset-0 bg-black/20" />
|
<div class="absolute -z-10 inset-0 bg-black/20" />
|
||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ const { toggleSidebar } = useSidebar();
|
||||||
data-sidebar="trigger"
|
data-sidebar="trigger"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
:class="cn('h-7 w-7', props.class)"
|
:class="cn('size-7', props.class)"
|
||||||
@click="toggleSidebar"
|
@click="toggleSidebar"
|
||||||
>
|
>
|
||||||
<PanelLeft />
|
<PanelLeft />
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||||
)"
|
)"
|
||||||
>
|
>
|
||||||
<SwitchThumb
|
<SwitchThumb
|
||||||
:class="cn('pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5')"
|
:class="cn('pointer-events-none block size-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5')"
|
||||||
>
|
>
|
||||||
<slot name="thumb" />
|
<slot name="thumb" />
|
||||||
</SwitchThumb>
|
</SwitchThumb>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<Sidebar>
|
<Sidebar>
|
||||||
<SquarePattern v-if="!canParseUrl(backgroundImage.value as string)" />
|
|
||||||
<slot v-if="!route.meta.requiresAuth || identity" />
|
<slot v-if="!route.meta.requiresAuth || identity" />
|
||||||
<Card v-else class="shadow-none bg-transparent border-none p-4 max-w-md mx-auto">
|
<Card v-else class="shadow-none bg-transparent border-none p-4 max-w-md mx-auto">
|
||||||
<CardHeader class="text-center gap-y-4">
|
<CardHeader class="text-center gap-y-4">
|
||||||
|
|
@ -22,7 +21,6 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ComposerDialog from "~/components/composer/dialog.vue";
|
import ComposerDialog from "~/components/composer/dialog.vue";
|
||||||
import SquarePattern from "~/components/graphics/square-pattern.vue";
|
|
||||||
import MobileNavbar from "~/components/navigation/mobile-navbar.vue";
|
import MobileNavbar from "~/components/navigation/mobile-navbar.vue";
|
||||||
import Sidebar from "~/components/sidebars/sidebar.vue";
|
import Sidebar from "~/components/sidebars/sidebar.vue";
|
||||||
import { Button } from "~/components/ui/button";
|
import { Button } from "~/components/ui/button";
|
||||||
|
|
|
||||||
22
settings.ts
22
settings.ts
|
|
@ -86,7 +86,6 @@ export enum SettingIds {
|
||||||
BackgroundURL = "background-url",
|
BackgroundURL = "background-url",
|
||||||
NotificationsSidebar = "notifications-sidebar",
|
NotificationsSidebar = "notifications-sidebar",
|
||||||
AvatarShape = "avatar-shape",
|
AvatarShape = "avatar-shape",
|
||||||
SidebarStyle = "sidebar-style",
|
|
||||||
DefaultVisibility = "default-visibility",
|
DefaultVisibility = "default-visibility",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -162,27 +161,6 @@ export const settings = (): Record<SettingIds, Setting> => {
|
||||||
],
|
],
|
||||||
page: SettingPages.Behaviour,
|
page: SettingPages.Behaviour,
|
||||||
} as EnumSetting,
|
} as EnumSetting,
|
||||||
[SettingIds.SidebarStyle]: {
|
|
||||||
title: m.deft_seemly_donkey_slide,
|
|
||||||
description: m.wide_least_samuel_conquer,
|
|
||||||
type: SettingType.Enum,
|
|
||||||
value: "inset",
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
value: "inset",
|
|
||||||
label: m.fluffy_north_crow_blink,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "sidebar",
|
|
||||||
label: m.day_polite_newt_loop,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "floating",
|
|
||||||
label: m.jolly_mad_jackdaw_assure,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
page: SettingPages.Appearance,
|
|
||||||
} as EnumSetting,
|
|
||||||
[SettingIds.AvatarShape]: {
|
[SettingIds.AvatarShape]: {
|
||||||
title: m.fit_cool_bulldog_dine,
|
title: m.fit_cool_bulldog_dine,
|
||||||
description: m.agent_misty_firefox_arise,
|
description: m.agent_misty_firefox_arise,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue