fix: imports

This commit is contained in:
Austin Pickett 2026-04-19 18:52:04 -04:00
parent 60fd4b7d16
commit 823b6d08ed
11 changed files with 2127 additions and 146 deletions

View file

@ -1,6 +1,6 @@
import { useEffect, useState } from "react";
import { Clock, Pause, Play, Plus, Trash2, Zap } from "lucide-react";
import { H2 } from "@nous-research/ui/ui/components/typography/h2";
import { H2 } from "@nous-research/ui";
import { api } from "@/lib/api";
import type { CronJob } from "@/lib/api";
import { useToast } from "@/hooks/useToast";
@ -83,10 +83,16 @@ export default function CronPage() {
const isPaused = job.state === "paused";
if (isPaused) {
await api.resumeCronJob(job.id);
showToast(`${t.cron.resume}: "${job.name || job.prompt.slice(0, 30)}"`, "success");
showToast(
`${t.cron.resume}: "${job.name || job.prompt.slice(0, 30)}"`,
"success",
);
} else {
await api.pauseCronJob(job.id);
showToast(`${t.cron.pause}: "${job.name || job.prompt.slice(0, 30)}"`, "success");
showToast(
`${t.cron.pause}: "${job.name || job.prompt.slice(0, 30)}"`,
"success",
);
}
loadJobs();
} catch (e) {
@ -97,7 +103,10 @@ export default function CronPage() {
const handleTrigger = async (job: CronJob) => {
try {
await api.triggerCronJob(job.id);
showToast(`${t.cron.triggerNow}: "${job.name || job.prompt.slice(0, 30)}"`, "success");
showToast(
`${t.cron.triggerNow}: "${job.name || job.prompt.slice(0, 30)}"`,
"success",
);
loadJobs();
} catch (e) {
showToast(`${t.status.error}: ${e}`, "error");
@ -107,7 +116,10 @@ export default function CronPage() {
const handleDelete = async (job: CronJob) => {
try {
await api.deleteCronJob(job.id);
showToast(`${t.common.delete}: "${job.name || job.prompt.slice(0, 30)}"`, "success");
showToast(
`${t.common.delete}: "${job.name || job.prompt.slice(0, 30)}"`,
"success",
);
loadJobs();
} catch (e) {
showToast(`${t.status.error}: ${e}`, "error");
@ -175,16 +187,30 @@ export default function CronPage() {
value={deliver}
onValueChange={(v) => setDeliver(v)}
>
<SelectOption value="local">{t.cron.delivery.local}</SelectOption>
<SelectOption value="telegram">{t.cron.delivery.telegram}</SelectOption>
<SelectOption value="discord">{t.cron.delivery.discord}</SelectOption>
<SelectOption value="slack">{t.cron.delivery.slack}</SelectOption>
<SelectOption value="email">{t.cron.delivery.email}</SelectOption>
<SelectOption value="local">
{t.cron.delivery.local}
</SelectOption>
<SelectOption value="telegram">
{t.cron.delivery.telegram}
</SelectOption>
<SelectOption value="discord">
{t.cron.delivery.discord}
</SelectOption>
<SelectOption value="slack">
{t.cron.delivery.slack}
</SelectOption>
<SelectOption value="email">
{t.cron.delivery.email}
</SelectOption>
</Select>
</div>
<div className="flex items-end">
<Button onClick={handleCreate} disabled={creating} className="w-full">
<Button
onClick={handleCreate}
disabled={creating}
className="w-full"
>
<Plus className="h-3 w-3" />
{creating ? t.common.creating : t.common.create}
</Button>
@ -196,7 +222,10 @@ export default function CronPage() {
{/* Jobs list */}
<div className="flex flex-col gap-3">
<H2 variant="sm" className="flex items-center gap-2 text-muted-foreground">
<H2
variant="sm"
className="flex items-center gap-2 text-muted-foreground"
>
<Clock className="h-4 w-4" />
{t.cron.scheduledJobs} ({jobs.length})
</H2>
@ -216,7 +245,9 @@ export default function CronPage() {
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2 mb-1">
<span className="font-medium text-sm truncate">
{job.name || job.prompt.slice(0, 60) + (job.prompt.length > 60 ? "..." : "")}
{job.name ||
job.prompt.slice(0, 60) +
(job.prompt.length > 60 ? "..." : "")}
</span>
<Badge variant={STATUS_VARIANT[job.state] ?? "secondary"}>
{job.state}
@ -227,16 +258,23 @@ export default function CronPage() {
</div>
{job.name && (
<p className="text-xs text-muted-foreground truncate mb-1">
{job.prompt.slice(0, 100)}{job.prompt.length > 100 ? "..." : ""}
{job.prompt.slice(0, 100)}
{job.prompt.length > 100 ? "..." : ""}
</p>
)}
<div className="flex items-center gap-4 text-xs text-muted-foreground">
<span className="font-mono">{job.schedule_display}</span>
<span>{t.cron.last}: {formatTime(job.last_run_at)}</span>
<span>{t.cron.next}: {formatTime(job.next_run_at)}</span>
<span>
{t.cron.last}: {formatTime(job.last_run_at)}
</span>
<span>
{t.cron.next}: {formatTime(job.next_run_at)}
</span>
</div>
{job.last_error && (
<p className="text-xs text-destructive mt-1">{job.last_error}</p>
<p className="text-xs text-destructive mt-1">
{job.last_error}
</p>
)}
</div>
@ -246,7 +284,9 @@ export default function CronPage() {
variant="ghost"
size="icon"
title={job.state === "paused" ? t.cron.resume : t.cron.pause}
aria-label={job.state === "paused" ? t.cron.resume : t.cron.pause}
aria-label={
job.state === "paused" ? t.cron.resume : t.cron.pause
}
onClick={() => handlePauseResume(job)}
>
{job.state === "paused" ? (