feat: show subsessions under parent sessions in mobile sheet
Nest child sessions (by parentID) under their parent in the mobile sessions list, with a chevron in the row's left gutter to expand/collapse them recursively. Top-level pagination counts only parent sessions; children whose parent isn't in the same bucket stay top-level so nothing is hidden. Expansion state lives in an in-memory store that survives closing and reopening the sheet but resets on a full page reload.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { create } from 'zustand';
|
||||
|
||||
/**
|
||||
* In-memory expand state for parent sessions (with subsessions) in the mobile
|
||||
* sessions sheet. Deliberately NOT persisted: it survives closing and
|
||||
* reopening the sheet (the sheet unmounts on close, but this module-level store
|
||||
* does not), and resets on a full page reload.
|
||||
*/
|
||||
type MobileSessionExpansionStore = {
|
||||
expandedParents: Record<string, boolean>;
|
||||
toggleParent: (sessionId: string) => void;
|
||||
};
|
||||
|
||||
export const useMobileSessionExpansionStore = create<MobileSessionExpansionStore>((set) => ({
|
||||
expandedParents: {},
|
||||
toggleParent: (sessionId) =>
|
||||
set((state) => {
|
||||
const next = { ...state.expandedParents };
|
||||
if (next[sessionId]) delete next[sessionId];
|
||||
else next[sessionId] = true;
|
||||
return { expandedParents: next };
|
||||
}),
|
||||
}));
|
||||
Reference in New Issue
Block a user