import { useServerFn } from "@tanstack/react-start" import { useId, useState } from "react" import { FormDialog, FormField, SelectField, fieldControl } from "@/components/primitives" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Textarea } from "@/components/ui/textarea" import { linkSchema, type Profile } from "./portal.contract" import { uploadPortalLogo } from "./portal.functions" export const EMPTY_PROFILE: Profile = { name: "", acronym: "", descriptionIt: "", descriptionEn: "", email: "", logo: null, links: [], } export const roleOptions = [ { value: "responsible", label: "Responsabile" }, { value: "collaborator", label: "Collaboratore" }, ] as const export const statusLabel = { pending: "Da registrare", active: "Attiva", suspended: "Sospesa", archived: "Archiviata", draft: "Bozza", submitted: "In revisione", changes: "Integrazioni richieste", approved: "Approvata", rejected: "Rifiutata", withdrawn: "Ritirata", registration: "Registrazione", access: "Accesso", membership: "Referenti", content: "Scheda pubblica", responsible: "Responsabile", collaborator: "Collaboratore", } export const panelClass = "rounded-xl border border-(--pn-line) bg-(--pn-surface) p-5 space-y-4" export function TextField({ label, value, onChange, multiline = false, hint, type = "text", maxLength = 20000, }: { label: string value: string onChange: (value: string) => void multiline?: boolean hint?: string type?: string maxLength?: number }) { const id = useId() return ( {multiline ? (