feat(work): scheduled tasks under Work mode#2134
Conversation
Fills the empty Work-mode placeholder with a non-engineer-friendly UI on top of the existing TaskAutomation backend. A scheduled task is a name, a free-text prompt, and a schedule preset — the agent picks the right skill at run time, no skill picker needed. Highlights: - Five schedule presets (hourly / daily / weekdays / Mondays / monthly) with computed next-run times shown per preset and per list row. - Empty state seeded with four clickable example prompts (audit flags, inbox summary, web analytics digest, LLM cost review) that prefill the editor. - "Open task" deep link from a scheduled task's last run — fetches via TaskService.openTask and swaps the app to Code mode. - Sends repository="" plus the user's detected IANA timezone so creates succeed against the current backend schema. - Status badge handles Paused / Healthy / Failed / Running / Cancelled / Active and renders inline last-run error callouts. Adds five PostHogAPIClient methods (list/create/update/delete + run), a Zustand store for view + pending-prompt state, schedule + timezone utilities, React Query hooks, and the components. Generated-By: PostHog Code Task-Id: 8370b362-c3fd-4abe-8f0e-9dc7ecd74257
fc06744 to
3c3628e
Compare
|
| import { Box, Flex, Text } from "@radix-ui/themes"; | ||
| import beachHog from "@renderer/assets/images/hedgehogs/beach-hog.png"; | ||
| import { WorkHomePrompt } from "./WorkHomePrompt"; | ||
| import { WorkSampleProjects } from "./WorkSampleProjects"; | ||
|
|
||
| export function WorkHome() { | ||
| return ( | ||
| <Box className="scrollbar-overlay-y h-full w-full overflow-y-auto"> | ||
| <Flex | ||
| direction="column" | ||
| align="center" | ||
| gap="6" | ||
| className="mx-auto w-full max-w-[680px] px-6 pt-16 pb-12" | ||
| > | ||
| <Flex | ||
| direction="column" | ||
| align="center" | ||
| gap="3" | ||
| className="work-enter work-enter-1" | ||
| > | ||
| <img | ||
| src={beachHog} | ||
| alt="" | ||
| className="h-28 w-auto select-none" | ||
| draggable={false} | ||
| /> | ||
| <Box className="text-center"> | ||
| <Text | ||
| as="div" | ||
| weight="medium" | ||
| className="text-(--gray-12) text-[22px]" | ||
| > | ||
| Hello normie, what can I do for you today? | ||
| </Text> | ||
| </Box> | ||
| </Flex> | ||
|
|
||
| <Box className="work-enter work-enter-2 w-full"> | ||
| <WorkHomePrompt /> | ||
| </Box> | ||
|
|
||
| <Box className="work-enter work-enter-3 w-full"> | ||
| <Text | ||
| as="div" | ||
| className="mb-2 text-center text-(--gray-10) text-[11px] uppercase tracking-wide" | ||
| > | ||
| Or if you're used to outsourcing your brain to Claude... | ||
| </Text> | ||
| <WorkSampleProjects /> | ||
| </Box> | ||
| </Flex> | ||
| </Box> | ||
| ); | ||
| } |
There was a problem hiding this comment.
Dead-code file — never rendered
WorkHome.tsx is a new file added in this PR, but WorkView.tsx still imports beachHog, WorkHomePrompt, and WorkSampleProjects directly and renders the home content inline — its default branch is unchanged and never mounts <WorkHome />. This violates simplicity rule 4 ("has no superfluous parts"). Either update WorkView's default branch to return <WorkHome />; and remove the duplicated inline JSX, or delete this file until the refactor is intentional.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/work/components/WorkHome.tsx
Line: 1-54
Comment:
**Dead-code file — never rendered**
`WorkHome.tsx` is a new file added in this PR, but `WorkView.tsx` still imports `beachHog`, `WorkHomePrompt`, and `WorkSampleProjects` directly and renders the home content inline — its default branch is unchanged and never mounts `<WorkHome />`. This violates simplicity rule 4 ("has no superfluous parts"). Either update `WorkView`'s default branch to `return <WorkHome />;` and remove the duplicated inline JSX, or delete this file until the refactor is intentional.
How can I resolve this? If you propose a fix, please make it concise.
Summary
Adds a Scheduled section to PostHog Work, on top of the existing
TaskAutomationbackend. Wires the sidebar's previously-static Automations entry into a real list + editor, with a non-engineer-friendly UX.useMcpServers(), with brand icons. Selected sources are persisted as a[Sources: github, slack]prefix on the prompt (stopgap until the backend grows a first-class field).Plugs into the existing
workViewstate innavigationStore(addsscheduled-listandscheduled-edit, plus matching nav actions). Pure additions toWorkSidebarMenu(renames "Automations" → "Scheduled", wires its click) andWorkView(new routing branches).Known stopgaps
repository: "posthog-work"sentinel is sent because the currentTaskAutomation.repositoryfield is required + non-blank. Backend ticket needed to make it nullable for Work-mode tasks.[Sources: …]header. Works today (agent treats it as advisory). Backend ticket needed for a first-classmcp_sources: string[]field.Test plan