"use client"; import React from "react"; import { Star } from "lucide-react"; /** Field types added for feedback (also usable on attendee forms). */ export const EXTRA_FIELD_TYPES = ["rating", "multiple_choice"] as const; export const isExtraFieldType = (t: string) => (EXTRA_FIELD_TYPES as readonly string[]).includes(t); /** The choices of a multiple-choice field (stored as a JSON array of strings). */ export const fieldChoices = (field: { options?: unknown }): string[] => Array.isArray(field.options) ? field.options.map(String).filter(Boolean) : []; /** * Input for a rating (1–5 stars) or multiple-choice field. Values are strings, like every * other form answer: "1".."5" for a rating, the chosen option for multiple choice. */ export function ExtraFieldInput({ field, value, onChange, idPrefix = "f" }: { field: { id?: string; type: string; label: string; options?: unknown }; value: string; onChange: (v: string) => void; idPrefix?: string; }) { if (field.type === "rating") { const n = Number(value) || 0; return (