The plant-type CREATE schema rejected toxicToPets: null (the dialog's 'Unknown'), failing every manually-entered type with 'expected boolean, received null' — now nullable like the PATCH schema always was. New ROOT_VEGETABLE PlantCategory (enum migration + labels/order). Garden brain gains Sweet potato (slips in June, dig before frost, warm cure), and knowledgeFor/tipsForMonth now prefer the most specific name match so 'Japanese sweet potato' gets sweet-potato advice instead of Potato's nightshade rotation and hilling (regression-tested). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
57 lines
1.5 KiB
TypeScript
57 lines
1.5 KiB
TypeScript
import { PlantCategory, PlantLogType } from "@prisma/client";
|
|
|
|
export const CATEGORY_LABELS: Record<PlantCategory, string> = {
|
|
CANOPY_TREE: "Canopy tree",
|
|
UNDERSTORY_TREE: "Understory tree",
|
|
LARGE_SHRUB: "Large shrub",
|
|
SHRUB: "Shrub",
|
|
HERB: "Herb",
|
|
GROUNDCOVER: "Groundcover",
|
|
VINE: "Vine",
|
|
ANNUAL_VEGETABLE: "Annual vegetable",
|
|
ROOT_VEGETABLE: "Root vegetable",
|
|
ANNUAL: "Annual vegetable",
|
|
ANNUAL_FLOWER: "Annual flower",
|
|
PERENNIAL: "Perennial",
|
|
PERENNIAL_FLOWER: "Perennial flower",
|
|
BULB: "Bulb",
|
|
MUSHROOM: "Mushroom",
|
|
OTHER: "Other",
|
|
};
|
|
|
|
export const CATEGORY_ORDER: PlantCategory[] = [
|
|
"CANOPY_TREE",
|
|
"UNDERSTORY_TREE",
|
|
"LARGE_SHRUB",
|
|
"SHRUB",
|
|
"HERB",
|
|
"GROUNDCOVER",
|
|
"VINE",
|
|
"PERENNIAL",
|
|
"PERENNIAL_FLOWER",
|
|
"ANNUAL_VEGETABLE",
|
|
"ROOT_VEGETABLE",
|
|
"ANNUAL_FLOWER",
|
|
"BULB",
|
|
"MUSHROOM",
|
|
"OTHER",
|
|
];
|
|
|
|
export const LOG_TYPE_LABELS: Record<PlantLogType, string> = {
|
|
OBSERVATION: "Observation",
|
|
CARE: "Care",
|
|
HARVEST: "Harvest",
|
|
TREATMENT: "Treatment",
|
|
TRANSPLANT: "Transplanted",
|
|
DIED: "Died / removed",
|
|
};
|
|
|
|
export const LOG_TYPE_COLORS: Record<PlantLogType, string> = {
|
|
OBSERVATION: "text-blue-600 dark:text-blue-400",
|
|
CARE: "text-[hsl(var(--leaf))]",
|
|
HARVEST: "text-amber-600 dark:text-amber-400",
|
|
TREATMENT: "text-orange-600 dark:text-orange-400",
|
|
TRANSPLANT: "text-purple-600 dark:text-purple-400",
|
|
DIED: "text-destructive",
|
|
};
|