"use client"; /** Lightweight page-level properties (tags, status, due) — database rows use the full engine. */ import { useState } from "react"; import { Tag, Plus, X } from "lucide-react"; export function PageProperties({ page, onChange }: { page: any; onChange: (props: Record) => void }) { const [props, setProps] = useState>(page.properties ?? {}); const tags: string[] = props.tags ?? []; // merge into the freshest server copy so sibling editors (research panel status, etc.) are not overwritten const set = async (p: Record) => { let base = props; try { const fresh = await fetch(`/api/pages/${page.id}`).then((r) => r.json()); if (fresh?.properties) base = fresh.properties; } catch {} const n = { ...base, ...p }; setProps(n); onChange(n); }; if (page.databaseId) return null; return (
{tags.map((t) => {t})}
); }