import { createResource, createSignal, For, Show } from "solid-js"; import { api } from "../lib/api"; import { Citations } from "../components/Citations"; import { EmptyState } from "../components/ui"; const TYPES = ["morning-briefing", "accumulation-radar", "foreign-reversal", "insider-tape", "earnings-countdown", "dividend-calendar", "weekend-review"]; export default function Routines() { const [data, { refetch }] = createResource(() => api.routines()); const [runs, { refetch: refetchRuns }] = createResource(() => api.runs().then((r) => r.runs.slice(0, 20))); const [type_, setType] = createSignal("morning-briefing"); const [schedule, setSchedule] = createSignal(""); const [channels, setChannels] = createSignal(""); const [busy, setBusy] = createSignal(false); const [runNowId, setRunNowId] = createSignal(null); const [briefing] = createResource(() => api.briefing().catch(() => null)); async function subscribe() { setBusy(true); try { await api.createRoutine({ type: type_(), schedule_cron: schedule().trim() || undefined, channels: channels().split(",").map((c) => c.trim()).filter(Boolean), }); refetch(); } finally { setBusy(false); } } async function toggle(id: number, enabled: boolean) { await api.updateRoutine(id, { enabled: !enabled }); refetch(); } async function del(id: number) { await fetch(`/api/routines/${id}`, { method: "DELETE", headers: { "X-User-Key": localStorage.getItem("fs-key") || "demo" } }); refetch(); } return (

Routine Manager

Scheduled deliveries with citations.

Subscribe

setSchedule(e.currentTarget.value)} style={{ width: "240px" }} /> setChannels(e.currentTarget.value)} style={{ width: "200px" }} />
}>
{(r) => (
{r.type} {r.enabled ? "on" : "off"}

{r.schedule_cron}

)}

Latest briefing

No briefing yet — it generates after the first morning-briefing run.

}>
{(briefing() as { payload: string })?.payload?.slice(0, 800)}

Run history

    {(r) =>
  • {String(r.started_at)} — {String(r.status)}
  • }
); }