Files
the-nexus/modules/nostr-panel.js
manus 24e71396cc
Some checks failed
Deploy Nexus / deploy (push) Failing after 8s
Staging Smoke Test / smoke-test (push) Successful in 1s
[manus] Nostr Integration — Sovereign Communication (#454) (#455)
Co-authored-by: manus <manus@noreply.143.198.27.163>
Co-committed-by: manus <manus@noreply.143.198.27.163>
2026-03-24 19:58:25 +00:00

47 lines
1.3 KiB
JavaScript

// === NOSTR FEED PANEL ===
import * as THREE from 'three';
import { NEXUS } from './constants.js';
import { NOSTR_STATE } from './nostr.js';
export function createNostrPanelTexture() {
const W = 512, H = 512;
const canvas = document.createElement('canvas');
canvas.width = W; canvas.height = H;
const ctx = canvas.getContext('2d');
const update = () => {
ctx.clearRect(0, 0, W, H);
// Background
ctx.fillStyle = 'rgba(10, 20, 40, 0.8)';
ctx.fillRect(0, 0, W, H);
// Header
ctx.fillStyle = '#4488ff';
ctx.font = 'bold 32px "Orbitron"';
ctx.fillText('◈ NOSTR_FEED', 30, 60);
ctx.fillRect(30, 75, 452, 2);
// Connection Status
ctx.fillStyle = NOSTR_STATE.connected ? '#00ff88' : '#ff4444';
ctx.beginPath();
ctx.arc(460, 48, 8, 0, Math.PI * 2);
ctx.fill();
// Events
ctx.font = '18px "JetBrains Mono"';
NOSTR_STATE.events.slice(0, 10).forEach((ev, i) => {
const y = 120 + i * 38;
ctx.fillStyle = ev.kind === 9735 ? '#ffd700' : '#ffffff';
const prefix = ev.kind === 9735 ? '⚡' : '•';
ctx.fillText(\`\${prefix} [\${ev.pubkey}] \${ev.content}\`, 30, y);
});
if (NOSTR_STATE.events.length === 0) {
ctx.fillStyle = '#667788';
ctx.fillText('> WAITING FOR EVENTS...', 30, 120);
}
};
return { canvas, update };
}