/* ============================================================ Projects tile โ€” a Collection (Diligence, Contracts) is a project whose data products are grouped into SECTIONS via the accordion side menu (same rail as Model/Slides). Right pane = the selected DP as a card. These DPs are "empty" placeholders: the status is editable and the body prompts "Click to add content". ============================================================ */ // Eyebrow = the canonical unique DP id (window.dpId), NOT a section-coded // prefix โ€” so a diligence "financial" request can't collide with a finance // hub artifact, and Claude can reference any DP unambiguously. function CollectionsPanel() { var dil = (window.DILIGENCE || { sections: [] }).sections || []; var COLLECTIONS = { diligence: { label: 'Diligence', count: (window.DILIGENCE && window.DILIGENCE.stats && window.DILIGENCE.stats.items) || 85, sections: dil.map(function (s) { return { id: s.key, name: s.name, items: (s.items || []).map(function (it) { var dkey = 'dil_' + s.key + '_' + it.n; return { key: dkey, num: window.dpId(dkey), name: it.request, section: s.name, status: it.status || 'Requested' }; }) }; }), }, contracts: { label: 'Contracts', count: 2, sections: [{ id: 'contracts', name: 'Contracts', items: [ { key: 'con_register', num: window.dpId('con_register'), name: 'Tabular Review', section: 'Contracts', status: 'Published' }, { key: 'con_expiry', num: window.dpId('con_expiry'), name: 'Contract Expiration Schedule', section: 'Contracts', status: 'Published' }, ] }], }, }; var ORDER = ['diligence', 'contracts']; var C = { ink: 'var(--fg-dark)', base: 'var(--fg-base)', muted: 'var(--fg-muted)', line: 'var(--border-subtle, rgba(38,24,17,0.10))' }; var _c = React.useState('diligence'); var coll = _c[0], setColl = _c[1]; var active = COLLECTIONS[coll]; var _sel = React.useState(active.sections[0] && active.sections[0].id); var selSec = _sel[0], setSelSec = _sel[1]; var _st = React.useState({}); var statuses = _st[0], setStatuses = _st[1]; // {itemKey: status} var _canvas = React.useState(false); var canvasOpen = _canvas[0], setCanvasOpen = _canvas[1]; React.useEffect(function () { setSelSec(active.sections[0] && active.sections[0].id); }, [coll]); // Register a drawer record for each item into the CX_DASH `recordContent` // registry, so clicking a card opens the SAME drawer as the finance cards // (empty/compose state for these placeholder requests). React.useEffect(function () { var recs = {}; active.sections.forEach(function (sec) { sec.items.forEach(function (it) { var title = String(it.name).replace(/&/g, '&').replace(//g, '>'); recs[it.key] = { crumb: it.name, html: '
' + '
' + active.label + ' ยท ' + sec.name + '
' + '

' + title + '

' + '
' + '
This request is empty
' + '
' + 'Add content โ€” upload the requested document, or ask Claude to draft it from the model. Once it has content, it becomes a data product like the rest.
', }; }); }); try { var sc = document.createElement('script'); sc.textContent = 'try{ if(typeof recordContent!=="undefined") Object.assign(recordContent, ' + JSON.stringify(recs) + '); }catch(e){}'; document.body.appendChild(sc); document.body.removeChild(sc); } catch (e) { /* no-op */ } }, [coll]); var section = active.sections.find(function (s) { return s.id === selSec; }) || active.sections[0]; var statusOf = function (it) { return statuses[it.key] || it.status; }; var setStatus = function (key, s) { setStatuses(function (m) { var n = Object.assign({}, m); n[key] = s; return n; }); }; function Chip(key) { var c = COLLECTIONS[key]; var on = key === coll; return ( ); } return (
{ORDER.map(Chip)}
{section && section.items.map(function (it) { var itm = Object.assign({}, it, { status: statusOf(it) }); return ; })}
); } window.CollectionsPanel = CollectionsPanel;