- Reorganize reports page from flat 11-tab bar into 4-column categorized grid (Bokslut, Skatt & moms, Huvudböcker, Avstämning) - Move Import from Övrigt to Finans nav group for better discoverability - Merge standalone Marketplace link into Tillägg section as "Utforska fler..." - Rename abbreviated "Lev.fakturor" to full "Leverantörsfakturor" - Add uncategorized transaction count badge to nav (desktop pill + mobile dot) - Strengthen credit note confirmation with destructive styling and type-to-confirm pattern requiring exact invoice number - Clarify invoice send vs mark-sent with "Skickad manuellt" label, visual hierarchy, and explanatory helper text - Show Banking and Notifications settings tabs always, with placeholder message and link to extensions when not enabled Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
69 lines
2.1 KiB
TypeScript
69 lines
2.1 KiB
TypeScript
import { createClient } from '@/lib/supabase/server'
|
|
import { redirect } from 'next/navigation'
|
|
import DashboardNav from '@/components/dashboard/DashboardNav'
|
|
import { ChatWidget } from '@/components/chat'
|
|
import type { EntityType } from '@/types'
|
|
|
|
export default async function DashboardLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode
|
|
}) {
|
|
const supabase = await createClient()
|
|
|
|
const { data: { user } } = await supabase.auth.getUser()
|
|
|
|
if (!user) {
|
|
redirect('/login')
|
|
}
|
|
|
|
const { data: settings } = await supabase
|
|
.from('company_settings')
|
|
.select('company_name, onboarding_complete, entity_type')
|
|
.eq('user_id', user.id)
|
|
.single()
|
|
|
|
if (!settings?.onboarding_complete) {
|
|
redirect('/onboarding')
|
|
}
|
|
|
|
const entityType = (settings.entity_type as EntityType) || 'enskild_firma'
|
|
|
|
const [{ data: enabledToggles }, { count: uncategorizedCount }] = await Promise.all([
|
|
supabase
|
|
.from('extension_toggles')
|
|
.select('sector_slug, extension_slug')
|
|
.eq('user_id', user.id)
|
|
.eq('enabled', true),
|
|
supabase
|
|
.from('transactions')
|
|
.select('*', { count: 'exact', head: true })
|
|
.eq('user_id', user.id)
|
|
.is('is_business', null),
|
|
])
|
|
|
|
return (
|
|
<div className="min-h-screen bg-background">
|
|
{/* Skip to content link for keyboard/screen reader users */}
|
|
<a
|
|
href="#main-content"
|
|
className="sr-only focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-[100] focus:px-4 focus:py-2 focus:bg-primary focus:text-primary-foreground focus:rounded-lg focus:text-sm focus:font-medium"
|
|
>
|
|
Hoppa till innehåll
|
|
</a>
|
|
<DashboardNav
|
|
companyName={settings.company_name || 'Min verksamhet'}
|
|
entityType={entityType}
|
|
enabledExtensions={enabledToggles || []}
|
|
uncategorizedTransactionCount={uncategorizedCount ?? 0}
|
|
/>
|
|
<main id="main-content" className="pb-20 md:pb-0 md:pl-[232px]" role="main">
|
|
<div className="max-w-5xl mx-auto px-5 py-8 md:px-8 md:py-10">
|
|
{children}
|
|
</div>
|
|
</main>
|
|
<ChatWidget />
|
|
</div>
|
|
)
|
|
}
|