// SONARA — Manager "Invita nel roster" modal // Mount once per page. Open with window.openInviteModal(artist). const IIcons = window.SonaraIcons; const INVITE_TEMPLATES = [ { label: "Default", text: "Ciao {name}, ho seguito la tua crescita su Sonara e penso che potremmo costruire un percorso interessante insieme. Mi piacerebbe parlarne con te — quando hai un po' di tempo possiamo sentirci." }, { label: "Già fan", text: "Ciao {name}, sono fan di quello che stai facendo — soprattutto delle ultime tracce. Sto cercando 1-2 nuovi artisti per il mio roster e ho l'impressione che con te ci sia un buon match. Ti va di sentirci?" }, { label: "Per progetto", text: "Ciao {name}, ti scrivo per una proposta più specifica: vorrei supportarti come manager per il prossimo singolo / EP. Niente impegno a lungo termine, vediamo come si lavora insieme." }, ]; function InviteHost() { const [artist, setArtist] = React.useState(null); const [stage, setStage] = React.useState("form"); // form | success const [relation, setRelation] = React.useState("Esclusiva"); const [tplIdx, setTplIdx] = React.useState(0); const [msg, setMsg] = React.useState(""); // open via custom event React.useEffect(() => { const handler = (e) => { const a = e.detail; setArtist(a); setStage("form"); setRelation("Esclusiva"); setTplIdx(0); const t = INVITE_TEMPLATES[0].text.replace("{name}", a?.name?.split(" ")[0] || ""); setMsg(t); }; window.addEventListener("sonara:open-invite", handler); return () => window.removeEventListener("sonara:open-invite", handler); }, []); // ESC to close React.useEffect(() => { if (!artist) return; const k = (e) => { if (e.key === "Escape") setArtist(null); }; document.addEventListener("keydown", k); return () => document.removeEventListener("keydown", k); }, [artist]); if (!artist) return null; const onTpl = (i) => { setTplIdx(i); setMsg(INVITE_TEMPLATES[i].text.replace("{name}", artist?.name?.split(" ")[0] || "")); }; const chars = msg.length; const valid = chars >= 50 && chars <= 500; const remain = 500 - chars; return (
setArtist(null)}>
e.stopPropagation()}> {stage === "form" && ( <>
Invita nel roster
{/* Artist summary */}
{artist.init}
{artist.name}
{artist.handle} · {artist.city || ""}
{artist.hasManager && (
Già rappresentato da {artist.currentMgr} — potrai inviare l'invito ma l'artista dovrà sciogliere il vincolo esclusivo prima di accettare.
)} {artist.looking && (
Questo artista sta cercando un manager.
)}
{/* Relation type */}
{[ { v: "Esclusiva", t: "Esclusiva", s: "L'artista può avere solo te come manager attivo." }, { v: "Non-esclusiva", t: "Non-esclusiva", s: "L'artista può lavorare anche con altri manager in parallelo." }, { v: "Project-based", t: "Project-based", s: "Solo per uno specifico progetto (singolo, EP, tour)." }, ].map(o => ( ))}
{/* Message */}
{INVITE_TEMPLATES.map((t, i) => ( ))}