feat(settings): open Assistenten on Kunskap with the konteringskarta first (#1044)

The Assistenten settings hub used to open on Minne, with the
konteringskarta buried two clicks away (Kunskap tab, below a second
nested tab row). Now /settings/assistant opens on Kunskap and the
LedgerGraph hero is the first thing on screen.

- Kunskap is the default view and first tab; Minne moves to ?view=memory
  (old ?view=knowledge links still resolve to the default)
- Drop the nested Kompetens/Minne/Regler & profil tab row inside the
  Kunskap view: Kompetens and Minne duplicated the top-level tabs one
  row above; Regler & profil now renders inline under the graph with a
  section header (KnowledgeTabs.tsx deleted)
- Restore vertical rhythm (space-y-8) between the hero, detail section
  and footer, lost when the view moved into the settings tabs
- Update redirects and memory deep links (/settings/agent-memory,
  AgentChat memory chips, FactsCard manage link) to ?view=memory
- Match the loading skeleton to the new layout

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-07-17 13:43:57 +02:00
committed by GitHub
co-authored by Claude Fable 5
parent fd1c266cb0
commit bfd5b42eb1
12 changed files with 48 additions and 77 deletions
@@ -111,7 +111,7 @@ export function FactsCard({ competence }: { competence: AgentCompetence }) {
<span className="tabular-nums">
{factsActiveTotal > facts.length ? t('facts_more', { n: factsActiveTotal - facts.length }) : ''}
</span>
<ManageLink href="/settings/assistant" label={t('facts_manage')} />
<ManageLink href="/settings/assistant?view=memory" label={t('facts_manage')} />
</div>
</>
)}
@@ -60,11 +60,17 @@ export function AgentKnowledgePanel() {
}
if (!payload) {
// Mirrors the loaded layout: graph hero, section header, two profile cards.
return (
<div className="space-y-6">
<Skeleton className="h-64 w-full rounded-xl" />
<Skeleton className="h-9 w-64" />
<Skeleton className="h-48 w-full rounded-xl" />
<div className="space-y-8">
<Skeleton className="h-96 w-full rounded-xl" />
<div className="space-y-4">
<Skeleton className="h-4 w-40" />
<div className="grid gap-4 md:grid-cols-2">
<Skeleton className="h-48 w-full rounded-lg" />
<Skeleton className="h-48 w-full rounded-lg" />
</div>
</div>
</div>
)
}
@@ -26,7 +26,6 @@ import type { DeepLedgerContext } from '@/lib/agent-context/ledger-deep'
import type { AgentCompetence } from '@/lib/agent-context/agent-competence'
import { LedgerGraph } from './LedgerGraph'
import { CompetenceCard, FactsCard } from './AgentCompetenceSections'
import { KnowledgeTabs } from './KnowledgeTabs'
// Swedish VAT (moms) treatment codes stay Swedish in both locales, like BAS
// account names and momsdeklaration labels (.claude/rules/i18n.md).
@@ -74,7 +73,7 @@ export function AgentKnowledgeView({
// No bookings yet, but the agent still ships with competence and may
// already remember facts: show those rather than a dead end.
return (
<>
<div className="space-y-8">
<Card>
<CardContent className="p-0">
<EmptyState
@@ -90,7 +89,7 @@ export function AgentKnowledgeView({
<CompetenceCard competence={competence} />
<FactsCard competence={competence} />
</div>
</>
</div>
)
}
@@ -110,7 +109,9 @@ export function AgentKnowledgeView({
? t('period_yearly')
: (vat_profile.moms_period ?? t('unknown'))
// "Regler & profil" tab: user-authored rules + observed VAT + conventions.
// "Regler & profil": user-authored rules + observed VAT + conventions.
// Rendered inline below the graph; Minne and Kompetens have their own
// top-level tabs, so nesting a second tab row here would just duplicate them.
const configContent = (
<>
{explicit_rules.length > 0 && (
@@ -218,24 +219,22 @@ export function AgentKnowledgeView({
</>
)
const tabs = [
{ value: 'competence', label: t('tab_competence'), content: <CompetenceCard competence={competence} /> },
{ value: 'memory', label: t('tab_memory'), content: <FactsCard competence={competence} /> },
{ value: 'config', label: t('tab_config'), content: configContent },
]
return (
<>
<div className="space-y-8">
{/* The cinematic hero: a self-contained dark panel with its own header */}
<LedgerGraph deep={deep} companyName={companyName} />
{/* Supporting detail, tabbed so it doesn't stack into a long scroll */}
<KnowledgeTabs tabs={tabs} />
<section className="space-y-4">
<h2 className="text-sm font-medium uppercase tracking-wider text-muted-foreground">
{t('tab_config')}
</h2>
{configContent}
</section>
<p className="text-right text-xs text-muted-foreground">
{t('footer_basis', { entries: meta.coverage.posted_entries_window, date: formatDateLong(meta.computed_at) })}
</p>
</>
</div>
)
}
@@ -1,33 +0,0 @@
'use client'
import type { ReactNode } from 'react'
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'
/**
* Client wrapper that organizes the page's supporting detail into tabs so the
* booking map stays the hero and the rest doesn't stack into a long scroll.
* Content is server-rendered upstream and handed in as ReactNode slots.
*/
export function KnowledgeTabs({
tabs,
}: {
tabs: { value: string; label: string; content: ReactNode }[]
}) {
if (tabs.length === 0) return null
return (
<Tabs defaultValue={tabs[0].value} className="space-y-6">
<TabsList>
{tabs.map((t) => (
<TabsTrigger key={t.value} value={t.value}>
{t.label}
</TabsTrigger>
))}
</TabsList>
{tabs.map((t) => (
<TabsContent key={t.value} value={t.value} className="space-y-8 focus-visible:outline-none">
{t.content}
</TabsContent>
))}
</Tabs>
)
}