diff --git a/src/app/components/dashboard/ActionsTab.tsx b/src/app/components/dashboard/ActionsTab.tsx index e1072a6f..5c68039e 100644 --- a/src/app/components/dashboard/ActionsTab.tsx +++ b/src/app/components/dashboard/ActionsTab.tsx @@ -1,14 +1,15 @@ -import { createMemo, For, Show } from "solid-js"; +import { createEffect, createMemo, For, Show } from "solid-js"; import { createStore } from "solid-js/store"; import type { WorkflowRun } from "../../services/api"; import { config } from "../../stores/config"; -import { viewState, setViewState, setTabFilter, resetTabFilter, resetAllTabFilters, ignoreItem, unignoreItem, type ActionsFilterField } from "../../stores/view"; +import { viewState, setViewState, setTabFilter, resetTabFilter, resetAllTabFilters, ignoreItem, unignoreItem, toggleExpandedRepo, setAllExpanded, pruneExpandedRepos, type ActionsFilterField } from "../../stores/view"; import WorkflowSummaryCard from "./WorkflowSummaryCard"; import IgnoreBadge from "./IgnoreBadge"; import SkeletonRows from "../shared/SkeletonRows"; import FilterChips from "../shared/FilterChips"; import type { FilterChipGroupDef } from "../shared/FilterChips"; import ChevronIcon from "../shared/ChevronIcon"; +import ExpandCollapseButtons from "../shared/ExpandCollapseButtons"; interface ActionsTabProps { workflowRuns: WorkflowRun[]; @@ -116,17 +117,22 @@ const actionsFilterGroups: FilterChipGroupDef[] = [ ]; export default function ActionsTab(props: ActionsTabProps) { - const [expandedRepos, setExpandedRepos] = createStore>({}); const [expandedWorkflows, setExpandedWorkflows] = createStore>({}); - function toggleRepo(repoFullName: string) { - setExpandedRepos(repoFullName, (v) => !v); - } - function toggleWorkflow(key: string) { setExpandedWorkflows(key, (v) => !v); } + const activeRepoNames = createMemo(() => + [...new Set(props.workflowRuns.map((r) => r.repoFullName))] + ); + + createEffect(() => { + const names = activeRepoNames(); + if (names.length === 0) return; + pruneExpandedRepos("actions", names); + }); + function handleIgnore(run: WorkflowRun) { ignoreItem({ id: String(run.id), @@ -180,7 +186,7 @@ export default function ActionsTab(props: ActionsTabProps) { return (
{/* Toolbar */} -
+