diff --git a/src/app/admin/impostazioni/page.tsx b/src/app/admin/impostazioni/page.tsx index 98d2cf9..70d98af 100644 --- a/src/app/admin/impostazioni/page.tsx +++ b/src/app/admin/impostazioni/page.tsx @@ -19,8 +19,8 @@ export default async function ImpostazioniPage() {

Impostazioni

-
-
+
+

Analytics Profittabilità

diff --git a/src/components/admin/impostazioni/PoolManager.tsx b/src/components/admin/impostazioni/PoolManager.tsx index cae297c..d38f712 100644 --- a/src/components/admin/impostazioni/PoolManager.tsx +++ b/src/components/admin/impostazioni/PoolManager.tsx @@ -1,7 +1,7 @@ "use client"; import { useState, useTransition } from "react"; -import { X } from "lucide-react"; +import { X, Plus } from "lucide-react"; export function PoolManager({ label, @@ -18,6 +18,8 @@ export function PoolManager({ const [isPending, startTransition] = useTransition(); const [error, setError] = useState(null); + const canAdd = input.trim().length > 0; + function handleAdd() { const trimmed = input.trim(); if (!trimmed) return; @@ -48,52 +50,68 @@ export function PoolManager({ } return ( -
-

{label}

- -
- {pool.length === 0 && ( - Nessun valore +
+
+

{label}

+ {pool.length > 0 && ( + {pool.length} )} - {pool.map((v) => ( - - {v} - - - ))}
-
+
+ {pool.length === 0 ? ( + Nessun valore + ) : ( + pool.map((v) => ( + + {v} + + + )) + )} +
+ +
{ setInput(e.target.value); setError(null); }} + onChange={(e) => { + setInput(e.target.value); + setError(null); + }} onKeyDown={onKeyDown} - placeholder="Aggiungi..." + placeholder="Aggiungi valore" disabled={isPending} - className="border border-[#e5e7eb] rounded-lg px-3 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#1A463C]/20 flex-1 min-w-0 disabled:opacity-50" + aria-label={`Aggiungi valore a ${label}`} + className="h-8 w-full rounded-md border border-[#e5e7eb] bg-white pl-3 pr-9 text-sm text-[#1a1a1a] placeholder:text-[#a1a1aa] transition-shadow focus:border-[#1A463C]/30 focus:outline-none focus:ring-2 focus:ring-[#1A463C]/15 disabled:opacity-50" />
- {error &&

{error}

} + {error &&

{error}

}
); } diff --git a/src/components/admin/impostazioni/TaxonomyManager.tsx b/src/components/admin/impostazioni/TaxonomyManager.tsx index 19d7c17..1937e4b 100644 --- a/src/components/admin/impostazioni/TaxonomyManager.tsx +++ b/src/components/admin/impostazioni/TaxonomyManager.tsx @@ -1,5 +1,6 @@ "use client"; +import { Tag, BookOpen } from "lucide-react"; import { PoolManager } from "./PoolManager"; import { addTaxonomyValue, removeTaxonomyValue } from "@/app/admin/impostazioni/actions"; @@ -19,11 +20,13 @@ const CATALOG_FIELDS: FieldDef[] = [ ]; function Section({ + icon, title, subtitle, fields, pools, }: { + icon: React.ReactNode; title: string; subtitle: string; fields: FieldDef[]; @@ -31,9 +34,17 @@ function Section({ }) { return (
-

{title}

-

{subtitle}

-
+
+
+ {icon} +
+
+

{title}

+

{subtitle}

+
+
+ +
{fields.map((f) => ( }) { return ( - <> +
} title="Tassonomie Offerte" - subtitle="Valori disponibili nei campi Categoria, Ticket, Tipo e Obiettivo dell'editor offerte." + subtitle="Valori dei campi Categoria, Ticket, Tipo e Obiettivo dell'editor offerte." fields={OFFER_FIELDS} pools={pools} />
} title="Tassonomie Catalogo" - subtitle="Valori disponibili nei campi Fase, Offerta e Pacchetto del catalogo servizi." + subtitle="Valori dei campi Fase, Offerta e Pacchetto del catalogo servizi." fields={CATALOG_FIELDS} pools={pools} /> - +

+ I valori si sincronizzano ovunque: creandone uno dall'editor offerte o dal catalogo + comparirà qui automaticamente. Eliminando un valore da qui viene rimosso ovunque sia usato. +

+
); }