mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 21:23:07 +00:00
feat: Aggregate running auto tasks across all worktrees in BoardView
- Introduced a new memoized function to collect running auto tasks from all worktrees associated with the current project. - Updated the WorktreeTab component to utilize the aggregated running tasks for improved task management visibility. - Enhanced spinner visibility by applying a variant based on the selected state, ensuring better UI feedback during loading states.
This commit is contained in:
@@ -463,6 +463,16 @@ export function BoardView() {
|
|||||||
const selectedWorktreeBranch =
|
const selectedWorktreeBranch =
|
||||||
currentWorktreeBranch || worktrees.find((w) => w.isMain)?.branch || 'main';
|
currentWorktreeBranch || worktrees.find((w) => w.isMain)?.branch || 'main';
|
||||||
|
|
||||||
|
// Aggregate running auto tasks across all worktrees for this project
|
||||||
|
const autoModeByWorktree = useAppStore((state) => state.autoModeByWorktree);
|
||||||
|
const runningAutoTasksAllWorktrees = useMemo(() => {
|
||||||
|
if (!currentProject?.id) return [];
|
||||||
|
const prefix = `${currentProject.id}::`;
|
||||||
|
return Object.entries(autoModeByWorktree)
|
||||||
|
.filter(([key]) => key.startsWith(prefix))
|
||||||
|
.flatMap(([, state]) => state.runningTasks ?? []);
|
||||||
|
}, [autoModeByWorktree, currentProject?.id]);
|
||||||
|
|
||||||
// Get in-progress features for keyboard shortcuts (needed before actions hook)
|
// Get in-progress features for keyboard shortcuts (needed before actions hook)
|
||||||
// Must be after runningAutoTasks is defined
|
// Must be after runningAutoTasks is defined
|
||||||
const inProgressFeaturesForShortcuts = useMemo(() => {
|
const inProgressFeaturesForShortcuts = useMemo(() => {
|
||||||
@@ -1372,7 +1382,7 @@ export function BoardView() {
|
|||||||
setWorktreeRefreshKey((k) => k + 1);
|
setWorktreeRefreshKey((k) => k + 1);
|
||||||
}}
|
}}
|
||||||
onRemovedWorktrees={handleRemovedWorktrees}
|
onRemovedWorktrees={handleRemovedWorktrees}
|
||||||
runningFeatureIds={runningAutoTasks}
|
runningFeatureIds={runningAutoTasksAllWorktrees}
|
||||||
branchCardCounts={branchCardCounts}
|
branchCardCounts={branchCardCounts}
|
||||||
features={hookFeatures.map((f) => ({
|
features={hookFeatures.map((f) => ({
|
||||||
id: f.id,
|
id: f.id,
|
||||||
|
|||||||
@@ -260,8 +260,10 @@ export function WorktreeTab({
|
|||||||
aria-label={worktree.branch}
|
aria-label={worktree.branch}
|
||||||
data-testid={`worktree-branch-${worktree.branch}`}
|
data-testid={`worktree-branch-${worktree.branch}`}
|
||||||
>
|
>
|
||||||
{isRunning && <Spinner size="xs" />}
|
{isRunning && <Spinner size="xs" variant={isSelected ? 'foreground' : 'primary'} />}
|
||||||
{isActivating && !isRunning && <Spinner size="xs" />}
|
{isActivating && !isRunning && (
|
||||||
|
<Spinner size="xs" variant={isSelected ? 'foreground' : 'primary'} />
|
||||||
|
)}
|
||||||
{worktree.branch}
|
{worktree.branch}
|
||||||
{cardCount !== undefined && cardCount > 0 && (
|
{cardCount !== undefined && cardCount > 0 && (
|
||||||
<span className="inline-flex items-center justify-center h-4 min-w-[1rem] px-1 text-[10px] font-medium rounded bg-background/80 text-foreground border border-border">
|
<span className="inline-flex items-center justify-center h-4 min-w-[1rem] px-1 text-[10px] font-medium rounded bg-background/80 text-foreground border border-border">
|
||||||
@@ -327,8 +329,10 @@ export function WorktreeTab({
|
|||||||
: 'Click to switch to this branch'
|
: 'Click to switch to this branch'
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{isRunning && <Spinner size="xs" />}
|
{isRunning && <Spinner size="xs" variant={isSelected ? 'foreground' : 'primary'} />}
|
||||||
{isActivating && !isRunning && <Spinner size="xs" />}
|
{isActivating && !isRunning && (
|
||||||
|
<Spinner size="xs" variant={isSelected ? 'foreground' : 'primary'} />
|
||||||
|
)}
|
||||||
{worktree.branch}
|
{worktree.branch}
|
||||||
{cardCount !== undefined && cardCount > 0 && (
|
{cardCount !== undefined && cardCount > 0 && (
|
||||||
<span className="inline-flex items-center justify-center h-4 min-w-[1rem] px-1 text-[10px] font-medium rounded bg-background/80 text-foreground border border-border">
|
<span className="inline-flex items-center justify-center h-4 min-w-[1rem] px-1 text-[10px] font-medium rounded bg-background/80 text-foreground border border-border">
|
||||||
|
|||||||
Reference in New Issue
Block a user