Address #125 review: memoized ink, one fallback color, reactive copy name
Build image / build-and-push (push) Successful in 10s
Build image / build-and-push (push) Successful in 10s
- monogramInk is memoized by color string; the canvas asks for every visible plop on every frame of a pan (Gadfly, 2/4 models). - FALLBACK_PLANT_COLOR lives in lib/plants and is used by the canvas, the inspector and the garden thumbnail instead of three raw '#97a97c's. - CopyDialog keeps its proposed "<base> — <year>" in step with the gardens list until the person edits the name, so a list that loads after the dialog opens can't leave a taken year in the field. - GardenCard: reflowed the summary comment; no dead fallback on a plan name that's already known to parse. - today() has one import path (lib/dates); the journal re-export is gone. - CLAUDE.md says what the inspector actually does (a text-compare guard) rather than claiming it uses LengthField. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
import { clampScale, type Point } from '@/lib/geometry'
|
||||
import { monogramInk } from '@/lib/monogram'
|
||||
import { useCreateObject, useCreatePlanting, useUpdateObject, useUpdatePlanting } from '@/lib/objects'
|
||||
import type { Plant } from '@/lib/plants'
|
||||
import { FALLBACK_PLANT_COLOR, type Plant } from '@/lib/plants'
|
||||
import type { EditorPlanting } from '@/lib/plantings'
|
||||
import { formatSize } from '@/lib/units'
|
||||
import { kindDef, objectStyle, rectRadius } from './kinds'
|
||||
@@ -35,10 +35,6 @@ import {
|
||||
import { useEditorStore, type Viewport } from './store'
|
||||
import type { EditorGarden, EditorObject } from './types'
|
||||
|
||||
// A plop whose plant is missing from the catalog (a shared garden's private
|
||||
// plant) still needs a color to be drawn in.
|
||||
const FALLBACK_PLANT_COLOR = '#97a97c'
|
||||
|
||||
const WHEEL_SENSITIVITY = 0.0016
|
||||
const ANIM_MS = 520
|
||||
const REFIT_THRESHOLD_PX = 60
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Tag } from '@/components/ui/Tag'
|
||||
import { Toggle } from '@/components/ui/Toggle'
|
||||
import { cn } from '@/lib/cn'
|
||||
import { useDeleteObject, useRemovePlanting, useUpdateObject, useUpdatePlanting } from '@/lib/objects'
|
||||
import type { Plant } from '@/lib/plants'
|
||||
import { FALLBACK_PLANT_COLOR, type Plant } from '@/lib/plants'
|
||||
import type { EditorPlanting } from '@/lib/plantings'
|
||||
import {
|
||||
cmFromSpacing,
|
||||
@@ -356,7 +356,7 @@ export function PlopInspector({
|
||||
return (
|
||||
<div ref={rootRef} className="flex flex-col gap-3">
|
||||
<div className="flex items-center gap-2.5">
|
||||
<ColorDot color={plant?.color ?? '#97a97c'} size={18} />
|
||||
<ColorDot color={plant?.color ?? FALLBACK_PLANT_COLOR} size={18} />
|
||||
<span className="min-w-0 truncate font-heading text-[17px]">{plant?.name ?? 'Unknown plant'}</span>
|
||||
{noteCount > 0 && (
|
||||
<button type="button" className="tag tag-accent-2 ml-auto cursor-pointer border-0" onClick={onNotes}>
|
||||
|
||||
@@ -4,9 +4,9 @@ import { Button, IconButton } from '@/components/ui/Button'
|
||||
import { TextAreaField, TextField } from '@/components/ui/Field'
|
||||
import { errorMessage } from '@/lib/api'
|
||||
import { cn } from '@/lib/cn'
|
||||
import { today } from '@/lib/dates'
|
||||
import {
|
||||
formatObservedAt,
|
||||
today,
|
||||
useCreateJournalEntry,
|
||||
useDeleteJournalEntry,
|
||||
useJournal,
|
||||
|
||||
Reference in New Issue
Block a user