feat: shared back navigation on detail pages
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import { getContainer } from "@/modules/garden/server/queries";
|
||||
import { ContainerDetail } from "@/modules/garden/components/container-detail";
|
||||
import { DetailBackLink } from "@/components/detail-back-link";
|
||||
import { getShareLinksForEntity } from "@/modules/_core/share";
|
||||
import { ContainerDetail } from "@/modules/garden/components/container-detail";
|
||||
import { getContainer } from "@/modules/garden/server/queries";
|
||||
|
||||
export default async function ContainerPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
@@ -12,6 +13,7 @@ export default async function ContainerPage({ params }: { params: Promise<{ id:
|
||||
if (!container) notFound();
|
||||
return (
|
||||
<div className="page-content">
|
||||
<DetailBackLink href="/garden" label="Garden" className="mb-4" />
|
||||
<ContainerDetail container={container} shareLinks={shareLinks} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { DetailBackLink } from "@/components/detail-back-link";
|
||||
import { createContainer } from "@/modules/garden/server/actions";
|
||||
|
||||
export default function NewContainerPage() {
|
||||
@@ -14,21 +15,8 @@ export default function NewContainerPage() {
|
||||
|
||||
return (
|
||||
<div className="page-content max-w-lg">
|
||||
<div className="flex items-center gap-3 mb-1">
|
||||
<a href="/garden" className="btn btn-ghost btn-icon" aria-label="Back to garden">
|
||||
<svg
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
>
|
||||
<polyline points="15 18 9 12 15 6" />
|
||||
</svg>
|
||||
</a>
|
||||
<div className="mb-1 flex flex-col gap-2">
|
||||
<DetailBackLink href="/garden" label="Garden" />
|
||||
<h1 className="page-title">New container</h1>
|
||||
</div>
|
||||
<form action={handleCreate} className="flex flex-col gap-4 mt-4">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import { getPlant, listContainers } from "@/modules/garden/server/queries";
|
||||
import { DetailBackLink } from "@/components/detail-back-link";
|
||||
import { PlantForm } from "@/modules/garden/components/plant-form";
|
||||
import { getPlant, listContainers } from "@/modules/garden/server/queries";
|
||||
|
||||
export default async function EditPlantPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
@@ -9,6 +10,7 @@ export default async function EditPlantPage({ params }: { params: Promise<{ id:
|
||||
|
||||
return (
|
||||
<div className="page-content max-w-xl">
|
||||
<DetailBackLink href={`/garden/plants/${plant.id}`} label={plant.name} className="mb-3" />
|
||||
<h1 className="page-title">Edit Plant</h1>
|
||||
<PlantForm existingPlant={plant} containers={containers} />
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import { DetailBackLink } from "@/components/detail-back-link";
|
||||
import { getShareLinksForEntity } from "@/modules/_core/share";
|
||||
import { PlantDetail } from "@/modules/garden/components/plant-detail";
|
||||
import { listCalendars } from "@/modules/garden/server/calendar-bridge";
|
||||
import { getCareLogs, getCareSchedules, getPlant } from "@/modules/garden/server/queries";
|
||||
import { PlantDetail } from "@/modules/garden/components/plant-detail";
|
||||
import { getShareLinksForEntity } from "@/modules/_core/share";
|
||||
|
||||
export default async function PlantPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
@@ -17,6 +18,7 @@ export default async function PlantPage({ params }: { params: Promise<{ id: stri
|
||||
|
||||
return (
|
||||
<div className="page-content">
|
||||
<DetailBackLink href="/garden?tab=plants" label="Plants" className="mb-4" />
|
||||
<PlantDetail
|
||||
plant={plant}
|
||||
careLogs={careLogs}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { listContainers } from "@/modules/garden/server/queries";
|
||||
import { DetailBackLink } from "@/components/detail-back-link";
|
||||
import { PlantForm } from "@/modules/garden/components/plant-form";
|
||||
import { listContainers } from "@/modules/garden/server/queries";
|
||||
|
||||
export default async function NewPlantPage({
|
||||
searchParams,
|
||||
@@ -11,21 +12,8 @@ export default async function NewPlantPage({
|
||||
|
||||
return (
|
||||
<div className="page-content max-w-xl">
|
||||
<div className="flex items-center gap-3 mb-1">
|
||||
<a href="/garden" className="btn btn-ghost btn-icon" aria-label="Back to garden">
|
||||
<svg
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
>
|
||||
<polyline points="15 18 9 12 15 6" />
|
||||
</svg>
|
||||
</a>
|
||||
<div className="mb-1 flex flex-col gap-2">
|
||||
<DetailBackLink href="/garden?tab=plants" label="Plants" />
|
||||
<h1 className="page-title">Add Plant</h1>
|
||||
</div>
|
||||
<PlantForm containers={containers} defaultContainerId={params.containerId ?? null} />
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { eq } from "drizzle-orm";
|
||||
import { db } from "@/lib/db";
|
||||
import { getCurrentSession } from "@/lib/session";
|
||||
import { householdMembers, users } from "@/modules/_core/schema";
|
||||
import { DetailBackLink } from "@/components/detail-back-link";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { db } from "@/lib/db";
|
||||
import { getCurrentSession } from "@/lib/session";
|
||||
import { householdMembers, users } from "@/modules/_core/schema";
|
||||
import { renameHousehold } from "./actions";
|
||||
|
||||
export default async function HouseholdSettingsPage() {
|
||||
@@ -18,6 +19,7 @@ export default async function HouseholdSettingsPage() {
|
||||
|
||||
return (
|
||||
<div className="container max-w-2xl py-8 space-y-6">
|
||||
<DetailBackLink href="/settings" label="Settings" />
|
||||
<h1 className="text-2xl font-semibold">Household Settings</h1>
|
||||
|
||||
<Card>
|
||||
|
||||
Reference in New Issue
Block a user