import { Link } from '@tanstack/react-router' import type { Garden } from '@/lib/gardens' import { formatDimensions } from '@/lib/units' import { cardActionClass, cardDangerClass } from '@/components/ui/cardActions' /** * One garden as a card: the body links into the editor. The footer differs by * role — the owner gets Share / Edit / Delete; a recipient sees a "shared · role" * badge and a Leave action (garden metadata edit + sharing are owner-only). * Ownership is the authoritative ownerId==me check, not the my_role hint. */ export function GardenCard({ garden, currentUserId, onShare, onEdit, onDelete, onLeave, }: { garden: Garden currentUserId?: number onShare: () => void onEdit: () => void onDelete: () => void onLeave: () => void }) { const owner = currentUserId != null && garden.ownerId === currentUserId return (
{formatDimensions(garden.widthCm, garden.heightCm, garden.unitPref)}
{garden.notes &&{garden.notes}
}