feat(l1): real L1 dashboard with empty-state + resume widget
Replaces the T20 stub. L1 dashboard renders greeting, "Describe the problem" intake card (autofocus textarea, optional customer fields, primary "Start walk" CTA), open-tickets queue (Phase 1: display-only), and a "Resume in progress" widget listing the L1's active sessions ordered by last_step_at DESC. Empty-state card shows on accounts with no queue + no active sessions (first-run nudge to upload KB or auth flows). Adds /api/l1.ts (full L1 API client surface) and /types/l1.ts. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
35
frontend/src/components/l1/EmptyStateCard.tsx
Normal file
35
frontend/src/components/l1/EmptyStateCard.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import { usePermissions } from '@/hooks/usePermissions'
|
||||
|
||||
interface Props {
|
||||
onUploadClick?: () => void
|
||||
}
|
||||
|
||||
export function EmptyStateCard({ onUploadClick }: Props) {
|
||||
const { canCoverL1 } = usePermissions()
|
||||
|
||||
return (
|
||||
<div className="rounded-lg border border-default bg-card p-6">
|
||||
<h2 className="font-heading text-xl font-bold text-heading mb-2">
|
||||
Your knowledge base is empty
|
||||
</h2>
|
||||
<p className="text-muted-foreground mb-4">
|
||||
L1 Workspace works best when your account has KB content or authored flows.
|
||||
Right now there's nothing to match against — calls will start as ad-hoc walks.
|
||||
</p>
|
||||
{canCoverL1 && onUploadClick ? (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onUploadClick}
|
||||
className="rounded-md bg-accent text-white px-4 py-2 text-sm font-medium hover:bg-accent/90 transition-colors"
|
||||
>
|
||||
Upload KB content
|
||||
</button>
|
||||
) : (
|
||||
<ul className="text-sm text-muted-foreground space-y-1 ml-4 list-disc">
|
||||
<li>Ask your admin to upload KB documents</li>
|
||||
<li>Or ask them to author a flow in the Flows library</li>
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
49
frontend/src/components/l1/ResumeInProgress.tsx
Normal file
49
frontend/src/components/l1/ResumeInProgress.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { l1Api } from '@/api/l1'
|
||||
import type { WalkSession } from '@/types/l1'
|
||||
|
||||
export function ResumeInProgress() {
|
||||
const [sessions, setSessions] = useState<WalkSession[] | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
l1Api
|
||||
.listActiveSessions()
|
||||
.then(setSessions)
|
||||
.catch(() => setSessions([]))
|
||||
}, [])
|
||||
|
||||
if (!sessions || sessions.length === 0) return null
|
||||
|
||||
return (
|
||||
<section>
|
||||
<div className="flex items-center gap-3 mb-3">
|
||||
<span className="font-sans text-[0.625rem] uppercase tracking-[0.12em] font-semibold text-muted-foreground">
|
||||
Resume in progress · {sessions.length}
|
||||
</span>
|
||||
<div className="flex-1 h-px bg-border" />
|
||||
</div>
|
||||
<div className="rounded-lg border border-default bg-card overflow-hidden">
|
||||
{sessions.map((s) => (
|
||||
<Link
|
||||
key={s.id}
|
||||
to={`/l1/walk/${s.id}`}
|
||||
className="flex items-center justify-between px-4 py-3 hover:bg-elevated transition-colors border-b border-default last:border-b-0"
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<span className="font-mono text-xs text-muted-foreground">#{s.id.slice(0, 8)}</span>
|
||||
<span className="text-sm">
|
||||
{s.session_kind === 'adhoc'
|
||||
? `Ad-hoc · ${s.walk_notes.length} notes`
|
||||
: `Step ${s.walked_path.length}`}
|
||||
</span>
|
||||
</div>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{new Date(s.last_step_at).toLocaleTimeString()}
|
||||
</span>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user