Skip to content

Commit 5288927

Browse files
committed
Routines: one shared routine row and switch, On/Paused everywhere, Run now back as a row
- RoutineRow and RoutineSwitch (components/routines/routine-row.tsx): icon tile, the name as the link, one line, a default Switch beside the link. The routine, goal and check-in writes are in one hook. A failed switch says "Couldn't turn it on. Try again." (or off). Paused rows say "Paused · <schedule>". routineCount() is the one count format. - /routines draws each Bot's rows in one card with RoutineRow. - Every page's switch says On or Paused. The goal page no longer says Active twice. - Run now is a row again on the routine, goal and check-in pages. The header keeps the switch, and Edit on a routine. - The goal page's "Its ... start it." line is part of the page description. - Advanced settings is a ghost Button. - A run in progress says "Running now" on routine and goal pages.
1 parent 1c56401 commit 5288927

13 files changed

Lines changed: 536 additions & 380 deletions

‎CHANGELOG.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ Newest first. `Unreleased` is what is on `main` and not yet tagged.
4545
**Routines.**
4646

4747
- **Routines shows what is on and what is paused.** Each row has its own on/off switch and says
48-
when it runs next. A Bot's group heads with its name and "3 routines". A routine's page puts On,
49-
Run now and Edit beside its title, shows what it does first, and moves Delete to the bottom of the
50-
page. New routine fits on one screen: When is one line, and Done when, Posts in and Name are
48+
when it runs next, or "Paused" and when it would run. A Bot's group heads with its name and "3
49+
routines". A routine's page puts the switch and Edit beside its title, shows what it does first,
50+
and moves Delete to the bottom of the page. Every switch says On or Paused. New routine fits on one screen: When is one line, and Done when, Posts in and Name are
5151
under Advanced settings. Time zones show only when they differ from yours.
5252

5353
**Smaller addresses.**

‎app/src/components/responsibilities/goal-page.tsx‎

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export function GoalPage({
270270
goal.status === "completed" ? undefined : (
271271
<div className="flex shrink-0 items-center gap-2">
272272
<Switch
273-
aria-label="Active"
273+
aria-label="On"
274274
checked={goal.status === "active"}
275275
disabled={action.isPending}
276276
onCheckedChange={(active) =>
@@ -284,44 +284,57 @@ export function GoalPage({
284284
aria-hidden="true"
285285
className="-order-1 w-12 text-right text-muted-foreground text-sm"
286286
>
287-
{goal.status === "active" ? "Active" : "Paused"}
287+
{goal.status === "active" ? "On" : "Paused"}
288288
</span>
289-
<Button
290-
className="ml-2"
291-
aria-label="Run now"
292-
disabled={goal.status !== "active" || action.isPending}
293-
onClick={() => {
294-
// Bots can't run until a card is added: the dialog says why, in place of a run.
295-
if (stopIfNeedsCard()) return;
296-
action.mutate({ id: goal.id, action: "run" });
297-
}}
298-
size="sm"
299-
type="button"
300-
variant="outline"
301-
>
302-
<IconPlayerPlay />
303-
<span className="max-sm:sr-only">Run now</span>
304-
</Button>
305289
</div>
306290
)
307291
}
308-
description={summaryFor(goal, triggers.data, routines)}
292+
description={
293+
<>
294+
<span className="block">
295+
{summaryFor(goal, triggers.data, routines)}
296+
</span>
297+
{/* What starts it. A paused goal's summary already says nothing does. */}
298+
{goal.status === "active" ? (
299+
<span className="block">{`Its ${starters} start it.`}</span>
300+
) : null}
301+
</>
302+
}
309303
title={goal.title}
310304
>
311-
{/*
312-
* What starts it, then what else can be done to it. The page title names it, so this first
313-
* section has no heading.
314-
*/}
315-
<PageSection
316-
description={
317-
goal.status === "completed"
318-
? undefined
319-
: goal.status === "active"
320-
? `Its ${starters} start it.`
321-
: `Paused. Its ${starters} won't start it.`
322-
}
323-
>
305+
{/* What else can be done to it. The page title names it, so this first section has no heading. */}
306+
<PageSection>
324307
<PageRows>
308+
{goal.status === "active" ? (
309+
<>
310+
<Item
311+
render={
312+
<button
313+
disabled={action.isPending}
314+
onClick={() => {
315+
// Bots can't run until a card is added: the dialog says why, in place of a run.
316+
if (stopIfNeedsCard()) return;
317+
action.mutate({ id: goal.id, action: "run" });
318+
}}
319+
type="button"
320+
/>
321+
}
322+
size="sm"
323+
>
324+
<ItemMedia variant="icon">
325+
<IconPlayerPlay />
326+
</ItemMedia>
327+
<ItemContent>
328+
<ItemTitle>Run now</ItemTitle>
329+
<ItemDescription>
330+
Runs it now, for real. The Bot does the work and can post
331+
and take actions.
332+
</ItemDescription>
333+
</ItemContent>
334+
</Item>
335+
<Separator />
336+
</>
337+
) : null}
325338
{goal.status !== "completed" ? (
326339
<>
327340
<Item
@@ -597,7 +610,7 @@ export function GoalPage({
597610

598611
const RUN_LABEL: Record<string, string> = {
599612
queued: "Queued",
600-
running: "Running",
613+
running: "Running now",
601614
waiting: "Waiting for you",
602615
succeeded: "Succeeded",
603616
failed: "Failed",

0 commit comments

Comments
 (0)