Skip to content

Commit bcf6013

Browse files
icecrasher321claude
andcommitted
improvement(canvas): fill the running bar once, edge to edge
The sweep restarted from empty every time it filled, so the bar kept re-running ground it had already covered. It fills left to right once and holds. The mark also sat inset in its slot, which put a gap on both sides of every join and made the row read as separate chunks instead of one bar. It now spans its slot edge to edge, leaving only the row's own `gap-[2px]` between marks, and takes its weight off vertically instead: `bg-clip-content` with symmetric padding paints a 10px band inside the 24px slot without changing the slot's size, so the swell measured around it does not move. `--surface-2` is untouched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 04d4676 commit bcf6013

3 files changed

Lines changed: 21 additions & 29 deletions

File tree

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,34 +45,26 @@ const ACTION_BUTTON_STYLES = [
4545
].join(' ')
4646

4747
/**
48-
* The mark a filled sweep slot paints: a slanted band across the slot rather
49-
* than the slot itself.
48+
* The mark a filled sweep slot paints.
5049
*
51-
* Drawn as a hard-stop gradient rather than a `clip-path` because the two end
52-
* slots already carry one for the swell silhouette, and a second would have to
53-
* win a specificity race against it. The stops keep `--surface-2` exactly — only
54-
* the shape changes.
50+
* Spans its slot edge to edge so consecutive marks read as one bar growing,
51+
* with only the row's own `gap-[2px]` between them — a mark inset inside its
52+
* slot leaves a gap on both sides of every join, which is what made the last
53+
* version read as separate chunks rather than a loader. The weight comes off
54+
* vertically instead: `bg-clip-content` with symmetric padding paints a 10px
55+
* band inside the 24px slot without changing the slot's own size, so the swell
56+
* it is measured into does not move.
5557
*
56-
* Slant and tightness trade against each other: the transparent wedge has to be
57-
* at least as wide as the edge's horizontal travel, or the cut clips a corner
58-
* instead of crossing the slot cleanly. 97deg leans the edge 7° off vertical,
59-
* which travels 2.9px over the 24px slot and lets the wedge come in to 12% —
60-
* 3.2px a side, against the 7.8px a 107deg lean needed. Steepen the angle and
61-
* both stops have to move outward with it.
62-
*
63-
* Every variant is spelled out: Tailwind's JIT reads literal class strings, so a
64-
* `hover-hover:${FILL}` built at runtime compiles to no CSS at all. The hover
65-
* and motion-reduce entries also clear the base `hover-hover:bg-*` COLOR, which
66-
* a background-image cannot override and which would otherwise fill the slot
67-
* back in behind the band.
58+
* `--surface-2` is untouched; only the painted area changes. Each variant is
59+
* spelled out because Tailwind's JIT reads literal class strings.
6860
*/
6961
const RUNNING_SWEEP_FILL = [
70-
'!bg-[linear-gradient(97deg,transparent_12%,var(--surface-2)_12%,var(--surface-2)_88%,transparent_88%)]',
71-
'hover-hover:!bg-[linear-gradient(97deg,transparent_12%,var(--surface-2)_12%,var(--surface-2)_88%,transparent_88%)]',
62+
'!bg-[var(--surface-2)] hover-hover:!bg-[var(--surface-2)]',
63+
'!bg-clip-content !py-[7px] !rounded-none',
7264
].join(' ')
7365

7466
const RUNNING_SWEEP_FILL_STATIC =
75-
'motion-reduce:!bg-[linear-gradient(97deg,transparent_12%,var(--surface-2)_12%,var(--surface-2)_88%,transparent_88%)]'
67+
'motion-reduce:!bg-[var(--surface-2)] motion-reduce:!bg-clip-content motion-reduce:!py-[7px] motion-reduce:!rounded-none'
7668

7769
const ICON_SIZE = 'size-[14px]'
7870

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/use-running-action-sweep.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ describe('advanceActionSweep', () => {
1010
expect([first, second, third]).toEqual([1, 2, 3])
1111
})
1212

13-
it('restarts from empty once full, rather than draining back', () => {
14-
expect(advanceActionSweep(3, 3)).toBe(0)
15-
expect(advanceActionSweep(0, 3)).toBe(1)
13+
it('holds at full rather than draining back or restarting', () => {
14+
expect(advanceActionSweep(3, 3)).toBe(3)
15+
expect(advanceActionSweep(4, 3)).toBe(3)
1616
})
1717

1818
it('stays empty when there are no action slots', () => {

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/use-running-action-sweep.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ const ACTION_SWEEP_INTERVAL_MS = 160
55
/**
66
* Advances the cumulative action-slot sweep by one frame.
77
*
8-
* Fills left to right and starts over — it does not drain back. A bar that
9-
* empties itself reads as undoing progress, which is the opposite of what a
10-
* running block is doing.
8+
* Fills left to right once and holds. It neither drains back nor restarts:
9+
* both re-run ground the bar has already covered, which reads as the block
10+
* losing progress rather than making it.
1111
*/
1212
export function advanceActionSweep(filledCount: number, slotCount: number): number {
1313
if (slotCount <= 0) return 0
14-
return filledCount >= slotCount ? 0 : filledCount + 1
14+
return Math.min(filledCount + 1, slotCount)
1515
}
1616

17-
/** Runs a cumulative left-to-right fill while a block executes. */
17+
/** Runs a one-pass left-to-right fill while a block executes. */
1818
export function useRunningActionSweep(isRunning: boolean, slotCount: number): number {
1919
const [filledCount, setFilledCount] = useState(0)
2020

0 commit comments

Comments
 (0)