Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
110 lines
3.1 KiB
TypeScript
110 lines
3.1 KiB
TypeScript
"use client";
|
|
|
|
import * as React from "react";
|
|
import { ChevronLeft, ChevronRight, RefreshCw } from "lucide-react";
|
|
import { Button } from "@/components/ui/button";
|
|
import { cn } from "@/lib/utils";
|
|
import {
|
|
viewLabel,
|
|
type CalendarView,
|
|
} from "@/components/calendar/calendar-month";
|
|
|
|
export interface CalendarToolbarProps {
|
|
view: CalendarView;
|
|
ref: Date;
|
|
loading: boolean;
|
|
onViewChange: (view: CalendarView) => void;
|
|
onPrev: () => void;
|
|
onNext: () => void;
|
|
onToday: () => void;
|
|
onRefresh: () => void;
|
|
}
|
|
|
|
const VIEWS: readonly { id: CalendarView; label: string }[] = [
|
|
{ id: "month", label: "Month" },
|
|
{ id: "week", label: "Week" },
|
|
];
|
|
|
|
/**
|
|
* Calendar controls: month/week toggle, previous/next/today navigation, the
|
|
* current period label, and a refresh button. Purely presentational; all state
|
|
* lives in {@link useCalendar}.
|
|
*/
|
|
export function CalendarToolbar({
|
|
view,
|
|
ref,
|
|
loading,
|
|
onViewChange,
|
|
onPrev,
|
|
onNext,
|
|
onToday,
|
|
onRefresh,
|
|
}: Readonly<CalendarToolbarProps>) {
|
|
return (
|
|
<div className="mb-4 flex flex-wrap items-center justify-between gap-3">
|
|
<div className="flex items-center gap-2">
|
|
<div className="flex items-center rounded-md border border-input p-0.5">
|
|
<Button
|
|
variant="ghost"
|
|
size="sm"
|
|
className="size-8 p-0"
|
|
aria-label="Previous"
|
|
onClick={onPrev}
|
|
>
|
|
<ChevronLeft className="size-4" aria-hidden />
|
|
</Button>
|
|
<Button
|
|
variant="ghost"
|
|
size="sm"
|
|
className="size-8 p-0"
|
|
aria-label="Next"
|
|
onClick={onNext}
|
|
>
|
|
<ChevronRight className="size-4" aria-hidden />
|
|
</Button>
|
|
</div>
|
|
<Button variant="outline" size="sm" onClick={onToday}>
|
|
Today
|
|
</Button>
|
|
{/* Locale-formatted on both server and browser; the visitor's locale wins. */}
|
|
<span className="ml-1 text-lg font-semibold tracking-tight" suppressHydrationWarning>
|
|
{viewLabel(view, ref)}
|
|
</span>
|
|
</div>
|
|
|
|
<div className="flex items-center gap-2">
|
|
<div className="flex items-center rounded-md border border-input p-0.5">
|
|
{VIEWS.map((option) => (
|
|
<button
|
|
key={option.id}
|
|
type="button"
|
|
onClick={() => onViewChange(option.id)}
|
|
aria-pressed={view === option.id}
|
|
className={cn(
|
|
"rounded px-3 py-1 text-sm font-medium transition-colors",
|
|
view === option.id
|
|
? "bg-secondary text-secondary-foreground"
|
|
: "text-muted-foreground hover:text-foreground",
|
|
)}
|
|
>
|
|
{option.label}
|
|
</button>
|
|
))}
|
|
</div>
|
|
<Button
|
|
variant="outline"
|
|
size="sm"
|
|
onClick={onRefresh}
|
|
disabled={loading}
|
|
>
|
|
<RefreshCw
|
|
className={loading ? "size-4 animate-spin" : "size-4"}
|
|
aria-hidden
|
|
/>
|
|
Refresh
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|