- calendar-bridge.ts and lists-bridge.ts isolate cross-module deps
- scheduleOnCalendar action: creates event from care schedule with 30-min
slot, title convention (Water/Fertilize/Repot/Prune/custom), reminder opt
- pushOverdueToTaskList action: inserts one task per overdue (plant+schedule)
pair into the default task list, skips duplicate text entries
- CareScheduleEditor: per-row calendar 📅 button opens inline form with
calendar select + optional reminder minutes + success link to /calendar
- Garden page header: PushOverdueButton with auto-dismissing feedback toast
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import Link from "next/link";
|
|
import { listContainers, listPlants } from "@/modules/garden/server/queries";
|
|
import { ContainerList } from "@/modules/garden/components/container-list";
|
|
import { PlantList } from "@/modules/garden/components/plant-list";
|
|
import { PushOverdueButton } from "@/modules/garden/components/push-overdue-button";
|
|
|
|
type Props = {
|
|
searchParams: Promise<{ tab?: string }>;
|
|
};
|
|
|
|
export default async function GardenPage({ searchParams }: Props) {
|
|
const { tab = "containers" } = await searchParams;
|
|
const isPlants = tab === "plants";
|
|
|
|
const [containers, plants] = await Promise.all([
|
|
listContainers(),
|
|
isPlants ? listPlants() : Promise.resolve([]),
|
|
]);
|
|
|
|
return (
|
|
<div className="page-content">
|
|
<div className="flex items-center justify-between mb-1">
|
|
<h1 className="page-title mb-0">Garden</h1>
|
|
<PushOverdueButton />
|
|
</div>
|
|
|
|
<div className="flex gap-6 border-b border-[var(--ink-faint)] mb-6">
|
|
<Link
|
|
href="/garden?tab=containers"
|
|
className={`pb-2 text-sm font-medium transition-colors ${
|
|
!isPlants
|
|
? "border-b-2 border-[var(--ink)] text-[var(--ink)]"
|
|
: "text-[var(--ink-mute)]"
|
|
}`}
|
|
>
|
|
Containers
|
|
</Link>
|
|
<Link
|
|
href="/garden?tab=plants"
|
|
className={`pb-2 text-sm font-medium transition-colors ${
|
|
isPlants ? "border-b-2 border-[var(--ink)] text-[var(--ink)]" : "text-[var(--ink-mute)]"
|
|
}`}
|
|
>
|
|
Plants
|
|
</Link>
|
|
</div>
|
|
|
|
{isPlants ? <PlantList plants={plants} /> : <ContainerList containers={containers} />}
|
|
</div>
|
|
);
|
|
}
|