Grapevine_Disease_Detection/vineye-admin/app/(admin)/guides/[id]/edit/page.tsx
Yanis 720dd34fdd add MyPlantsScreen + ScanDetailScreen + enriched admin + API mobile + project summary
Mobile:
- Replace LibraryScreen with MyPlantsScreen (date-grouped scan list, swipe actions, search, pull-to-refresh)
- Add ScanDetailScreen (immersive hero, confidence bar, cepage card, share/delete)
- Add DiseaseDetailScreen + GuideDetailScreen (hero pattern, animated entry)
- Add useScanDetail, useHistory (useCallback fix), dateGrouping utility
- Connect diseases/guides to admin API with cache + offline fallback
- Add NetworkContext, ToastContext, Skeleton loading components
- Extend ScanRecord type (isFavorite, location)
- Full i18n FR/EN for all new screens

Admin (vineye-admin):
- Enrich Disease/Guide Prisma schema (timeline, conditions, actions, sections)
- Enriched disease-form (7 sections) + guide-form (structured sections editor)
- Add mobile public API endpoints (diseases, guides by slug)
- Add Prisma migration + enriched seed data
- UI polish: sidebar, login, layout updates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 03:19:39 +02:00

51 lines
1.3 KiB
TypeScript

import { notFound } from "next/navigation";
import { prisma } from "@/lib/prisma";
import GuideForm from "@/components/admin/guide-form";
export default async function EditGuidePage({
params,
}: {
params: Promise<{ id: string }>;
}) {
const { id } = await params;
const guide = await prisma.guide.findUnique({
where: { id },
include: { sections: { orderBy: { order: "asc" } } },
});
if (!guide) notFound();
return (
<GuideForm
mode="edit"
initialData={{
id: guide.id,
title: guide.title,
titleEn: guide.titleEn,
subtitle: guide.subtitle,
subtitleEn: guide.subtitleEn,
content: guide.content,
contentEn: guide.contentEn,
category: guide.category,
iconName: guide.iconName,
iconColor: guide.iconColor,
bgColor: guide.bgColor,
published: guide.published,
order: guide.order,
readTime: guide.readTime,
coverImage: guide.coverImage,
sections: guide.sections.map((s) => ({
title: s.title,
titleEn: s.titleEn ?? "",
body: s.body,
bodyEn: s.bodyEn ?? "",
image: s.image ?? "",
tip: s.tip ?? "",
tipEn: s.tipEn ?? "",
order: s.order,
})),
}}
/>
);
}