// Prodz — Collab flow. Tapping "Collab" on a profile or person card opens a // chooser (brief: two distinct intents): // · Invita a un lavoro (Invite to job) — attach the job details, then send an // invitation tied to a Job Call conversation. // · Proposta di collaborazione (Collab proposal) — send a collaboration // request to the user plus a request to schedule a meeting. function CollabFlow({ person, onClose, onSubmit }) { const { L } = useL(); const { Button } = window.ProdzDesignSystem_d0b87b; const [mode, setMode] = useStateS('choose'); // choose | job | proposal const first = person && person.name ? person.name.split(' ')[0] : ''; // job invite fields const [role, setRole] = useStateS(''); const [dates, setDates] = useStateS(''); const [paid, setPaid] = useStateS(true); const [jobNote, setJobNote] = useStateS(''); // proposal fields const [proposalNote, setProposalNote] = useStateS(''); const [meetWhen, setMeetWhen] = useStateS(''); const meetOptions = [ { it: 'Questa settimana', en: 'This week' }, { it: 'Prossima settimana', en: 'Next week' }, { it: 'Videocall', en: 'Video call' }, ]; const now = { it: 'adesso', en: 'now' }; const sendJob = () => { const roleTxt = role.trim() || L('un ruolo nel team', 'a role on the team'); onSubmit({ id: 'conv-' + Date.now(), person: person.id, org: null, kind: 'job', subject: { it: 'Invito a un lavoro', en: 'Job invitation' }, unread: 0, time: now, preview: { it: 'Hai inviato un invito a un lavoro', en: 'You sent a job invitation' }, messages: [{ me: true, time: L('adesso', 'now'), text: { it: `Ciao ${first}! Vorrei invitarti per ${roleTxt}.`, en: `Hi ${first}! I'd like to invite you for ${roleTxt}.` }, card: { type: 'job', role: role.trim(), dates: dates.trim(), paid, note: jobNote.trim() }, }], }, L('Invito inviato · è nell’Inbox', 'Invitation sent · it’s in your Inbox')); }; const sendProposal = () => { const msg = proposalNote.trim(); const when = meetWhen || tr(L, meetOptions[0]); const messages = [{ me: true, time: L('adesso', 'now'), text: msg ? { it: msg, en: msg } : { it: `Ciao ${first}! Ti va di collaborare a un progetto insieme?`, en: `Hi ${first}! Would you like to collaborate on a project together?` }, }, { me: true, time: L('adesso', 'now'), text: { it: 'Ti va di fissare un incontro per parlarne?', en: 'Shall we set up a meeting to talk it through?' }, card: { type: 'meeting', when }, }]; onSubmit({ id: 'conv-' + Date.now(), person: person.id, org: null, kind: 'collab', subject: { it: 'Proposta di collaborazione', en: 'Collaboration proposal' }, unread: 0, time: now, preview: { it: 'Hai proposto una collaborazione e un incontro', en: 'You proposed a collaboration and a meeting' }, messages, }, L('Proposta inviata · è nell’Inbox', 'Proposal sent · it’s in your Inbox')); }; // ---- chooser ---- if (mode === 'choose') { return (
{L('Collabora con', 'Collaborate with')}
{person ? person.name : ''}
setMode('job')} /> setMode('proposal')} />
); } // ---- job invite form ---- if (mode === 'job') { return (
setMode('choose')} L={L} /> setRole(e.target.value)} placeholder={L('es. Gaffer, 2nd AC…', 'e.g. Gaffer, 2nd AC…')} style={cInput} /> setDates(e.target.value)} placeholder={L('es. 24 – 26 Mag', 'e.g. May 24 – 26')} style={cInput} />
{L('Retribuito', 'Paid')}