feat(frontend): Active/Archive as independent accordions (replaces toggle)
This commit is contained in:
@@ -41,10 +41,15 @@ test("opening the panel shows the session documents", async () => {
|
|||||||
expect(await screen.findByText("Domanda originale")).toBeInTheDocument();
|
expect(await screen.findByText("Domanda originale")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Archive toggle reveals archived sessions", async () => {
|
test("Archive accordion expands to reveal archived sessions", async () => {
|
||||||
wrap();
|
wrap();
|
||||||
await userEvent.click(await screen.findByRole("button", { name: /archive/i }));
|
// archived hidden until the Archive accordion is expanded
|
||||||
|
expect(await screen.findByText("Attiva uno")).toBeInTheDocument();
|
||||||
|
expect(screen.queryByText("Archiviata due")).not.toBeInTheDocument();
|
||||||
|
await userEvent.click(screen.getByRole("button", { name: /archive/i }));
|
||||||
expect(await screen.findByText("Archiviata due")).toBeInTheDocument();
|
expect(await screen.findByText("Archiviata due")).toBeInTheDocument();
|
||||||
|
// Active sessions remain visible (it is a separate accordion, not a swap)
|
||||||
|
expect(screen.getByText("Attiva uno")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Resume from the panel activates the session and closes the panel", async () => {
|
test("Resume from the panel activates the session and closes the panel", async () => {
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ export function AppShell() {
|
|||||||
|
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const [panelSession, setPanelSession] = useState<SessionSummary | null>(null);
|
const [panelSession, setPanelSession] = useState<SessionSummary | null>(null);
|
||||||
const [showArchive, setShowArchive] = useState(false);
|
const [activeOpen, setActiveOpen] = useState(true);
|
||||||
|
const [archiveOpen, setArchiveOpen] = useState(false);
|
||||||
const [renameTarget, setRenameTarget] = useState<SessionSummary | null>(null);
|
const [renameTarget, setRenameTarget] = useState<SessionSummary | null>(null);
|
||||||
const [deleteTarget, setDeleteTarget] = useState<SessionSummary | null>(null);
|
const [deleteTarget, setDeleteTarget] = useState<SessionSummary | null>(null);
|
||||||
const [collapsedGroups, setCollapsedGroups] = useState<Record<string, boolean>>({});
|
const [collapsedGroups, setCollapsedGroups] = useState<Record<string, boolean>>({});
|
||||||
@@ -211,10 +212,17 @@ export function AppShell() {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 overflow-y-auto px-2 pb-4">
|
<div className="flex-1 overflow-y-auto px-2 pb-4">
|
||||||
{showArchive ? (
|
<button
|
||||||
<NavSessions sessions={archivedList} activeSessionId={activeSessionId} onOpenPanel={openPanel} menuFor={menuFor} />
|
type="button"
|
||||||
) : (
|
onClick={() => setActiveOpen((v) => !v)}
|
||||||
<div className="flex flex-col gap-3">
|
aria-expanded={activeOpen}
|
||||||
|
className="flex w-full items-center gap-1 px-1 pb-1 pt-1 text-left text-[0.7rem] font-bold uppercase tracking-wide text-primary hover:text-primary/80"
|
||||||
|
>
|
||||||
|
<span className="select-none">{activeOpen ? "▾" : "▸"}</span>
|
||||||
|
<span>Active sessions</span>
|
||||||
|
</button>
|
||||||
|
{activeOpen && (
|
||||||
|
<div className="flex flex-col gap-3 pb-2">
|
||||||
{groups.map((g) => (
|
{groups.map((g) => (
|
||||||
<div key={g}>
|
<div key={g}>
|
||||||
<button
|
<button
|
||||||
@@ -249,12 +257,19 @@ export function AppShell() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={() => setShowArchive((v) => !v)}
|
type="button"
|
||||||
className="mt-3 w-full rounded-md px-2 py-1.5 text-left text-[0.7rem] font-semibold uppercase tracking-wide text-muted-foreground hover:bg-accent"
|
onClick={() => setArchiveOpen((v) => !v)}
|
||||||
|
aria-expanded={archiveOpen}
|
||||||
|
className="mt-2 flex w-full items-center gap-1 px-1 pb-1 pt-1 text-left text-[0.7rem] font-bold uppercase tracking-wide text-muted-foreground hover:text-foreground"
|
||||||
>
|
>
|
||||||
{showArchive ? "← Active sessions" : `Archive (${archivedList.length})`}
|
<span className="select-none">{archiveOpen ? "▾" : "▸"}</span>
|
||||||
|
<span>Archive ({archivedList.length})</span>
|
||||||
</button>
|
</button>
|
||||||
|
{archiveOpen && (
|
||||||
|
<NavSessions sessions={archivedList} activeSessionId={activeSessionId} onOpenPanel={openPanel} menuFor={menuFor} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user