diff --git a/client/sessions.tsx b/client/sessions.tsx index 6c7660b..56b3962 100644 --- a/client/sessions.tsx +++ b/client/sessions.tsx @@ -23,6 +23,7 @@ const CATEGORY_FILTERS = ["ALL", "KEEP", "ARCHIVE", "JUNK"] as const; type CategoryFilter = (typeof CATEGORY_FILTERS)[number]; const AGENT_TAB_ALL = "ALL"; +const CLEANUP_PREVIEW_LIMIT = 5; // Matches packages/app/src/styles/theme.ts's FONT_SIZE/SPACING/RADIUS scale and // packages/app/src/components/ui/control-geometry.ts's button-size tiers, hand-copied @@ -520,6 +521,7 @@ export function SessionsSurface({ theme, layout }: PluginSurfaceProps) { const [loading, setLoading] = useState(false); const [rescanning, setRescanning] = useState(false); const [cleanupCandidates, setCleanupCandidates] = useState(null); + const [showCleanupList, setShowCleanupList] = useState(false); const [applyingCleanup, setApplyingCleanup] = useState(false); const [bulkArchiving, setBulkArchiving] = useState(false); const [bulkDeleting, setBulkDeleting] = useState(false); @@ -604,6 +606,8 @@ export function SessionsSurface({ theme, layout }: PluginSurfaceProps) { setCleanupCandidates(result.candidates); }, [cleanupSessions]); + const closeCleanupList = useCallback(() => setShowCleanupList(false), []); + const applyCleanup = useCallback(async () => { setApplyingCleanup(true); try { @@ -974,6 +978,36 @@ export function SessionsSurface({ theme, layout }: PluginSurfaceProps) { }, cleanupBannerTitle: { color: theme.colors.foreground, fontSize: FONT_SIZE.base, marginBottom: SPACING[1] }, cleanupBannerActions: { flexDirection: "row" as const, gap: SPACING[2], marginTop: SPACING[2] }, + cleanupMore: { alignSelf: "flex-start" as const, paddingVertical: SPACING[2] }, + cleanupMoreText: { color: theme.colors.accent, fontSize: FONT_SIZE.sm, textDecorationLine: "underline" as const }, + cleanupListBackdrop: { + flex: 1, + backgroundColor: "rgba(0,0,0,0.5)", + alignItems: "center" as const, + justifyContent: "center" as const, + padding: SPACING[4], + }, + cleanupListCard: { + width: "100%" as const, + maxWidth: 680, + height: "85%" as const, + maxHeight: 720, + backgroundColor: theme.colors.surface0, + borderRadius: RADIUS.lg, + overflow: "hidden" as const, + }, + cleanupListHeader: { + flexDirection: "row" as const, + alignItems: "center" as const, + gap: SPACING[2], + padding: SPACING[3], + borderBottomWidth: 1, + borderBottomColor: theme.colors.foregroundMuted, + }, + cleanupListTitle: { flex: 1, color: theme.colors.foreground, fontSize: FONT_SIZE.base, fontWeight: "700" as const }, + cleanupList: { flex: 1 }, + cleanupListRow: { padding: SPACING[3], gap: SPACING[1] }, + cleanupListSeparator: { height: 1, backgroundColor: theme.colors.foregroundMuted, opacity: 0.25 }, // Floats over the list instead of being inserted inline, so selecting a row never reflows the list. bulkBar: { position: "absolute" as const, @@ -1185,12 +1219,24 @@ export function SessionsSurface({ theme, layout }: PluginSurfaceProps) { {cleanupCandidates.length} session{cleanupCandidates.length === 1 ? "" : "s"} recommended for cleanup — nothing changed yet. - {cleanupCandidates.slice(0, 5).map((candidate) => ( + {cleanupCandidates.slice(0, CLEANUP_PREVIEW_LIMIT).map((candidate) => ( • {candidate.title ?? candidate.firstUserMessage ?? "(untitled)"} — {candidate.classification?.reason} ))} - {cleanupCandidates.length > 5 ? ...and {cleanupCandidates.length - 5} more : null} + {cleanupCandidates.length > CLEANUP_PREVIEW_LIMIT ? ( + setShowCleanupList(true)} + disabled={applyingCleanup} + > + + View {cleanupCandidates.length - CLEANUP_PREVIEW_LIMIT} more + + + ) : null} )} @@ -1412,6 +1458,42 @@ export function SessionsSurface({ theme, layout }: PluginSurfaceProps) { /> )} + {showCleanupList && cleanupCandidates ? ( + + + + + + Cleanup candidates ({cleanupCandidates.length}) + + + Close + + + item.id} + style={styles.cleanupList} + tabIndex={0} + accessibilityLabel="Cleanup candidate list" + ItemSeparatorComponent={() => } + renderItem={({ item }) => ( + + + {item.title ?? item.firstUserMessage ?? "(untitled session)"} + + + {agentLabel(item.agent)} · {item.project} · {formatDateTime(item.createdAt)} + + {item.classification ? {item.classification.reason} : null} + + )} + /> + + + + ) : null} + setPreviewSession(null)}> {previewSession ? (