import { useState } from "react"; import { useMutation, useQueryClient } from "@tanstack/react-query"; import type { Orbit } from "../../api"; import { createOrbit, runOrbit } from "../../api"; import { DECAY_PRESETS, schedulePhrase } from "../../lib/format"; import { Button } from "../ui/Button"; import { OrbitStatusDot } from "../ui/StatusDot"; import { TelemetryPanel } from "../ui/Telemetry"; import { Hint } from "../ui/EmptyState"; export function OrbitsView({ orbits }: { orbits: Orbit[] }) { const [editing, setEditing] = useState(false); const qc = useQueryClient(); const [name, setName] = useState("nightly-docs"); const [path, setPath] = useState("./docs"); const [preset, setPreset] = useState(DECAY_PRESETS[0].id); const [rehearse, setRehearse] = useState(false); const [schedule, setSchedule] = useState("0 2 * * *"); const create = useMutation({ mutationFn: () => createOrbit({ name, provider: "filesystem", paths: [path], schedule: schedule || undefined, decay_preset: preset, dry_run: rehearse, }), onSuccess: () => { qc.invalidateQueries({ queryKey: ["orbits"] }); setEditing(false); }, }); const run = useMutation({ mutationFn: (id: string) => runOrbit(id), onSuccess: () => qc.invalidateQueries({ queryKey: ["orbits", "snapshots"] }), }); return (

Orbits

Scheduled circles around your vault — not cron jargon in the headline.

{orbits.map((o) => (

{o.name}

{schedulePhrase(o.schedule, o.dry_run)}

{o.dry_run && ( Rehearse mode )}
{JSON.stringify(o, null, 2)}
))}
{editing ? (

New orbit

Rehearse orbits prove the path without writing to the vault — status shows amber “rehearsed”.
) : ( )}
); } // fix motion.collapse - use div