Instant ai assistant toggle

This commit is contained in:
Emil
2026-02-21 17:28:54 +01:00
parent fa5e14de83
commit f5c9ebaf95
5 changed files with 47 additions and 14 deletions
+1 -11
View File
@@ -35,16 +35,6 @@ export default async function DashboardLayout({
.eq('user_id', user.id)
.eq('enabled', true)
// Check if ai-chat is explicitly disabled (legacy default: enabled when no row exists)
const { data: aiChatToggle } = await supabase
.from('extension_toggles')
.select('enabled')
.eq('user_id', user.id)
.eq('sector_slug', 'general')
.eq('extension_slug', 'ai-chat')
.single()
const showAiChat = aiChatToggle ? aiChatToggle.enabled : true
return (
<div className="min-h-screen bg-background">
{/* Skip to content link for keyboard/screen reader users */}
@@ -64,7 +54,7 @@ export default async function DashboardLayout({
{children}
</div>
</main>
{showAiChat && <ChatWidget />}
<ChatWidget />
</div>
)
}
+2 -2
View File
@@ -1,8 +1,8 @@
import { createClient } from '@/lib/supabase/server'
import { NextResponse } from 'next/server'
import { renderToBuffer } from '@react-pdf/renderer'
import { InvoicePDF } from '@/lib/invoice/pdf-template'
import { getVatRules } from '@/lib/invoice/vat-rules'
import { InvoicePDF } from '@/lib/invoices/pdf-template'
import { getVatRules } from '@/lib/invoices/vat-rules'
import type { Invoice, InvoiceItem, Customer, CompanySettings, InvoiceDocumentType } from '@/types'
/**