Add button to create a newinvoice directly from within the sidebar

This commit is contained in:
2025-10-22 12:35:40 +02:00
parent 25467be584
commit 24ccb5ada6
3 changed files with 26 additions and 4 deletions
+7 -1
View File
@@ -8,7 +8,7 @@ import { Kbd } from '@/components/ui/kbd'
import { edit } from '@/routes/profile'; import { edit } from '@/routes/profile';
import { type NavItem, type NavGroup } from '@/types'; import { type NavItem, type NavGroup } from '@/types';
import { Link } from '@inertiajs/vue3'; import { Link } from '@inertiajs/vue3';
import { Kanban, Euro, Contact, Trophy, Calculator, Settings, Target, BookUser, Timer, Headset, IdCard } from 'lucide-vue-next'; import { Kanban, Euro, Contact, Trophy, Calculator, Settings, Target, BookUser, Timer, Headset, IdCard, Plus } from 'lucide-vue-next';
import AppLogo from './AppLogo.vue'; import AppLogo from './AppLogo.vue';
const mainNavGroups: NavGroup[] = [ const mainNavGroups: NavGroup[] = [
@@ -55,6 +55,12 @@ const mainNavGroups: NavGroup[] = [
href: invoices(), href: invoices(),
icon: Euro, icon: Euro,
color: 'text-pink-700', color: 'text-pink-700',
action: {
title: "Neue Rechnung",
icon: Plus,
color: 'text-foreground',
href: invoices()
}
}, },
{ {
title: 'Zeiterfassung', title: 'Zeiterfassung',
+11 -3
View File
@@ -1,9 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem } from '@/components/ui/sidebar'; import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuAction } from '@/components/ui/sidebar';
import { urlIsActive } from '@/lib/utils'; import { urlIsActive } from '@/lib/utils';
import { type NavGroup } from '@/types'; import { type NavGroup } from '@/types';
import { Link, usePage } from '@inertiajs/vue3'; import { Link, usePage } from '@inertiajs/vue3';
import { LayoutGrid } from 'lucide-vue-next'; import { LayoutGrid, Plus } from 'lucide-vue-next';
import { dashboard } from '@/routes'; import { dashboard } from '@/routes';
import SidebarSeparator from './ui/sidebar/SidebarSeparator.vue'; import SidebarSeparator from './ui/sidebar/SidebarSeparator.vue';
@@ -29,7 +29,9 @@ const page = usePage();
</SidebarGroup> </SidebarGroup>
<SidebarGroup class="px-2 py-0" v-for="group in groups"> <SidebarGroup class="px-2 py-0" v-for="group in groups">
<SidebarSeparator class="absolute mt-6 shrink transition-[opacity] opacity-0 group-data-[collapsible=icon]:opacity-100" style="width: calc(var(--spacing) * 4);" /> <SidebarSeparator
class="absolute mt-6 shrink transition-[opacity] opacity-0 group-data-[collapsible=icon]:opacity-100"
style="width: calc(var(--spacing) * 4);" />
<SidebarGroupLabel class="text-bold uppercase text-gray-400 mt-2 group-data-[collapsible=icon]:mt-2"> <SidebarGroupLabel class="text-bold uppercase text-gray-400 mt-2 group-data-[collapsible=icon]:mt-2">
{{ group.title }} {{ group.title }}
</SidebarGroupLabel> </SidebarGroupLabel>
@@ -41,6 +43,12 @@ const page = usePage();
<span>{{ item.title }}</span> <span>{{ item.title }}</span>
</Link> </Link>
</SidebarMenuButton> </SidebarMenuButton>
<SidebarMenuAction v-if="item.action">
<Link :href="item.action.href">
<component :is="item.action.icon" :class="item.action.color" stroke-width="1.5" size="0.833rem" />
<span class="sr-only">{{ item.action.title }}</span>
</Link>
</SidebarMenuAction>
</SidebarMenuItem> </SidebarMenuItem>
</SidebarMenu> </SidebarMenu>
</SidebarGroup> </SidebarGroup>
+8
View File
@@ -24,7 +24,15 @@ export interface NavItem {
icon?: LucideIcon; icon?: LucideIcon;
color?: string; color?: string;
isActive?: boolean; isActive?: boolean;
action?: NavAction
} }
export interface NavAction {
title: string;
href: NonNullable<InertiaLinkProps['href']>;
icon?: LucideIcon;
color?: string;
}
export type AppPageProps<T extends Record<string, unknown> = Record<string, unknown>> = T & { export type AppPageProps<T extends Record<string, unknown> = Record<string, unknown>> = T & {
name: string; name: string;