fix: migrate rNetwork components to theme variables for dark/light mode

Replace 60+ hardcoded hex colors in folk-graph-viewer and folk-crm-view
with var(--rs-*) CSS variables. Add city/location data to graph API query
so graph nodes show the same location info as the CRM view.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-04 15:12:58 -08:00
parent ebecfe4983
commit 497bfd3db7
3 changed files with 84 additions and 85 deletions

View File

@ -321,33 +321,33 @@ class FolkCrmView extends HTMLElement {
this.shadow.innerHTML = ` this.shadow.innerHTML = `
<style> <style>
:host { display: block; font-family: system-ui, -apple-system, sans-serif; color: #e0e0e0; } :host { display: block; font-family: system-ui, -apple-system, sans-serif; color: var(--rs-text-primary); }
* { box-sizing: border-box; } * { box-sizing: border-box; }
.crm-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; } .crm-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.crm-title { font-size: 15px; font-weight: 600; color: #e2e8f0; } .crm-title { font-size: 15px; font-weight: 600; color: var(--rs-text-primary); }
.tabs { display: flex; gap: 2px; background: #16161e; border-radius: 10px; padding: 3px; margin-bottom: 16px; } .tabs { display: flex; gap: 2px; background: var(--rs-input-bg); border-radius: 10px; padding: 3px; margin-bottom: 16px; }
.tab { .tab {
padding: 8px 16px; border-radius: 8px; border: none; padding: 8px 16px; border-radius: 8px; border: none;
background: transparent; color: #888; cursor: pointer; font-size: 13px; background: transparent; color: var(--rs-text-muted); cursor: pointer; font-size: 13px;
font-weight: 500; transition: all 0.15s; font-weight: 500; transition: all 0.15s;
} }
.tab:hover { color: #ccc; } .tab:hover { color: var(--rs-text-secondary); }
.tab.active { background: #1e1e2e; color: #e2e8f0; } .tab.active { background: var(--rs-bg-surface); color: var(--rs-text-primary); }
.tab-count { font-size: 11px; color: #555; margin-left: 4px; } .tab-count { font-size: 11px; color: var(--rs-text-muted); margin-left: 4px; }
.tab.active .tab-count { color: #6366f1; } .tab.active .tab-count { color: var(--rs-primary-hover); }
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; } .toolbar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.search-input { .search-input {
border: 1px solid #333; border-radius: 8px; padding: 8px 12px; border: 1px solid var(--rs-input-border); border-radius: 8px; padding: 8px 12px;
background: #16161e; color: #e0e0e0; font-size: 13px; width: 260px; outline: none; background: var(--rs-input-bg); color: var(--rs-input-text); font-size: 13px; width: 260px; outline: none;
} }
.search-input:focus { border-color: #6366f1; } .search-input:focus { border-color: var(--rs-primary-hover); }
.loading { text-align: center; color: #888; padding: 60px 20px; font-size: 14px; } .loading { text-align: center; color: var(--rs-text-muted); padding: 60px 20px; font-size: 14px; }
.error { text-align: center; color: #ef5350; padding: 40px 20px; } .error { text-align: center; color: var(--rs-error); padding: 40px 20px; }
.empty-state { text-align: center; color: #666; padding: 60px 20px; font-size: 14px; } .empty-state { text-align: center; color: var(--rs-text-muted); padding: 60px 20px; font-size: 14px; }
/* ── Pipeline grid ── */ /* ── Pipeline grid ── */
.pipeline-grid { .pipeline-grid {
@ -362,61 +362,61 @@ class FolkCrmView extends HTMLElement {
display: flex; align-items: center; justify-content: space-between; display: flex; align-items: center; justify-content: space-between;
font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
} }
.stage-incoming { background: #1e293b; color: #93c5fd; } .stage-incoming { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.stage-meeting { background: #1e2a1e; color: #86efac; } .stage-meeting { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.stage-proposal { background: #2a2a1e; color: #fde68a; } .stage-proposal { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.stage-closed-won { background: #1a2e1a; color: #4ade80; } .stage-closed-won { background: rgba(34, 197, 94, 0.2); color: #16a34a; }
.stage-closed-lost { background: #2e1a1a; color: #f87171; } .stage-closed-lost { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.pipeline-count { .pipeline-count {
background: rgba(255,255,255,0.1); padding: 1px 7px; border-radius: 10px; background: rgba(255,255,255,0.1); padding: 1px 7px; border-radius: 10px;
font-size: 11px; font-size: 11px;
} }
.pipeline-total { font-size: 12px; color: #888; padding: 4px 12px; } .pipeline-total { font-size: 12px; color: var(--rs-text-muted); padding: 4px 12px; }
.pipeline-cards { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; } .pipeline-cards { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.pipeline-card { .pipeline-card {
background: #1e1e2e; border: 1px solid #2a2a3a; border-radius: 8px; background: var(--rs-bg-surface); border: 1px solid var(--rs-border); border-radius: 8px;
padding: 12px; transition: border-color 0.15s; padding: 12px; transition: border-color 0.15s;
} }
.pipeline-card:hover { border-color: #444; } .pipeline-card:hover { border-color: var(--rs-border-strong); }
.card-name { font-size: 13px; font-weight: 600; color: #e2e8f0; margin-bottom: 4px; } .card-name { font-size: 13px; font-weight: 600; color: var(--rs-text-primary); margin-bottom: 4px; }
.card-amount { font-size: 14px; font-weight: 700; color: #6366f1; margin-bottom: 6px; } .card-amount { font-size: 14px; font-weight: 700; color: var(--rs-primary-hover); margin-bottom: 6px; }
.card-company { font-size: 12px; color: #94a3b8; } .card-company { font-size: 12px; color: var(--rs-text-secondary); }
.card-contact { font-size: 11px; color: #64748b; margin-top: 2px; } .card-contact { font-size: 11px; color: var(--rs-text-muted); margin-top: 2px; }
.card-date { font-size: 11px; color: #555; margin-top: 4px; } .card-date { font-size: 11px; color: var(--rs-text-muted); margin-top: 4px; }
/* ── Data tables ── */ /* ── Data tables ── */
.data-table { .data-table {
width: 100%; border-collapse: collapse; width: 100%; border-collapse: collapse;
background: #16161e; border-radius: 10px; overflow: hidden; background: var(--rs-input-bg); border-radius: 10px; overflow: hidden;
} }
.data-table th { .data-table th {
text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600; text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600;
color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; color: var(--rs-text-muted); text-transform: uppercase; letter-spacing: 0.04em;
border-bottom: 1px solid #222; cursor: pointer; user-select: none; border-bottom: 1px solid var(--rs-border); cursor: pointer; user-select: none;
white-space: nowrap; white-space: nowrap;
} }
.data-table th:hover { color: #94a3b8; } .data-table th:hover { color: var(--rs-text-secondary); }
.data-table td { .data-table td {
padding: 10px 14px; font-size: 13px; border-bottom: 1px solid #1a1a2a; padding: 10px 14px; font-size: 13px; border-bottom: 1px solid var(--rs-border-subtle);
color: #c8c8d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--rs-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
max-width: 250px; max-width: 250px;
} }
.data-table tr:hover td { background: #1a1a2a; } .data-table tr:hover td { background: var(--rs-bg-hover); }
.cell-name { font-weight: 500; color: #e2e8f0; } .cell-name { font-weight: 500; color: var(--rs-text-primary); }
.cell-email { color: #93c5fd; } .cell-email { color: #93c5fd; }
.cell-domain a { color: #93c5fd; text-decoration: none; } .cell-domain a { color: #93c5fd; text-decoration: none; }
.cell-domain a:hover { text-decoration: underline; } .cell-domain a:hover { text-decoration: underline; }
.table-footer { font-size: 12px; color: #555; padding: 10px 14px; } .table-footer { font-size: 12px; color: var(--rs-text-muted); padding: 10px 14px; }
/* ── Graph tab ── */ /* ── Graph tab ── */
.graph-link-section { text-align: center; padding: 60px 20px; } .graph-link-section { text-align: center; padding: 60px 20px; }
.graph-link-section p { color: #888; font-size: 14px; margin-bottom: 16px; } .graph-link-section p { color: var(--rs-text-muted); font-size: 14px; margin-bottom: 16px; }
.graph-link-btn { .graph-link-btn {
display: inline-block; padding: 10px 24px; border-radius: 8px; display: inline-block; padding: 10px 24px; border-radius: 8px;
background: #6366f1; color: #fff; text-decoration: none; background: var(--rs-primary-hover); color: #fff; text-decoration: none;
font-size: 14px; font-weight: 500; transition: background 0.15s; font-size: 14px; font-weight: 500; transition: background 0.15s;
} }
.graph-link-btn:hover { background: #5558e6; } .graph-link-btn:hover { background: var(--rs-primary); }
@media (max-width: 900px) { @media (max-width: 900px) {
.pipeline-grid { grid-template-columns: repeat(2, 1fr); } .pipeline-grid { grid-template-columns: repeat(2, 1fr); }

View File

@ -339,7 +339,7 @@ class FolkGraphViewer extends HTMLElement {
private renderGraphNodes(): string { private renderGraphNodes(): string {
const filtered = this.getFilteredNodes(); const filtered = this.getFilteredNodes();
if (filtered.length === 0 && this.nodes.length > 0) { if (filtered.length === 0 && this.nodes.length > 0) {
return `<div class="placeholder"><p style="font-size:14px;color:#888">No nodes match current filter.</p></div>`; return `<div class="placeholder"><p style="font-size:14px;color:var(--rs-text-muted)">No nodes match current filter.</p></div>`;
} }
if (filtered.length === 0) { if (filtered.length === 0) {
return ` return `
@ -347,7 +347,7 @@ class FolkGraphViewer extends HTMLElement {
<p style="font-size:48px">&#x1F578;&#xFE0F;</p> <p style="font-size:48px">&#x1F578;&#xFE0F;</p>
<p style="font-size:16px">Community Relationship Graph</p> <p style="font-size:16px">Community Relationship Graph</p>
<p>Connect the force-directed layout engine to visualize your network.</p> <p>Connect the force-directed layout engine to visualize your network.</p>
<p style="font-size:12px;color:#444">Automerge CRDT sync + d3-force layout</p> <p style="font-size:12px;color:var(--rs-text-muted)">Automerge CRDT sync + d3-force layout</p>
</div> </div>
`; `;
} }
@ -382,7 +382,7 @@ class FolkGraphViewer extends HTMLElement {
if (!filteredIds.has(edge.source) || !filteredIds.has(edge.target)) continue; if (!filteredIds.has(edge.source) || !filteredIds.has(edge.target)) continue;
if (edge.type === "work_at") { if (edge.type === "work_at") {
edgesSvg.push(`<line x1="${sp.x}" y1="${sp.y}" x2="${tp.x}" y2="${tp.y}" stroke="#555" stroke-width="1" opacity="0.35"/>`); edgesSvg.push(`<line x1="${sp.x}" y1="${sp.y}" x2="${tp.x}" y2="${tp.y}" style="stroke:var(--rs-text-muted)" stroke-width="1" opacity="0.35"/>`);
} else if (edge.type === "point_of_contact") { } else if (edge.type === "point_of_contact") {
const mx = (sp.x + tp.x) / 2; const mx = (sp.x + tp.x) / 2;
const my = (sp.y + tp.y) / 2; const my = (sp.y + tp.y) / 2;
@ -394,7 +394,7 @@ class FolkGraphViewer extends HTMLElement {
edgesSvg.push(`<line x1="${sp.x}" y1="${sp.y}" x2="${tp.x}" y2="${tp.y}" stroke="#f59e0b" stroke-width="1" stroke-dasharray="3 3" opacity="0.4"/>`); edgesSvg.push(`<line x1="${sp.x}" y1="${sp.y}" x2="${tp.x}" y2="${tp.y}" stroke="#f59e0b" stroke-width="1" stroke-dasharray="3 3" opacity="0.4"/>`);
} else { } else {
// Fallback for any unknown edge type // Fallback for any unknown edge type
edgesSvg.push(`<line x1="${sp.x}" y1="${sp.y}" x2="${tp.x}" y2="${tp.y}" stroke="#555" stroke-width="1" opacity="0.25"/>`); edgesSvg.push(`<line x1="${sp.x}" y1="${sp.y}" x2="${tp.x}" y2="${tp.y}" style="stroke:var(--rs-text-muted)" stroke-width="1" opacity="0.25"/>`);
} }
} }
@ -410,15 +410,15 @@ class FolkGraphViewer extends HTMLElement {
let label = this.esc(node.name); let label = this.esc(node.name);
let sublabel = ""; let sublabel = "";
if (isOrg && node.description) { if (isOrg && node.description) {
sublabel = `<text x="${pos.x}" y="${pos.y + radius + 26}" fill="#888" font-size="8" text-anchor="middle">${this.esc(node.description)}</text>`; sublabel = `<text x="${pos.x}" y="${pos.y + radius + 26}" style="fill:var(--rs-text-muted)" font-size="8" text-anchor="middle">${this.esc(node.description)}</text>`;
} else if (!isOrg && node.role) { } else if (!isOrg && node.role) {
sublabel = `<text x="${pos.x}" y="${pos.y + radius + 24}" fill="#666" font-size="8" text-anchor="middle">${this.esc(node.role)}${node.location ? " \u00b7 " + this.esc(node.location) : ""}</text>`; sublabel = `<text x="${pos.x}" y="${pos.y + radius + 24}" style="fill:var(--rs-text-muted)" font-size="8" text-anchor="middle">${this.esc(node.role)}${node.location ? " \u00b7 " + this.esc(node.location) : ""}</text>`;
} }
// Trust score badge for people // Trust score badge for people
const trust = !isOrg ? this.getTrustScore(node.id) : -1; const trust = !isOrg ? this.getTrustScore(node.id) : -1;
const trustBadge = trust >= 0 ? ` const trustBadge = trust >= 0 ? `
<circle cx="${pos.x + radius - 2}" cy="${pos.y - radius + 2}" r="8" fill="#7c3aed" stroke="#0d0d14" stroke-width="1.5"/> <circle cx="${pos.x + radius - 2}" cy="${pos.y - radius + 2}" r="8" fill="#7c3aed" style="stroke:var(--rs-canvas-bg)" stroke-width="1.5"/>
<text x="${pos.x + radius - 2}" y="${pos.y - radius + 5.5}" fill="#fff" font-size="7" font-weight="700" text-anchor="middle">${trust}</text> <text x="${pos.x + radius - 2}" y="${pos.y - radius + 5.5}" fill="#fff" font-size="7" font-weight="700" text-anchor="middle">${trust}</text>
` : ""; ` : "";
@ -427,7 +427,7 @@ class FolkGraphViewer extends HTMLElement {
${isSelected ? `<circle cx="${pos.x}" cy="${pos.y}" r="${radius + 6}" fill="none" stroke="${color}" stroke-width="2" opacity="0.6"/>` : ""} ${isSelected ? `<circle cx="${pos.x}" cy="${pos.y}" r="${radius + 6}" fill="none" stroke="${color}" stroke-width="2" opacity="0.6"/>` : ""}
<circle cx="${pos.x}" cy="${pos.y}" r="${radius}" fill="${color}" opacity="${isOrg ? 0.9 : 0.75}" stroke="${isOrg ? color : "none"}" stroke-width="${isOrg ? 2 : 0}" stroke-opacity="0.3"/> <circle cx="${pos.x}" cy="${pos.y}" r="${radius}" fill="${color}" opacity="${isOrg ? 0.9 : 0.75}" stroke="${isOrg ? color : "none"}" stroke-width="${isOrg ? 2 : 0}" stroke-opacity="0.3"/>
${isOrg ? `<text x="${pos.x}" y="${pos.y + 4}" fill="#fff" font-size="9" font-weight="600" text-anchor="middle">${label.length > 14 ? label.slice(0, 12) + "\u2026" : label}</text>` : ""} ${isOrg ? `<text x="${pos.x}" y="${pos.y + 4}" fill="#fff" font-size="9" font-weight="600" text-anchor="middle">${label.length > 14 ? label.slice(0, 12) + "\u2026" : label}</text>` : ""}
<text x="${pos.x}" y="${pos.y + radius + 13}" fill="#ccc" font-size="${isOrg ? 11 : 10}" font-weight="${isOrg ? 600 : 400}" text-anchor="middle">${label}</text> <text x="${pos.x}" y="${pos.y + radius + 13}" style="fill:var(--rs-text-primary)" font-size="${isOrg ? 11 : 10}" font-weight="${isOrg ? 600 : 400}" text-anchor="middle">${label}</text>
${sublabel} ${sublabel}
${trustBadge} ${trustBadge}
</g> </g>
@ -440,45 +440,45 @@ class FolkGraphViewer extends HTMLElement {
private render() { private render() {
this.shadow.innerHTML = ` this.shadow.innerHTML = `
<style> <style>
:host { display: block; font-family: system-ui, -apple-system, sans-serif; color: #e0e0e0; } :host { display: block; font-family: system-ui, -apple-system, sans-serif; color: var(--rs-text-primary); }
* { box-sizing: border-box; } * { box-sizing: border-box; }
.rapp-nav { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; min-height: 36px; } .rapp-nav { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; min-height: 36px; }
.rapp-nav__title { font-size: 15px; font-weight: 600; flex: 1; color: #e2e8f0; } .rapp-nav__title { font-size: 15px; font-weight: 600; flex: 1; color: var(--rs-text-primary); }
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; } .toolbar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.search-input { .search-input {
border: 1px solid #333; border-radius: 8px; padding: 8px 12px; border: 1px solid var(--rs-input-border); border-radius: 8px; padding: 8px 12px;
background: #16161e; color: #e0e0e0; font-size: 13px; width: 200px; outline: none; background: var(--rs-input-bg); color: var(--rs-input-text); font-size: 13px; width: 200px; outline: none;
} }
.search-input:focus { border-color: #6366f1; } .search-input:focus { border-color: var(--rs-primary-hover); }
.filter-btn { .filter-btn {
padding: 6px 12px; border-radius: 8px; border: 1px solid #333; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--rs-input-border);
background: #16161e; color: #888; cursor: pointer; font-size: 12px; background: var(--rs-input-bg); color: var(--rs-text-muted); cursor: pointer; font-size: 12px;
} }
.filter-btn:hover { border-color: #555; } .filter-btn:hover { border-color: var(--rs-border-strong); }
.filter-btn.active { border-color: #6366f1; color: #6366f1; } .filter-btn.active { border-color: var(--rs-primary-hover); color: var(--rs-primary-hover); }
.graph-canvas { .graph-canvas {
width: 100%; height: 500px; border-radius: 12px; width: 100%; height: 500px; border-radius: 12px;
background: #0d0d14; border: 1px solid #222; background: var(--rs-canvas-bg); border: 1px solid var(--rs-border);
display: flex; align-items: center; justify-content: center; display: flex; align-items: center; justify-content: center;
position: relative; overflow: hidden; position: relative; overflow: hidden;
} }
.placeholder { text-align: center; color: #555; padding: 40px; } .placeholder { text-align: center; color: var(--rs-text-muted); padding: 40px; }
.placeholder p { margin: 6px 0; } .placeholder p { margin: 6px 0; }
.workspace-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 16px; } .workspace-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 16px; }
.ws-card { .ws-card {
background: #1e1e2e; border: 1px solid #333; border-radius: 10px; background: var(--rs-bg-surface); border: 1px solid var(--rs-border-strong); border-radius: 10px;
padding: 16px; cursor: pointer; transition: border-color 0.2s; padding: 16px; cursor: pointer; transition: border-color 0.2s;
} }
.ws-card:hover { border-color: #555; } .ws-card:hover { border-color: var(--rs-text-muted); }
.ws-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; } .ws-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.ws-meta { font-size: 12px; color: #888; } .ws-meta { font-size: 12px; color: var(--rs-text-muted); }
.legend { display: flex; gap: 16px; margin-top: 12px; } .legend { display: flex; gap: 16px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #888; } .legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--rs-text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; } .legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-line { display: inline-block; } .legend-line { display: inline-block; }
.dot-person { background: #3b82f6; } .dot-person { background: #3b82f6; }
@ -487,34 +487,34 @@ class FolkGraphViewer extends HTMLElement {
.stats { display: flex; gap: 20px; margin-bottom: 16px; } .stats { display: flex; gap: 20px; margin-bottom: 16px; }
.stat { text-align: center; } .stat { text-align: center; }
.stat-value { font-size: 24px; font-weight: 700; color: #6366f1; } .stat-value { font-size: 24px; font-weight: 700; color: var(--rs-primary-hover); }
.stat-label { font-size: 11px; color: #888; } .stat-label { font-size: 11px; color: var(--rs-text-muted); }
.demo-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; background: #f59e0b22; color: #f59e0b; font-size: 11px; font-weight: 600; margin-left: 8px; } .demo-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; background: #f59e0b22; color: #f59e0b; font-size: 11px; font-weight: 600; margin-left: 8px; }
.graph-node:hover circle:first-child { filter: brightness(1.2); } .graph-node:hover circle:first-child { filter: brightness(1.2); }
.detail-panel { .detail-panel {
background: #1a1a2e; border: 1px solid #334155; border-radius: 10px; background: var(--rs-bg-surface); border: 1px solid var(--rs-border-strong); border-radius: 10px;
padding: 16px; margin-top: 12px; padding: 16px; margin-top: 12px;
} }
.detail-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; } .detail-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.detail-icon { font-size: 24px; } .detail-icon { font-size: 24px; }
.detail-info { flex: 1; } .detail-info { flex: 1; }
.detail-name { font-size: 15px; font-weight: 600; color: #e2e8f0; } .detail-name { font-size: 15px; font-weight: 600; color: var(--rs-text-primary); }
.detail-type { font-size: 12px; color: #94a3b8; } .detail-type { font-size: 12px; color: var(--rs-text-secondary); }
.detail-close { background: none; border: none; color: #64748b; font-size: 16px; cursor: pointer; padding: 4px; } .detail-close { background: none; border: none; color: var(--rs-text-muted); font-size: 16px; cursor: pointer; padding: 4px; }
.detail-close:hover { color: #e2e8f0; } .detail-close:hover { color: var(--rs-text-primary); }
.detail-desc { font-size: 13px; color: #94a3b8; line-height: 1.5; margin: 8px 0; } .detail-desc { font-size: 13px; color: var(--rs-text-secondary); line-height: 1.5; margin: 8px 0; }
.detail-trust { display: flex; align-items: center; gap: 8px; margin: 10px 0; } .detail-trust { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.trust-label { font-size: 11px; color: #64748b; min-width: 70px; } .trust-label { font-size: 11px; color: var(--rs-text-muted); min-width: 70px; }
.trust-bar { flex: 1; height: 6px; background: #1e1e2e; border-radius: 3px; overflow: hidden; } .trust-bar { flex: 1; height: 6px; background: var(--rs-bg-surface-raised); border-radius: 3px; overflow: hidden; }
.trust-fill { display: block; height: 100%; background: #7c3aed; border-radius: 3px; transition: width 0.3s; } .trust-fill { display: block; height: 100%; background: #7c3aed; border-radius: 3px; transition: width 0.3s; }
.trust-val { font-size: 12px; font-weight: 700; color: #a78bfa; min-width: 24px; text-align: right; } .trust-val { font-size: 12px; font-weight: 700; color: #a78bfa; min-width: 24px; text-align: right; }
.detail-section { font-size: 11px; font-weight: 600; color: #64748b; margin: 12px 0 6px; text-transform: uppercase; letter-spacing: 0.05em; } .detail-section { font-size: 11px; font-weight: 600; color: var(--rs-text-muted); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.detail-conn { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #e2e8f0; padding: 4px 0; } .detail-conn { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--rs-text-primary); padding: 4px 0; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; } .conn-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.conn-role { font-size: 11px; color: #64748b; margin-left: auto; } .conn-role { font-size: 11px; color: var(--rs-text-muted); margin-left: auto; }
@media (max-width: 768px) { @media (max-width: 768px) {
.graph-canvas { height: 350px; } .graph-canvas { height: 350px; }
@ -525,7 +525,7 @@ class FolkGraphViewer extends HTMLElement {
} }
</style> </style>
${this.error ? `<div style="color:#ef5350;text-align:center;padding:8px">${this.esc(this.error)}</div>` : ""} ${this.error ? `<div style="color:var(--rs-error);text-align:center;padding:8px">${this.esc(this.error)}</div>` : ""}
<div class="rapp-nav"> <div class="rapp-nav">
<span class="rapp-nav__title">Network Graph${this.space === "demo" ? '<span class="demo-badge">Demo</span>' : ""}</span> <span class="rapp-nav__title">Network Graph${this.space === "demo" ? '<span class="demo-badge">Demo</span>' : ""}</span>
@ -553,7 +553,7 @@ class FolkGraphViewer extends HTMLElement {
<p style="font-size:48px">&#x1F578;&#xFE0F;</p> <p style="font-size:48px">&#x1F578;&#xFE0F;</p>
<p style="font-size:16px">Community Relationship Graph</p> <p style="font-size:16px">Community Relationship Graph</p>
<p>Connect the force-directed layout engine to visualize your network.</p> <p>Connect the force-directed layout engine to visualize your network.</p>
<p style="font-size:12px;color:#444">Automerge CRDT sync + d3-force layout</p> <p style="font-size:12px;color:var(--rs-text-muted)">Automerge CRDT sync + d3-force layout</p>
</div> </div>
`} `}
</div> </div>
@ -563,12 +563,12 @@ class FolkGraphViewer extends HTMLElement {
<div class="legend"> <div class="legend">
<div class="legend-item"><span class="legend-dot dot-person"></span> People</div> <div class="legend-item"><span class="legend-dot dot-person"></span> People</div>
<div class="legend-item"><span class="legend-dot dot-company"></span> Organizations</div> <div class="legend-item"><span class="legend-dot dot-company"></span> Organizations</div>
<div class="legend-item"><svg width="20" height="10"><line x1="0" y1="5" x2="20" y2="5" stroke="#555" stroke-width="2"/></svg> Works at</div> <div class="legend-item"><svg width="20" height="10"><line x1="0" y1="5" x2="20" y2="5" style="stroke:var(--rs-text-muted)" stroke-width="2"/></svg> Works at</div>
<div class="legend-item"><svg width="20" height="10"><line x1="0" y1="5" x2="20" y2="5" stroke="#c084fc" stroke-width="2" stroke-dasharray="4 2"/></svg> Point of contact</div> <div class="legend-item"><svg width="20" height="10"><line x1="0" y1="5" x2="20" y2="5" stroke="#c084fc" stroke-width="2" stroke-dasharray="4 2"/></svg> Point of contact</div>
</div> </div>
${this.workspaces.length > 0 ? ` ${this.workspaces.length > 0 ? `
<div style="margin-top:20px;font-size:14px;font-weight:600;color:#aaa">${this.space === "demo" ? "Organizations" : "Workspaces"}</div> <div style="margin-top:20px;font-size:14px;font-weight:600;color:var(--rs-text-secondary)">${this.space === "demo" ? "Organizations" : "Workspaces"}</div>
<div class="workspace-list"> <div class="workspace-list">
${this.workspaces.map(ws => ` ${this.workspaces.map(ws => `
<div class="ws-card"> <div class="ws-card">

View File

@ -158,6 +158,7 @@ routes.get("/api/graph", async (c) => {
id id
name { firstName lastName } name { firstName lastName }
email { primaryEmail } email { primaryEmail }
city
company { id name { firstName lastName } } company { id name { firstName lastName } }
} }
} }
@ -169,6 +170,7 @@ routes.get("/api/graph", async (c) => {
name name
domainName { primaryLinkUrl } domainName { primaryLinkUrl }
employees employees
address { addressCity addressCountry }
} }
} }
} }
@ -196,7 +198,7 @@ routes.get("/api/graph", async (c) => {
// People → nodes // People → nodes
for (const { node: p } of d.people?.edges || []) { for (const { node: p } of d.people?.edges || []) {
const label = [p.name?.firstName, p.name?.lastName].filter(Boolean).join(" ") || "Unknown"; const label = [p.name?.firstName, p.name?.lastName].filter(Boolean).join(" ") || "Unknown";
nodes.push({ id: p.id, label, type: "person", data: { email: p.email?.primaryEmail } }); nodes.push({ id: p.id, label, type: "person", data: { email: p.email?.primaryEmail, location: p.city } });
nodeIds.add(p.id); nodeIds.add(p.id);
// Person → Company edge // Person → Company edge
@ -207,7 +209,7 @@ routes.get("/api/graph", async (c) => {
// Companies → nodes // Companies → nodes
for (const { node: co } of d.companies?.edges || []) { for (const { node: co } of d.companies?.edges || []) {
nodes.push({ id: co.id, label: co.name || "Unknown", type: "company", data: { domain: co.domainName?.primaryLinkUrl, employees: co.employees } }); nodes.push({ id: co.id, label: co.name || "Unknown", type: "company", data: { domain: co.domainName?.primaryLinkUrl, employees: co.employees, location: co.address?.addressCity } });
nodeIds.add(co.id); nodeIds.add(co.id);
} }
@ -275,7 +277,6 @@ routes.get("/crm", (c) => {
moduleId: "rnetwork", moduleId: "rnetwork",
spaceSlug: space, spaceSlug: space,
modules: getModuleInfoList(), modules: getModuleInfoList(),
theme: "dark",
body: `<folk-crm-view space="${space}"></folk-crm-view>`, body: `<folk-crm-view space="${space}"></folk-crm-view>`,
scripts: `<script type="module" src="/modules/rnetwork/folk-crm-view.js"></script>`, scripts: `<script type="module" src="/modules/rnetwork/folk-crm-view.js"></script>`,
styles: `<link rel="stylesheet" href="/modules/rnetwork/network.css">`, styles: `<link rel="stylesheet" href="/modules/rnetwork/network.css">`,
@ -293,7 +294,6 @@ routes.get("/", (c) => {
moduleId: "rnetwork", moduleId: "rnetwork",
spaceSlug: space, spaceSlug: space,
modules: getModuleInfoList(), modules: getModuleInfoList(),
theme: "dark",
body: `<folk-crm-view space="${space}"></folk-crm-view>`, body: `<folk-crm-view space="${space}"></folk-crm-view>`,
scripts: `<script type="module" src="/modules/rnetwork/folk-crm-view.js"></script>`, scripts: `<script type="module" src="/modules/rnetwork/folk-crm-view.js"></script>`,
styles: `<link rel="stylesheet" href="/modules/rnetwork/network.css">`, styles: `<link rel="stylesheet" href="/modules/rnetwork/network.css">`,
@ -305,10 +305,9 @@ routes.get("/", (c) => {
moduleId: "rnetwork", moduleId: "rnetwork",
spaceSlug: space, spaceSlug: space,
modules: getModuleInfoList(), modules: getModuleInfoList(),
theme: "dark",
body: `<div class="rapp-nav" style="padding:0 1rem;margin-top:8px"><span class="rapp-nav__title"></span><a href="?view=app" class="rapp-nav__btn--app-toggle">Open Full App</a></div> body: `<div class="rapp-nav" style="padding:0 1rem;margin-top:8px"><span class="rapp-nav__title"></span><a href="?view=app" class="rapp-nav__btn--app-toggle">Open Full App</a></div>
<folk-graph-viewer space="${space}"></folk-graph-viewer>`, <folk-graph-viewer space="${space}"></folk-graph-viewer>`,
scripts: `<script type="module" src="/modules/rnetwork/folk-graph-viewer.js?v=3"></script>`, scripts: `<script type="module" src="/modules/rnetwork/folk-graph-viewer.js?v=4"></script>`,
styles: `<link rel="stylesheet" href="/modules/rnetwork/network.css">`, styles: `<link rel="stylesheet" href="/modules/rnetwork/network.css">`,
})); }));
}); });