🍅 move pomodoro start/finish buttons into PageHeader actions
Browse files at this commitaec4c7037cf6f7faf55991a342a20afb8ebaed80Parent: 9377421- refactor
- 🍅 move pomodoro start/finish buttons into PageHeader actions
1 changed file +20 -13
- src/pages/pomodoro-page.tsx +20 -13
src/pages/pomodoro-page.tsxmodified+20 -13
| @@ -65,7 +65,26 @@ function PomodoroContent() { | ||
| 65 | 65 | |
| 66 | 66 | return ( |
| 67 | 67 | <div class="space-y-6"> |
| 68 | - <PageHeader accent="mint" eyebrow={t("nav.pomodoro")} title={t("pomodoro.title")} description={t("pomodoro.subtitle")} /> | |
| 68 | + <PageHeader | |
| 69 | + accent="mint" | |
| 70 | + eyebrow={t("nav.pomodoro")} | |
| 71 | + title={t("pomodoro.title")} | |
| 72 | + description={t("pomodoro.subtitle")} | |
| 73 | + actions={ | |
| 74 | + <Show | |
| 75 | + when={running()} | |
| 76 | + fallback={ | |
| 77 | + <Button type="button" size="sm" class="min-w-[7.5rem] rounded-lg" disabled={pending()} onClick={() => void run(postPomodoroStart, t("pomodoro.started"))}> | |
| 78 | + {t("pomodoro.start")} | |
| 79 | + </Button> | |
| 80 | + } | |
| 81 | + > | |
| 82 | + <Button type="button" size="sm" variant="outline" class="min-w-[7.5rem] rounded-lg" disabled={pending()} onClick={() => void run(postPomodoroFinish, t("pomodoro.finished"))}> | |
| 83 | + {t("pomodoro.finish")} | |
| 84 | + </Button> | |
| 85 | + </Show> | |
| 86 | + } | |
| 87 | + /> | |
| 69 | 88 | |
| 70 | 89 | <Show when={flash()}> |
| 71 | 90 | <Alert variant="success">{flash()}</Alert> |
| @@ -83,18 +102,6 @@ function PomodoroContent() { | ||
| 83 | 102 | <Badge variant={running() ? "default" : "secondary"} class="rounded-sm"> |
| 84 | 103 | {running() ? t("pomodoro.running") : t("pomodoro.idle")} |
| 85 | 104 | </Badge> |
| 86 | - <Show | |
| 87 | - when={running()} | |
| 88 | - fallback={ | |
| 89 | - <Button type="button" size="sm" class="rounded-sm" disabled={pending()} onClick={() => void run(postPomodoroStart, t("pomodoro.started"))}> | |
| 90 | - {t("pomodoro.start")} | |
| 91 | - </Button> | |
| 92 | - } | |
| 93 | - > | |
| 94 | - <Button type="button" size="sm" variant="outline" class="rounded-sm" disabled={pending()} onClick={() => void run(postPomodoroFinish, t("pomodoro.finished"))}> | |
| 95 | - {t("pomodoro.finish")} | |
| 96 | - </Button> | |
| 97 | - </Show> | |
| 98 | 105 | </div> |
| 99 | 106 | </div> |
| 100 | 107 | </section> |