The user wants me to build a "privacy-preserving telemetry: sampling, redaction, and purpose tags."
As a FUI (Fictional User Interface) design expert from 2077, I need to present this system in a Cyberpunk/Hard Sci-Fi style. The request is not just about functionality; it's about creating an interface that implements telemetry with privacy features: sampling, redaction, and purpose tags. I need to create a web page that demonstrates this system. It should have a complex, high-tech aesthetic.
Let's break down the requirements:
- It's about telemetry (data collection from remote sources, likely systems, users, sensors).
- Privacy-preserving features:
- Sampling: Not collecting all data, but a subset to reduce identifiability.
- Redaction: Removing or masking sensitive information from the collected data.
- Purpose tags: Data is tagged with its intended purpose, enabling purpose limitation and transparency.
- The interface should be an FUI: dark mode, neon glows, monospace fonts, intricate structures, holographic effects, micro-interactions, HUD layout.
I need to create a single HTML file (including CSS and JS) that demonstrates this. It should be interactive and visually impressive.
Plan the interface:
- Overall layout: HUD style, perhaps with a central "main view" and side panels for stats, control, logs.
- Data visualization: Show incoming telemetry streams, sample rates, redaction status, purpose tags.
- Controls: Allow adjusting sampling rates, toggling redaction, managing purpose tags.
- Visual effects: glitch effects, scanning lines, neon glows, animated data streams.
Possible components:
- Top bar: System status, time, maybe a logo.
- Left panel: Configuration (sampling rate sliders, redaction rules, purpose tag management).
- Center panel: Real-time telemetry feed (displaying data packets being processed). Could be a scrolling list of JSON-like objects with highlighting for redacted fields and purpose tags.
- Right panel: Metrics (total events, sampled events, redacted fields, purpose distribution).
- Bottom: Log/console output with system messages.
Technical implementation:
- Use Tailwind CSS via CDN for base styling, but heavily customize with custom classes for neon effects, borders, etc.
- Use plain JavaScript (or minimal libraries). For charts, maybe use a simple canvas-based drawing or just CSS-based bars. Since the style is techy, I can use canvas for dynamic visuals like radial scans or network graphs.
- Use monospace fonts: 'JetBrains Mono' or similar (use Google Fonts if possible, but fallback to monospace).
- Colors: cyan (#00f3ff), magenta (#ff00ff), amber (#ffaa00) on dark background (#050505).
- Use CSS animations for scanning lines, pulsing glows, glitch effects.
Implementation steps:
- HTML skeleton with Tailwind CDN.
- Define custom CSS for glows, borders, etc.
- Create the layout grid: maybe a 3-column layout, with header and footer.
- Build each panel:
- Header: title "PRIV-TELEMETRY v2.4.7" with some decorative lines.
- Left panel: Configuration. Include sliders for sampling rate (global and per data type maybe). Toggle switches for redaction (enable/disable). A list of purpose tags (e.g., "analytics", "security", "billing") with checkboxes to assign to collected data? Actually, purpose tags are likely attached to each data point to indicate why it is collected. The UI could show a table of current purpose policies.
- Center panel: Real-time feed. Simulate incoming telemetry events (using setInterval). Display each event as a "card" or a line with syntax highlighting. Show fields, some of which are redacted (e.g., "[REDACTED]"). Show purpose tag as a colored badge.
- Right panel: Stats. Use canvas to draw a circular gauge or bar charts. Could also use simple HTML bars with CSS animations.
- Bottom: Log area where system messages appear like "Sampling rate adjusted to 15%", "Redaction applied to field 'email'", etc.
- Add interactions: Hovering over a feed item could expand it or show more details. Hover over purpose tags could show description. Sliders update in real-time, affecting the simulation.
- Add visual effects: scanning line overlay (a horizontal line moving down the screen), vignette, maybe a slight chromatic aberration on text on hover. Use CSS
clip-path to create angled corners for panels (like a sci-fi cut corner). Use box-shadow for neon glow.
Let's think about the simulation:
- We'll generate random telemetry events with various fields: userId, sessionId, timestamp, eventType, location, deviceInfo, etc.
- Some fields are sensitive (email, ip, location). If redaction is enabled, these fields are replaced with "[REDACTED]" or hashed.
- Sampling: only a certain percentage of events are displayed/collected. We'll simulate that by filtering events randomly based on a sampling rate.
- Purpose tags: Each event type may have a purpose (e.g., "page_view" -> "analytics", "payment" -> "billing"). We'll tag each displayed event with a badge.
- The stats panel will count total events processed, sampled count, redacted fields count, purpose distribution.
We need to ensure the design is "Hard Sci-Fi": precise, technical, maybe with grid lines, small text, lots of numbers.
Implementation details:
- Use Tailwind via CDN:
- Configure Tailwind theme for custom colors? Could use arbitrary values. But I'll also add custom CSS for specific effects.
- Google Fonts: 'JetBrains Mono' or 'Share Tech Mono' (I'll use JetBrains Mono if available; else use monospace).
- Use a fixed viewport, maybe full screen.
Let's structure HTML:
<!-- Center panel: Telemetry feed -->
<main class="flex-1 p-4 overflow-y-auto relative">
<div class="flex justify-between items-center mb-4">
<h2 class="text-cyan-300 text-xs font-bold border-b border-cyan-800 pb-1">LIVE TELEMETRY STREAM</h2>
<div class="text-xs text-cyan-700">
INCOMING: <span id="incoming-count" class="text-cyan-400">0</span>
<span class="mx-2">|</span>
SAMPLED: <span id="sampled-count" class="text-cyan-400">0</span>
</div>
</div>
<!-- Container for feed items -->
<div id="telemetry-feed" class="space-y-2 relative">
<!-- Feed items will be inserted here -->
</div>
<!-- Decorative corner brackets -->
<div class="absolute top-0 left-0 w-4 h-4 border-l-2 border-t-2 border-cyan-600"></div>
<div class="absolute top-0 right-0 w-4 h-4 border-r-2 border-t-2 border-cyan-600"></div>
<div class="absolute bottom-0 left-0 w-4 h-4 border-l-2 border-b-2 border-cyan-600"></div>
<div class="absolute bottom-0 right-0 w-4 h-4 border-r-2 border-b-2 border-cyan-600"></div>
</main>
<!-- Right panel: Metrics & Visuals -->
<aside class="w-80 border-l border-cyan-900 p-4 overflow-y-auto bg-black/40">
<h2 class="text-cyan-300 text-xs font-bold border-b border-cyan-800 pb-2 mb-4">METRICS</h2>
<!-- Canvas for chart -->
<div class="mb-6">
<canvas id="purpose-chart" width="320" height="200" class="border border-cyan-900"></canvas>
<div class="text-center text-xs text-cyan-700 mt-1">PURPOSE DISTRIBUTION</div>
</div>
<!-- Stats list -->
<div class="space-y-3 text-xs">
<div class="flex justify-between">
<span class="text-cyan-700">Total Events</span>
<span id="total-events" class="text-cyan-300">0</span>
</div>
<div class="flex justify-between">
<span class="text-cyan-700">Sampled Events</span>
<span id="sampled-events" class="text-cyan-300">0</span>
</div>
<div class="flex justify-between">
<span class="text-cyan-700">Redacted Fields</span>
<span id="redacted-count" class="text-cyan-300">0</span>
</div>
<div class="flex justify-between">
<span class="text-cyan-700">Avg Latency</span>
<span id="avg-latency" class="text-cyan-300">12ms</span>
</div>
</div>
<!-- Decorative radar scan? maybe a separate canvas -->
<div class="mt-8">
<h3 class="text-xs text-cyan-300 font-bold mb-2">SYSTEM HEALTH</h3>
<div class="h-1 w-full bg-cyan-900 relative">
<div class="h-full bg-cyan-400 animate-pulse" style="width: 85%"></div>
</div>
<div class="flex justify-between text-[10px] text-cyan-700 mt-1">
<span>CPU</span>
<span>MEM</span>
<span>NET</span>
</div>
</div>
</aside>
Now CSS styles:
- Scanlines: fixed overlay with repeating linear gradient.
- Vignette: radial gradient.
- Custom scrollbar styling.
- Toggle switch for redaction? Use CSS to style checkbox.
- Neon glow: box-shadow.
- For feed items: maybe a rotated line? Or grid lines? Use a monospace formatted JSON view. Could use a code block with syntax highlighting: sensitive fields in red? Actually redacted fields could be shown as "[REDACTED]" in a different color (maybe bright red or magenta).
- Purpose tag as a small badge with background color based on purpose (analytics: cyan, security: blue? Actually we have colors: maybe analytics: cyan, security: green? But we want neon. Could use: analytics (cyan), security (magenta), billing (amber). Use consistent color scheme.
Add micro-interactions:
-
When hovering over a feed item, it could highlight with a border and maybe show a tooltip with full data? Actually the data is truncated; maybe show full raw JSON in a modal? But simpler: expand to full view? Could make each feed item collapsible? Perhaps just a simple hover effect that scales slightly, box-shadow glow.
-
Sliders: custom styling to look techy.
-
Glitch effect on title occasionally.
I'll also add a canvas in the center? Possibly a background grid that moves? Could add a subtle moving grid.
Also, need to simulate data generation. Use JavaScript to create events:
function generateEvent() {
const types = ['page_view', 'click', 'purchase', 'login', 'error', 'api_call'];
const eventType = types[Math.floor(Math.random()*types.length)];
const timestamp = new Date().toISOString();
// Determine purpose based on eventType
let purpose = 'analytics';
switch(eventType) {
case 'purchase': purpose = 'billing'; break;
case 'login': purpose = 'security'; break;
case 'error': purpose = 'ops'; break;
}
const event = {
id: Math.random().toString(36).substr(2,9),
event_type: eventType,
timestamp: timestamp,
user_id: 'USER_' + Math.floor(Math.random()*10000),
session_id: 'SESS_' + Math.random().toString(36).substr(2,8),
ip_address: ${Math.floor(Math.random()*255)}.${Math.floor(Math.random()*255)}.${Math.floor(Math.random()*255)}.${Math.floor(Math.random()*255)},
email: user${Math.floor(Math.random()*10000)}@example.com,
location: { lat: (Math.random()*180-90).toFixed(4), lng: (Math.random()*360-180).toFixed(4) },
device: { os: ['Windows','macOS','Linux','iOS','Android'][Math.floor(Math.random()*5)], browser: ['Chrome','Firefox','Safari','Edge'][Math.floor(Math.random()*4)] },
purpose: purpose
};
return event;
}
Then apply sampling: based on global sample rate (e.g., 10%). Only a fraction of events are "sampled" and displayed. But we also want to count all incoming events (simulated) and sampled events separately.
Redaction: If enabled, replace certain fields with "[REDACTED]". Also maybe hash? But simple redaction.
When displaying an event, format it as a JSON-like snippet. Use color-coded keys and values. For redacted values, use a special class (e.g., text-red-500 or text-magenta).
Also show purpose badge: small colored square with purpose text.
The feed should be a list, each entry maybe a box with a border, containing:
- Top line: event id timestamp maybe [PURPOSE: analytics]
- Then formatted JSON (maybe pretty printed with indentation). Could use .
Keep it monospace, small text.
To avoid performance issues with too many DOM nodes, limit the number of displayed items (e.g., keep last 50) and remove old ones.
Now, the stats panel: we need to update counts: totalEvents, sampledEvents, redactedFieldsCount (sum of redacted fields across sampled events? Or across all events? Probably across collected data). So if redaction is applied, count those fields.
Also purpose distribution: we can keep counts per purpose and draw a bar chart or pie chart on canvas.
I'll create a function updateStats() that updates the stats display.
For the purpose chart: draw a horizontal bar chart with each purpose. Or a stacked vertical bar? Since it's small, maybe simple bars: each purpose gets a bar with width proportional to its count.
Implementation:
In JS, maintain:
let totalEvents = 0;
let sampledEvents = 0;
let redactedCount = 0;
let purposeCounts = {};
On each generated event (incoming), totalEvents++. If it passes sampling (random < sampleRate/100), then sampledEvents++. Process redaction: for each field that is redacted (based on checkboxes), if redaction enabled and field exists, replace value with "[REDACTED]" and increment redactedCount. Also increment purposeCounts[event.purpose]++.
Then create DOM element for feed (only if sampled). Append to feed. Periodically prune feed (keep max children, e.g., 100).
Update the stats display: set textContent of elements.
Redraw the purpose chart: clear canvas, draw bars.
Logging: add messages to log output for significant events: when sampling rate changes, redaction toggle, maybe when purpose tags are used? Keep a truncated log (last 10 lines). Use a function log(message).
Add interactivity: Slider changes update sampling rate variable and log. Checkboxes update redaction settings and log.
Now design details:
Colors:
- Primary cyan: #00f3ff (Tailwind: cyan-400 maybe? Actually cyan-400 is #22d3ee; neon cyan could be #00ffff or brighter. I'll use #00f3ff as a custom color.)
- Secondary magenta: #ff00ff
- Amber: #ffaa00
- Background: #050505
I'll define these in Tailwind config inside the style tag? Could use arbitrary values: style="color:#00f3ff". But easier: define custom CSS variables.
Better: define in Tailwind via config in script tag:
Then use classes like text-neon-cyan.
But I need to ensure the font loads. Use Google Fonts:
Now CSS effects:
.scanlines:
position: fixed; top:0; left:0; width:100%; height:100%; pointer-events:none; background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0, 243, 255, 0.03) 50%, rgba(0,0,0,0) 100%); background-size: 100% 4px; z-index: 9999;
Alternatively, a repeating linear gradient: background: repeating-linear-gradient(0deg, transparent, transparent 1px, rgba(0, 243, 255, 0.05) 1px, rgba(0, 243, 255, 0.05) 2px);
Vignette: radial-gradient(circle, transparent 60%, black 100%); fixed overlay.
Custom scrollbar for webkit browsers.
Toggle switch: style checkbox as a sliding toggle.
Feed item styling:
border: 1px solid #0a3d3d (darker cyan) maybe #0a4a4a? Use border-cyan-900. Add a left border glow on hover: border-l-2 border-neon-cyan.
Glow: box-shadow: 0 0 5px rgba(0,243,255,0.3).
Use a monospace pre inside.
Syntax highlighting: keys in neon-amber? Or neon-magenta? Let's pick: keys in neon-amber (#ffaa00), string values in neon-cyan, numbers in neon-magenta, redacted in bright red (#ff3333) with maybe a glitch effect? Actually redacted could be magenta? Or we can use a cross-out. Simpler: redacted text in neon-red (#ff0055). Keep color scheme limited.
I'll create a function to syntax highlight a JS object to HTML.
For performance, use a simple approach: loop over keys, create spans with classes.
But easier: use JSON.stringify with custom replacer? No, we need HTML. I'll create a function formatEvent(event) that returns an HTML string (or create elements). It should display lines like:
{
"id": "abc123",
"event_type": "page_view",
"purpose": "analytics",
...
}
But we can also format as one line with less indentation to save space. However, the FUI aesthetic often shows many lines. Maybe we show a compact multi-line.
Let's design each feed item as:
But we need to ensure the JSON is not too long; we can truncate if long? Not necessary.
The formatted JSON: keys in amber, string values in cyan, numbers in magenta, boolean maybe green? Actually keep simple: numbers magenta. Redacted values use a class like text-red-500 or text-neon-magenta? Actually redaction could be shown as "[REDACTED]" in blinking red? Might be too flashy. Use #ff0055 with a line-through? Or just bold.
We'll define CSS classes: .key { color: #ffaa00; } .string { color: #00f3ff; } .number { color: #ff00ff; } .redacted { color: #ff0055; text-shadow: 0 0 5px #ff0055; }
Now for the purpose badge colors: analytics -> cyan-500, security -> magenta-500, billing -> amber-500, others maybe default.
Now, the canvas chart: draw a simple bar chart. For each purpose in purposeCounts, draw a horizontal bar with length proportional to its count relative to max. Use fillRect with color corresponding to purpose.
We need to animate the chart? Could redraw periodically.
Now, logging: log messages should appear with timestamp [HH:MM:SS.ms]? Could use performance.now for ms.
Implementation steps:
- HTML structure with Tailwind classes.
- Add custom CSS for effects.
- JavaScript: state variables, event generation loop (setInterval every X ms, maybe 200-500ms).
- Process event: apply sampling, redaction, create feed item.
- Update stats and chart.
- Add event listeners for controls.
- Clock update.
- Add initial log messages.
Let's start coding.
Note: The design should be intricate, so we add many decorative borders, maybe corner brackets on panels, and some animated elements.
Add a rotating radar-like circle in the right panel? That could be cool: a canvas drawing a rotating line sweep. That can be done with requestAnimationFrame.
But to keep code manageable, maybe a static but animated (rotating) element with CSS.
For example, create a circle with a dashed border that rotates.
But we already have canvas for purpose chart; we could also have a second canvas for a radar scan. However, the spec says "Data Visualization: use holographic, 3D, etc." So we could make a simple 3D wireframe terrain using Three.js? That might be overkill and increase code significantly. But we can simulate a wireframe grid moving in perspective with canvas. Might be too complex. Let's stick with a 2D canvas that draws a rotating radar scan and some blips representing telemetry sources? That adds depth.
We have two aside panels; one for controls and one for metrics. The metrics aside currently has the chart and system health. We can add a canvas for a radar display showing "Nodes" (sources) and their status. That would be a nice FUI element.
Let's allocate a canvas for "NETWORK TOPOLOGY". Draw a circular radar with rotating scan line, and some dots near the edge representing active nodes. The dots could pulse. This is feasible with canvas.
Design:
- Canvas with a dark background, cyan circle outline, crosshairs.
- A rotating gradient line sweeping.
- Dots at random positions but fixed? Could generate a set of nodes and update their activity based on recent events.
Simplify: just a static list of node positions and a rotating line; nodes light up when there is an event from that node? But we need to map event to node ID? Could just randomly blink some nodes.
I'll keep it simple: draw a radar with a sweep, and occasional flashes on some nodes to simulate activity.
But time: maybe we skip this for now to ensure we have a functional demo; we can focus on the main feed and metrics. However, the design principles require "intricate structure" and "monospace". We already have that. A rotating radar would add complexity but also cool factor. I'll add a small radar canvas (100x100 maybe) in the metrics panel.
Alternatively, we can use CSS to create a rotating circle with borders. That is easier and lightweight.
But the radar scan line effect: we can use a gradient on a pseudo-element and rotate.
Let's do: a div with class "radar" containing a circle with border, and a scanning line using an attached gradient that rotates.
But we also need to show some "targets" (dots) that appear randomly. Could be static but with opacity changes.
Maybe we can generate random points and draw them on a canvas to have more control. I'll use a simple canvas.
Right panel metrics:
- Purpose chart canvas (already there)
- Radar canvas below.
- Stats.
So we need two canvases. That's fine.
Now, code structure:
HTML:
Now JavaScript: after DOM load, set up canvases contexts, and start animation loops for radar (requestAnimationFrame). Radar: draw circle, crosshairs, sweep line rotating, and draw some fixed points (maybe 5-8) around the circle. When sweep line passes a point, make it brighter or flash. That's doable.
We also need to ensure the feed scrolls automatically to the newest item? Possibly, but not required.
Now, add the HUD corners: many panels have decorative corners. Use pseudo-elements with borders. Could add a class .corner-box to panels.
Simplify: add absolute positioned divs at corners inside each panel.
For the header: maybe an underline with a moving light.
Also, the overall HUD: have a grid background? Could use a radial gradient with grid lines drawn by CSS linear-gradient? Might be heavy.
Maybe use a fixed background with a transparent grid image? But we can recreate with CSS: background-image: linear-gradient(rgba(0, 243, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 243, 255, 0.05) 1px, transparent 1px); background-size: 20px 20px; This would be subtle.
Add that to body: background: #050505; plus grid.
Now, glitch effect on title: Use CSS keyframes to randomly offset and change color.
I'll add a .glitch class.
Now, code writing.
Let's start with the HTML skeleton.
We'll include Tailwind via CDN:
Add Google Fonts:
Then define tailwind config.
Now, write CSS in a block.
Tailwind already provides many utilities, but we need custom for:
- Toggle switch: we can style the checkbox. Use a hidden checkbox and a label with ::before/after.
But simpler: use a toggle-switch class and style the checkbox with appearance-none? We'll do:
.toggle-checkbox {
appearance: none;
width: 40px;
height: 20px;
background: #0a3d3d;
border: 1px solid #00f3ff;
border-radius: 10px;
position: relative;
outline: none;
transition: background 0.3s;
}
.toggle-checkbox::after {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: 16px;
height: 16px;
background: #00f3ff;
border-radius: 50%;
transition: left 0.3s;
box-shadow: 0 0 5px #00f3ff;
}
.toggle-checkbox:checked {
background: #003333;
border-color: #00ffaa;
}
.toggle-checkbox:checked::after {
left: 22px;
background: #00ffaa;
box-shadow: 0 0 8px #00ffaa;
}
But note: color values should fit theme. I'll keep.
.scanlines {
position: fixed;
top:0; left:0; width:100%; height:100%;
pointer-events:none;
background: repeating-linear-gradient(0deg, transparent 0px, transparent 1px, rgba(0, 243, 255, 0.03) 1px, rgba(0, 243, 255, 0.03) 2px);
z-index: 9999;
}
.vignette {
position: fixed;
top:0; left:0; width:100%; height:100%;
pointer-events:none;
background: radial-gradient(circle at center, transparent 50%, black 100%);
z-index: 9998;
}
- Custom scrollbar for webkit:
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: #050505;
}
::-webkit-scrollbar-thumb {
background: #0a4a4a;
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: #00f3ff;
}
- Feed item style: maybe also a scanning line over the feed item? Not needed.
Now, JavaScript.
I'll write the code in a tag at the end of body.
Define state:
let config = {
sampleRate: 10, // percent
redactionEnabled: true,
redactFields: ['email', 'ip_address', 'location', 'user_id'] // location is an object? We'll redact whole object? We can convert to "[REDACTED]"
};
let stats = {
totalEvents: 0,
sampledEvents: 0,
redactedCount: 0,
purposeCounts: { analytics:0, security:0, billing:0, ops:0 }
};
Event generation:
setInterval(generateAndProcessEvent, 300); // adjust as needed
Function generateAndProcessEvent:
- create event
- increment totalEvents
- determine if sampled: if Math.random()*100 < config.sampleRate, then process for display; else just count as unsampled? Actually we might still want to update stats for sampling? Typically sampling means only a subset is collected. So unsampled events are dropped entirely (not stored). But for demo we might want to show that they are being filtered. But we can count total incoming and sampled separately; unsampled are not displayed.
- If sampled:
- apply redaction: if config.redactionEnabled, for each field in config.redactFields, if event has that field, set to "[REDACTED]" and increment stats.redactedCount (per field? count each redacted occurrence).
- Also purpose count increment.
- Create feed item element and prepend to feed container (or append and then scroll). Keep only max children.
- Update stats display.
- Occasionally log.
Feed item creation:
function createFeedItem(event) {
const div = document.createElement('div');
div.className = 'feed-item border border-cyan-900 bg-black/60 p-2 relative hover:border-neon-cyan hover:shadow-[0_0_8px_rgba(0,243,255,0.5)] transition-all duration-300 mb-2';
// ID line
const idSpan = <span class="text-amber-300">[ID:${event.id}]</span>;
const time = new Date(event.timestamp).toLocaleTimeString('en-US', {hour12: false, fractionalSecondDigits: 3}) + '.' + new Date(event.timestamp).getMilliseconds();
// But we already have timestamp string. We'll use the ISO and format? Could just use the full ISO?
const timeStr = <span class="text-cyan-700">${event.timestamp.substring(11,19)}</span>; // HH:MM:SS
// Purpose badge
const badgeClass = getPurposeColor(event.purpose);
div.innerHTML = <div class="flex justify-between text-[10px] mb-1"> ${idSpan} ${timeStr} </div> <div class="purpose-badge absolute top-1 right-1 text-[10px] px-1 rounded bg-${badgeClass}-900/50 border border-${badgeClass}-500 text-${badgeClass}-300">${event.purpose}</div> <pre class="text-xs whitespace-pre overflow-hidden">${formatJSON(event)}</pre> ;
return div;
}
But we need to define getPurposeColor mapping: analytics->cyan, security->magenta, billing->amber, ops->blue? Use classes like 'text-cyan-300', but for badge background we need a semi-transparent. Use utility classes like bg-cyan-900/50? That's available in Tailwind? Actually Tailwind supports opacity in backgrounds: bg-cyan-900/50 is valid. So we need to ensure that we don't conflict with arbitrary values? It's fine if we have defined colors. But Tailwind's default cyan-900 is #164e63. That's okay.
But we need to use dynamic class; we can use template string.
Better: define a mapping:
const purposeColors = {
analytics: 'cyan',
security: 'magenta',
billing: 'amber',
ops: 'blue' // but we don't have blue in our scheme? Could use 'blue' but it's not neon. We only have cyan, magenta, amber. Could use red? We'll just map to cyan as default. We'll only use these three; event default to analytics.
Actually event types: page_view, click, purchase, login, error, api_call. Purpose mapping:
- page_view, click, api_call: analytics
- purchase: billing
- login: security
- error: ops (maybe we need a fourth). We'll handle ops by using magenta? Or use cyan? Let's keep three: maybe error also maps to security? Not logical. We can define ops as magenta? But magenta is used for security. Perhaps we map error to 'security' as well? But error might be ops. Could assign error to 'ops' and use a different color? We have amber available? But amber is for billing. We have only three colors. Could use red? But red is not in our primary palette. However we can use a color like 'red' for ops? Could add a custom color red-500? Might deviate. Alternatively, we could use shades of cyan for others. To keep limited palette, we could treat all non-billing as cyan? That loses distinction. Maybe we add a fourth: 'operations' with purple? But we only have neon cyan, magenta, amber. We could use magenta for ops and security? Actually security and ops are both important, maybe we can combine? Not necessary for demo. We'll keep four purposes and assign colors: analytics: cyan, security: magenta, billing: amber, ops: green? But green not in palette. But we could use a muted color. I think we can keep within three by mapping error to security or analytics? Hmm.
Simplify: let's only have three purposes: analytics, security, billing. Map error to analytics? That doesn't fit. But we can define more purpose tags in config panel but we only have three in demo. For simplicity, we can generate events only with purposes: analytics, security, billing. We'll adjust generation accordingly: only those three event types. So we won't have error or ops. We could have page_view, click, purchase, login only. That's fine.
So we'll have:
const eventTypes = [
{ type: 'page_view', purpose: 'analytics' },
{ type: 'click', purpose: 'analytics' },
{ type: 'purchase', purpose: 'billing' },
{ type: 'login', purpose: 'security' }
];
Then randomly pick one. That's simpler.
Now formatJSON(event): We need to produce a string with spans. Since we have redaction applied on the event object, we just need to walk through the object and output. But we must not iterate inherited properties. Also ensure order? We can define a specific order: id, event_type, timestamp, purpose, then other fields: user_id, session_id, ip_address, email, location, device maybe. But we can just iterate keys in that order? We can define an order array.
Better: We'll create a string representation with keys in a fixed order for consistency. We'll also want to mask location as either redacted or as a string? If location is redacted, we replace whole object with "[REDACTED]". If not redacted, we might want to show as JSON string? We could stringify the location object. But then formatting becomes nested. For simplicity, we'll flatten: treat location as a string: {lat: ..., lng: ...} or if redacted, "[REDACTED]". We'll have event.location as either the object or the string. Actually location is an object initially. For display, we could convert to a string like location: { lat: ..., lng: ... } but then we need to embed it in the JSON-like output. Our formatJSON will produce HTML, so we can handle objects by JSON.stringify them.
Define:
function formatJSON(obj) {
// We'll manually format with indentation
let html = '{\n';
const keys = ['id', 'event_type', 'timestamp', 'purpose', 'user_id', 'session_id', 'ip_address', 'email', 'location', 'device'];
// But some events may not have all? We'll include all defined keys.
for (let i=0; i<keys.length; i++) {
const key = keys[i];
let value = obj[key];
if (value === undefined) continue;
// If value is object and not a string? Actually location and device are objects. We'll stringify them with spaces.
let displayValue;
if (value && typeof value === 'object') {
displayValue = JSON.stringify(value);
} else {
displayValue = value;
}
// Determine if this value should be styled as redacted? We could have a flag on the object? We'll have replaced redacted values with a string "[REDACTED]". We can check if displayValue === '[REDACTED]' and apply redacted class.
let valSpan;
if (displayValue === '[REDACTED]') {
valSpan = <span class="redacted">"[REDACTED]"</span>;
} else if (typeof displayValue === 'string') {
valSpan = <span class="string">"${escapeHtml(displayValue)}"</span>;
} else if (typeof displayValue === 'number') {
valSpan = <span class="number">${displayValue}</span>;
} else {
// fallback
valSpan = <span>${escapeHtml(String(displayValue))}</span>;
}
html += ` "key"</span>:{valSpan}${i < keys.length-1 ? ',' : ''}\n';
}
html += '}';
return html;
}
But we need escapeHtml to avoid injection (though we generate). We'll just replace &, <, >, ", '.
Define escapeHtml function.
But note: we are using template literals with backticks and single quotes inside. Need to be careful.
Also, we might want to avoid recursion; it's shallow.
Now, the feed container: we'll prepend new items so newest on top. We'll limit to 50.
function addFeedItem(event) {
const feed = document.getElementById('telemetry-feed');
const item = createFeedItem(event);
feed.insertBefore(item, feed.firstChild);
if (feed.children.length > 50) {
feed.removeChild(feed.lastChild);
}
}
Now, updateStats: we can update the DOM after each event or throttle. We'll update every time for simplicity.
Update purpose chart: drawBars();
drawBars:
function drawChart() {
const canvas = document.getElementById('purpose-chart');
const ctx = canvas.getContext('2d');
const width = canvas.width;
const height = canvas.height;
ctx.clearRect(0,0,width,height);
// Draw background
ctx.fillStyle = '#050505';
ctx.fillRect(0,0,width,height);
// Draw grid lines? maybe not.
const purposes = Object.keys(stats.purposeCounts);
const maxCount = Math.max(...purposes.map(p => stats.purposeCounts[p]), 1);
const barHeight = 20;
const spacing = 10;
const totalHeight = purposes.length * (barHeight + spacing);
let y = (height - totalHeight) / 2; // center vertically
purposes.forEach(p => {
const count = stats.purposeCounts[p];
const barWidth = (count / maxCount) * (width - 80); // leave space for label
const color = purposeColors[p] === 'cyan' ? '#00f3ff' : purposeColors[p] === 'magenta' ? '#ff00ff' : '#ffaa00';
ctx.fillStyle = '#0a3d3d'; // background track
ctx.fillRect(40, y, width-80, barHeight);
// bar
ctx.fillStyle = color;
ctx.fillRect(40, y, barWidth, barHeight);
// label
ctx.fillStyle = '#ffaa00'; // use amber for text
ctx.font = '10px "JetBrains Mono"';
ctx.textAlign = 'right';
ctx.fillText(p, 38, y + barHeight/2 + 3);
// count value
ctx.fillStyle = '#00f3ff'; // cyan for count
ctx.textAlign = 'left';
ctx.fillText(count, 45 + barWidth, y + barHeight/2 + 3);
y += barHeight + spacing;
});
}
Note: we need purposeColors defined to map to hex. We'll use same mapping: cyan->#00f3ff, magenta->#ff00ff, amber->#ffaa00.
Now radar canvas:
function initRadar() {
const canvas = document.getElementById('radar-scan');
const ctx = canvas.getContext('2d');
const width = canvas.width;
const height = canvas.height;
const cx = width/2;
const cy = height/2;
const radius = Math.min(width,height)/2 - 10;
// Generate static nodes: positions as angles and distances
const nodes = [];
for (let i=0; i<8; i++) {
const angle = Math.random() * Math.PI * 2;
const dist = radius * 0.7 + Math.random() * radius * 0.3; // between 70% and 100% radius
nodes.push({angle, dist, active: false, timer: 0});
}
let sweepAngle = 0;
const sweepSpeed = 0.02; // rad per frame
function animate() {
// Clear with semi-transparent black for trail? We want clear each frame for crisp.
ctx.fillStyle = '#050505';
ctx.fillRect(0,0,width,height);
// Draw concentric circles
ctx.strokeStyle = 'rgba(0, 243, 255, 0.3)';
ctx.lineWidth = 1;
ctx.beginPath();
ctx.arc(cx, cy, radius, 0, Math.PI2);
ctx.stroke();
ctx.beginPath();
ctx.arc(cx, cy, radius0.7, 0, Math.PI2);
ctx.stroke();
ctx.beginPath();
ctx.arc(cx, cy, radius0.4, 0, Math.PI*2);
ctx.stroke();
// Crosshairs
ctx.beginPath();
ctx.moveTo(cx, cy - radius);
ctx.lineTo(cx, cy + radius);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(cx - radius, cy);
ctx.lineTo(cx + radius, cy);
ctx.stroke();
// Sweep sector
const gradient = ctx.createConicGradient(sweepAngle - Math.PI/2, cx, cy);
gradient.addColorStop(0, 'rgba(0, 243, 255, 0)');
gradient.addColorStop(0.8, 'rgba(0, 243, 255, 0)');
gradient.addColorStop(1, 'rgba(0, 243, 255, 0.3)');
ctx.fillStyle = gradient;
ctx.fillRect(0,0,width,height); // fill entire canvas with gradient mask? Actually conic gradient works on the canvas? We can use a simpler: draw a wedge with arc? But conic gradient might not be supported in all browsers? It is widely supported now. We'll use it.
// Or draw a sweep line as a line with gradient stroke.
// Let's just draw a line:
ctx.beginPath();
ctx.moveTo(cx, cy);
const ex = cx + Math.cos(sweepAngle) * radius;
const ey = cy + Math.sin(sweepAngle) * radius;
ctx.lineTo(ex, ey);
ctx.strokeStyle = 'rgba(0, 243, 255, 0.8)';
ctx.lineWidth = 2;
ctx.stroke();
// Draw nodes
nodes.forEach(node => {
const x = cx + Math.cos(node.angle) * node.dist;
const y = cy + Math.sin(node.angle) * node.dist;
// Determine if within sweep? Actually we want nodes to light up when sweep passes. We'll compare node.angle to sweepAngle (normalized). Since sweep rotates, we can compute angular distance.
// Normalize angles to [0, 2π]
// We'll have a variable lastSweepAngle? Actually we can check if sweepAngle is within some epsilon of node.angle (mod 2π). But sweepAngle increases continuously; we can maintain normalized version.
// Simpler: randomly set node active for a few frames.
if (node.active) {
ctx.fillStyle = '#ff00ff'; // magenta when active
ctx.beginPath();
ctx.arc(x, y, 4, 0, Math.PI*2);
ctx.fill();
// glow
ctx.shadowBlur = 10;
ctx.shadowColor = '#ff00ff';
} else {
ctx.fillStyle = '#0a4a4a';
ctx.beginPath();
ctx.arc(x, y, 3, 0, Math.PI*2);
ctx.fill();
ctx.shadowBlur = 0;
}
node.timer--;
if (node.timer <= 0) node.active = false;
});
// Randomly activate a node occasionally to simulate events
if (Math.random() < 0.05) {
const node = nodes[Math.floor(Math.random() * nodes.length)];
node.active = true;
node.timer = 10; // frames
}
sweepAngle += sweepSpeed;
if (sweepAngle > Math.PI*2) sweepAngle -= Math.PI*2;
requestAnimationFrame(animate);
}
animate();
}
Start radar after DOM loaded.
Now, about the clock: update every second.
function updateClock() {
const now = new Date();
const str = now.toISOString().split('T')[1].split('.')[0] + ' UTC';
document.getElementById('clock').textContent = str;
}
Initialize.
Now, log function:
function log(msg) {
const logOut = document.getElementById('log-output');
const line = document.createElement('div');
const time = new Date().toISOString().split('T')[1].split('.')[0];
line.textContent = [${time}] ${msg};
line.className = 'text-cyan-400 mb-1';
logOut.insertBefore(line, logOut.firstChild);
if (logOut.children.length > 20) {
logOut.removeChild(logOut.lastChild);
}
}
Now, event listeners for controls:
-
Slider: on input, update sampleRate variable and display value. Also log change.
-
Redaction toggle: change config.redactionEnabled, log.
-
Redaction field checkboxes: update config.redactFields based on which are checked. Could log minor changes? Maybe not.
-
Purpose policies: not interactive (just display). Could be made interactive but not needed.
Now, also we need to ensure that when redaction is toggled, it affects future events only; we don't reprocess already displayed events. That's fine.
Now, implement the data generation:
const eventTemplates = [
{ type: 'page_view', purpose: 'analytics', fields: {} },
{ type: 'click', purpose: 'analytics', fields: {} },
{ type: 'purchase', purpose: 'billing', fields: {} },
{ type: 'login', purpose: 'security', fields: {} }
];
Each event we generate random fields? Actually we want consistent fields. We'll have a base set.
Implement generateEvent():
function generateEvent() {
const template = eventTemplates[Math.floor(Math.random() * eventTemplates.length)];
const now = new Date();
const timestamp = now.toISOString();
const id = Math.random().toString(36).substr(2,9).toUpperCase();
const event = {
id: id,
event_type: template.type,
timestamp: timestamp,
purpose: template.purpose,
user_id: 'USER_' + Math.floor(Math.random()*10000),
session_id: 'SESS_' + Math.random().toString(36).substr(2,8),
ip_address: ${Math.floor(Math.random()*255)}.${Math.floor(Math.random()*255)}.${Math.floor(Math.random()*255)}.${Math.floor(Math.random()*255)},
email: user${Math.floor(Math.random()*10000)}@example.com,
location: { lat: (Math.random()*180-90).toFixed(4), lng: (Math.random()*360-180).toFixed(4) },
device: { os: ['Windows','macOS','Linux','iOS','Android'][Math.floor(Math.random()*5)], browser: ['Chrome','Firefox','Safari','Edge'][Math.floor(Math.random()*4)] }
};
return event;
}
Now, processing:
function processEvent(rawEvent) {
stats.totalEvents++;
// Sampling
if (Math.random()*100 < config.sampleRate) {
// This event is sampled
const event = {...rawEvent}; // copy
// Apply redaction
let redactedAny = false;
if (config.redactionEnabled) {
for (const field of config.redactFields) {
if (event.hasOwnProperty(field)) {
event[field] = '[REDACTED]';
stats.redactedCount++;
redactedAny = true;
}
}
}
// Purpose count
stats.purposeCounts[event.purpose] = (stats.purposeCounts[event.purpose] || 0) + 1;
stats.sampledEvents++;
// Create feed item
addFeedItem(event);
// Update UI counts
updateStatsUI();
} else {
// unsampled, but we still might want to update total events display? yes, but sampled count remains.
updateStatsUI(); // to update total events
}
}
But we need to update the feed counts in the header (incoming count and sampled count) as well? Actually the center panel header shows "INCOMING: X" and "SAMPLED: Y". So we should update those.
We'll maintain separate counts: totalIncoming and totalSampled (sampledEvents). And display totalIncoming in incoming count, sampledEvents in sampled count. Also maybe total redacted count.
In updateStatsUI:
document.getElementById('incoming-count').textContent = stats.totalEvents.toLocaleString();
document.getElementById('sampled-count').textContent = stats.sampledEvents.toLocaleString();
document.getElementById('total-events').textContent = stats.totalEvents.toLocaleString();
document.getElementById('sampled-events').textContent = stats.sampledEvents.toLocaleString();
document.getElementById('redacted-count').textContent = stats.redactedCount.toLocaleString();
// avg latency? simulate: random 10-20ms maybe with jitter
let latency = Math.floor(10 + Math.random()*5);
document.getElementById('avg-latency').textContent = latency+'ms';
Then drawChart().
Now, we also need to handle checkboxes for redaction fields. We'll have an array of checkboxes with ids: redact-email, redact-ip, redact-location, redact-userid. On change, update config.redactFields accordingly: check those that are checked.
We can do:
document.querySelectorAll('input[type=checkbox]').forEach(cb => {
if (cb.id.startsWith('redact-')) {
cb.addEventListener('change', () => {
config.redactFields = [];
if (document.getElementById('redact-email').checked) config.redactFields.push('email');
if (document.getElementById('redact-ip').checked) config.redactFields.push('ip_address');
if (document.getElementById('redact-location').checked) config.redactFields.push('location');
if (document.getElementById('redact-userid').checked) config.redactFields.push('user_id');
log(Redaction fields updated: ${config.redactFields.join(', ')});
});
}
});
For the main redaction toggle:
document.getElementById('redaction-toggle').addEventListener('change', (e) => {
config.redactionEnabled = e.target.checked;
log(Redaction ${config.redactionEnabled ? 'ENABLED' : 'DISABLED'});
});
For sampling slider:
const sampleSlider = document.getElementById('sample-rate');
const sampleVal = document.getElementById('sample-rate-val');
sampleSlider.addEventListener('input', (e) => {
config.sampleRate = parseInt(e.target.value);
sampleVal.textContent = config.sampleRate + '%';
log(Sampling rate set to ${config.sampleRate}%);
});
Now, we also need to ensure the toggle switch looks like a toggle. We'll style it as described.
Now, the feed item's purpose badge color: we need dynamic classes. In createFeedItem we compute badgeClass: we'll set class as text-${color}-300 bg-${color}-900/50 border border-${color}-500 so we need to know color. We can define:
function getPurposeColor(purpose) {
switch(purpose) {
case 'analytics': return 'cyan';
case 'security': return 'magenta';
case 'billing': return 'amber';
default: return 'cyan';
}
}
Now, formatJSON: we need escapeHtml.
function escapeHtml(str) {
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
}
But note: if value is already a number, we don't need to escape. For objects, we JSON.stringify them; the result may contain quotes. We'll process as a whole string and then wrap in a span without further escaping? We may need to escape the stringified JSON? Actually we want to escape the double quotes? In HTML, inside a , we want to display the quotes. We can just put the string directly, but need to escape &, <, >. So after stringify, we need to escape. And then we cannot wrap the whole thing in a span with class for keys? We are splitting per key, so it's easier to format each key individually.
Our formatJSON builds HTML by iterating keys, so for string values we already put quotes around. That's okay.
But for location: if not redacted, we have an object. We'll JSON.stringify it and then treat it as a raw string without further styling? That string will include quotes and braces. It will appear as a plain string. That's acceptable. But then we may want to escape it. So we do:
let displayValue = JSON.stringify(value); // produce string with double quotes
displayValue = escapeHtml(displayValue); // escape & < > but quotes are okay inside pre? Actually inside HTML, quotes don't need escaping if they're within text content? In a , they are fine as text. But we may need to escape double quotes if we embed within attribute? No, it's inside the element textContent so it's fine. But we are using innerHTML, so any double quote inside will be interpreted as part of HTML? Actually when setting innerHTML, double quotes are part of HTML markup? No, innerHTML expects HTML markup string; any text within should be escaped for HTML special characters: &, <, >. Double quotes are not required to be escaped unless they appear within an attribute value. So we need to escape &, <, >. So we should call escapeHtml on the stringified JSON.
So we'll do:
let displayValue = JSON.stringify(value);
displayValue = escapeHtml(displayValue);
// Then treat as a string. We won't apply class string because it's a complex string; but we could apply a generic class for objects? Maybe not needed.
We can treat it as a string and output as ...? That would color the whole string cyan? That might be okay.
So:
if (typeof value === 'object' && value !== null) {
let jsonStr = JSON.stringify(value);
jsonStr = escapeHtml(jsonStr);
valSpan = <span class="string">${jsonStr}</span>;
} else if (typeof value === 'string') {
let escaped = escapeHtml(value);
valSpan = <span class="string">"${escaped}"</span>;
} else if (typeof value === 'number') {
valSpan = <span class="number">${value}</span>;
} else {
valSpan = <span>${escapeHtml(String(value))}</span>;
}
But note: if we redacted an object field, we replaced it with string '[REDACTED]', so it will go to string case and be wrapped in quotes? Actually we want to show "[REDACTED]" without quotes? For redacted, we want to show "[REDACTED]" maybe with brackets but no quotes. So if value === '[REDACTED]', we should output specially. We'll check after redaction.
Better: we can modify how we check: if value === '[REDACTED]', we output [REDACTED] (no quotes). For string fields, we want to display as a quoted string. So we need to differentiate between a normal string (value.typeof === 'string' and not redacted) and redacted.
So:
if (value === '[REDACTED]') {
valSpan = <span class="redacted">[REDACTED]</span>;
} else if (typeof value === 'string') {
valSpan = <span class="string">"${escapeHtml(value)}"</span>;
} else if (typeof value === 'object') {
let jsonStr = escapeHtml(JSON.stringify(value));
valSpan = <span class="string">${jsonStr}</span>;
} else {
valSpan = <span class="number">${value}</span>;
}
That works.
Now, also the 'id' is a string; will be quoted.
Now, we must ensure that the JSON output is properly indented. We'll add spaces and newline.
Our formatJSON builds a string with newline characters and indentation (two spaces). That's okay.
Now, we need to ensure that the feed item doesn't overflow horizontally; we can set overflow-x: auto; or pre-wrap? We want monospace, and horizontal scroll may be needed. But the panel has fixed width. We'll set pre to overflow-x: auto; white-space: pre; and maybe a max-height? We'll let it expand.
Now, the chart: we need to handle high-DPI? Not necessary.
Now, the radar: we made canvas size in HTML as width="240" height="240". Good.
Now, initial log messages: on load, log system initialization.
Add:
log('SYSTEM INITIALIZED');
log('Privacy module loaded');
log('Telemetry stream active');
Also on configuration changes.
Now, we should also simulate incoming events even when sample rate is 0? The total will increase but no feed items. That's fine.
Now, we must ensure the sampling rate is applied correctly: we use Math.random()*100 < sampleRate. That works.
Now, we need to consider performance: generating events every 300ms is fine.
Now, add a visual effect for the feed: maybe a scanning line overlay on each item? Could be too heavy.
We can add a subtle border-left that pulses when a new item appears? Use CSS keyframes to fade in.
Add:
@keyframes slideIn {
from { opacity: 0; transform: translateX(-20px); }
to { opacity: 1; transform: translateX(0); }
}
.feed-item {
animation: slideIn 0.3s ease-out;
}
Now, we need to ensure the distinctive FUI typography: uppercase headers, small letter spacing, etc.
Adjust header: text-uppercase tracking-widest.
Now, the corners: We'll add corner decorations to panels. For each main panel (aside left, main, aside right, footer), we can add pseudo elements or divs.
For simplicity, we add a class .panel and style:
.panel {
position: relative;
border: 1px solid #0a3d3d; // maybe already have borders
}
.panel::before, .panel::after, .panel .corner-br, .panel .corner-tl etc.
But we can just add divs with absolute positioning: corners.
Examples:
We'll add these inside each panel container.
We'll create a CSS helper class .corner to avoid repeating.
But we already have some corners on the main panel. We'll add to left and right aside and footer.
Now, final touches: glitch effect on the title? Let's skip, or add a simple CSS animation that slightly shifts.
But it's okay.
Now, one more: The overall background grid. Add to body:
background-color: #050505;
background-image:
linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
background-size: 20px 20px;
Now, consider the font: use 'JetBrains Mono'.
We'll set body { font-family: 'JetBrains Mono', monospace; }
Now, put it all together in a single HTML file.
Let's code step by step.
We'll create HTML skeleton with head and body.
Head: include Tailwind CDN, Google Fonts, style block.
Body: the structure as described.
Script: at the end.
I'll write the code now.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PRIV-TELEMETRY // System Interface</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;600&display=swap" rel="stylesheet">
<script>
tailwind.config = {
theme: {
extend: {
colors: {
neon: {
cyan: '#00f3ff',
magenta: '#ff00ff',
amber: '#ffaa00',
dark: '#050505'
}
},
fontFamily: {
mono: ['"JetBrains Mono"', 'monospace']
},
boxShadow: {
'glow': '0 0 8px rgba(0, 243, 255, 0.6)',
'glow-magenta': '0 0 8px rgba(255, 0, 255, 0.6)',
'glow-amber': '0 0 8px rgba(255, 170, 0, 0.6)',
},
backgroundImage: {
'scanlines': 'repeating-linear-gradient(0deg, transparent 0px, transparent 1px, rgba(0, 243, 255, 0.03) 1px, rgba(0, 243, 255, 0.03) 2px)',
}
}
}
}
</script>
<style>
body {
background-color: #050505;
background-image:
linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
background-size: 20px 20px;
overflow: hidden;
font-family: 'JetBrains Mono', monospace;
color: #00f3ff;
}
/* Scanlines & vignette overlays */
.scanlines {
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
pointer-events: none;
background: repeating-linear-gradient(0deg, transparent, transparent 1px, rgba(0, 243, 255, 0.03) 1px, rgba(0, 243, 255, 0.03) 2px);
z-index: 9998;
}
.vignette {
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
pointer-events: none;
background: radial-gradient(circle at center, transparent 50%, black 100%);
z-index: 9997;
}
/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #050505; }
::-webkit-scrollbar-thumb { background: #0a4a4a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #00f3ff; }
/* Toggle switch */
.toggle-checkbox {
appearance: none;
width: 40px;
height: 20px;
background: #0a3d3d;
border: 1px solid #00f3ff;
border-radius: 10px;
position: relative;
outline: none;
transition: all 0.3s;
cursor: pointer;
}
.toggle-checkbox::after {
content: '';
position: absolute;
top: 2px; left: 2px;
width: 16px; height: 16px;
background: #00f3ff;
border-radius: 50%;
transition: all 0.3s;
box-shadow: 0 0 5px #00f3ff;
}
.toggle-checkbox:checked {
background: #003333;
border-color: #00ffaa;
}
.toggle-checkbox:checked::after {
left: 22px;
background: #00ffaa;
box-shadow: 0 0 8px #00ffaa;
}
/* Feed item animation */
@keyframes slideIn {
from { opacity: 0; transform: translateX(-10px); }
to { opacity: 1; transform: translateX(0); }
}
.feed-item {
animation: slideIn 0.3s ease-out;
}
/* Syntax highlighting */
.key { color: #ffaa00; }
.string { color: #00f3ff; }
.number { color: #ff00ff; }
.redacted { color: #ff0055; text-shadow: 0 0 5px #ff0055; }
/* Purpose badge */
.badge-cyan { @apply bg-cyan-900/50 border-cyan-500 text-cyan-300; }
.badge-magenta { @apply bg-magenta-900/50 border-magenta-500 text-magenta-300; }
.badge-amber { @apply bg-amber-900/50 border-amber-500 text-amber-300; }
/* Corner decorations */
.corner {
position: absolute;
width: 8px;
height: 8px;
border-color: #00f3ff;
}
.panel {
position: relative;
}
/* Hover effects on items */
.feed-item:hover {
border-color: #00f3ff;
box-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
}
</style>
</head>
<body class="h-screen flex flex-col">
<!-- Overlays -->
<div class="scanlines"></div>
<div class="vignette"></div>
<!-- Header -->
<header class="h-12 border-b border-cyan-900 flex items-center px-4 justify-between bg-black/80 relative z-50">
<div class="flex items-center">
<span class="text-neon-cyan font-bold tracking-widest text-lg">PRIV-TELEMETRY</span>
<span class="ml-4 text-xs text-cyan-700">v2.4.7</span>
</div>
<div class="flex items-center space-x-6">
<div class="status-item flex items-center space-x-2">
<span class="text-xs text-cyan-700">SYSTEM</span>
<span class="text-neon-cyan animate-pulse text-sm">● ONLINE</span>
</div>
<div id="clock" class="text-sm text-cyan-400 font-mono"></div>
</div>
<!-- Corner decorations -->
<div class="corner top-0 left-0 border-t-2 border-l-2"></div>
<div class="corner top-0 right-0 border-t-2 border-r-2"></div>
</header>
<!-- Main Content -->
<div class="flex flex-1 overflow-hidden">
<!-- Left Panel: Configuration -->
<aside class="w-80 border-r border-cyan-900 p-4 overflow-y-auto bg-black/40 panel relative z-10">
<div class="corner top-0 left-0 border-t-2 border-l-2"></div>
<div class="corner bottom-0 right-0 border-b-2 border-r-2"></div>
<h2 class="text-neon-cyan text-xs font-bold border-b border-cyan-800 pb-2 mb-4">CONFIGURATION</h2>
<!-- Sampling -->
<div class="mb-6">
<label class="flex justify-between text-xs mb-2">
<span class="text-cyan-300">Global Sampling Rate</span>
<span id="sample-rate-val" class="text-neon-cyan">10%</span>
</label>
<input type="range" id="sample-rate" min="0" max="100" value="10" class="w-full h-2 bg-cyan-900 rounded-lg appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-neon-cyan [&::-webkit-slider-thumb]:cursor-pointer [&::-webkit-slider-thumb]:shadow-glow">
<div class="flex justify-between text-[10px] text-cyan-700 mt-1">
<span>0%</span>
<span>100%</span>
</div>
</div>
<!-- Redaction -->
<div class="mb-6">
<label class="flex items-center justify-between cursor-pointer">
<span class="text-xs text-cyan-300">Enable Data Redaction</span>
<input type="checkbox" id="redaction-toggle" checked class="toggle-checkbox">
</label>
<div class="mt-3 text-xs text-cyan-700 space-y-2">
<div class="flex items-center">
<input type="checkbox" id="redact-email" checked class="mr-2">
<label for="redact-email" class="cursor-pointer hover:text-neon-cyan transition-colors">email</label>
</div>
<div class="flex items-center">
<input type="checkbox" id="redact-ip" checked class="mr-2">
<label for="redact-ip" class="cursor-pointer hover:text-neon-cyan transition-colors">IP Address</label>
</div>
<div class="flex items-center">
<input type="checkbox" id="redact-location" checked class="mr-2">
<label for="redact-location" class="cursor-pointer hover:text-neon-cyan transition-colors">Location</label>
</div>
<div class="flex items-center">
<input type="checkbox" id="redact-userid" class="mr-2">
<label for="redact-userid" class="cursor-pointer hover:text-neon-cyan transition-colors">User ID</label>
</div>
</div>
</div>
<!-- Purpose Policies -->
<div>
<h3 class="text-xs text-neon-cyan font-bold mb-2">PURPOSE POLICIES</h3>
<div class="space-y-2 text-xs">
<div class="p-2 border border-cyan-900 bg-cyan-900/20">
<div class="flex items-center justify-between">
<span class="text-cyan-300">analytics</span>
<span class="text-[10px] px-1 bg-cyan-800 text-cyan-300 rounded">ALLOWED</span>
</div>
<div class="text-cyan-700 text-[10px] mt-1">User behavior tracking</div>
</div>
<div class="p-2 border border-magenta-900 bg-magenta-900/20">
<div class="flex items-center justify-between">
<span class="text-magenta-300">security</span>
<span class="text-[10px] px-1 bg-magenta-800 text-magenta-300 rounded">ALLOWED</span>
</div>
<div class="text-cyan-700 text-[10px] mt-1">Fraud & intrusion detection</div>
</div>
<div class="p-2 border border-amber-900 bg-amber-900/20">
<div class="flex items-center justify-between">
<span class="text-amber-300">billing</span>
<span class="text-[10px] px-1 bg-amber-900/50 text-amber-300 rounded">RESTRICTED</span>
</div>
<div class="text-cyan-700 text-[10px] mt-1">Explicit consent required</div>
</div>
</div>
</div>
</aside>
<!-- Center Panel: Live Feed -->
<main class="flex-1 p-4 overflow-y-auto relative bg-black/20">
<div class="corner top-0 left-0 border-t-2 border-l-2"></div>
<div class="corner top-0 right-0 border-t-2 border-r-2"></div>
<div class="corner bottom-0 left-0 border-b-2 border-l-2"></div>
<div class="corner bottom-0 right-0 border-b-2 border-r-2"></div>
<div class="flex justify-between items-center mb-4 px-2">
<h2 class="text-neon-cyan text-xs font-bold border-b border-cyan-800 pb-1">LIVE TELEMETRY STREAM</h2>
<div class="text-xs space-x-4">
<span class="text-cyan-700">INCOMING:</span>
<span id="incoming-count" class="text-neon-cyan font-bold">0</span>
<span class="text-cyan-700">|</span>
<span class="text-cyan-700">SAMPLED:</span>
<span id="sampled-count" class="text-neon-cyan font-bold">0</span>
</div>
</div>
<div id="telemetry-feed" class="space-y-2"></div>
</main>
<!-- Right Panel: Metrics -->
<aside class="w-80 border-l border-cyan-900 p-4 overflow-y-auto bg-black/40 panel relative z-10">
<div class="corner top-0 left-0 border-t-2 border-l-2"></div>
<div class="corner bottom-0 right-0 border-b-2 border-r-2"></div>
<h2 class="text-neon-cyan text-xs font-bold border-b border-cyan-800 pb-2 mb-4">METRICS</h2>
<!-- Purpose Chart -->
<div class="mb-6">
<canvas id="purpose-chart" width="320" height="120" class="border border-cyan-900 bg-black w-full"></canvas>
<div class="text-center text-[10px] text-cyan-700 mt-1">PURPOSE DISTRIBUTION</div>
</div>
<!-- Radar Scan -->
<div class="mb-6 flex flex-col items-center">
<canvas id="radar-scan" width="200" height="200" class="border border-cyan-900 bg-black"></canvas>
<div class="text-center text-[10px] text-cyan-700 mt-1">NETWORK TOPOLOGY</div>
</div>
<!-- Stats -->
<div class="space-y-3 text-xs">
<div class="flex justify-between">
<span class="text-cyan-700">Total Incoming</span>
<span id="total-events" class="text-neon-cyan font-mono">0</span>
</div>
<div class="flex justify-between">
<span class="text-cyan-700">Sampled Events</span>
<span id="sampled-events" class="text-neon-cyan font-mono">0</span>
</div>
<div class="flex justify-between">
<span class="text-cyan-700">Redacted Fields</span>
<span id="redacted-count" class="text-neon-magenta font-mono">0</span>
</div>
<div class="flex justify-between">
<span class="text-cyan-700">Avg Latency</span>
<span id="avg-latency" class="text-neon-cyan font-mono">--</span>
</div>
</div>
<!-- System Health -->
<div class="mt-6">
<h3 class="text-xs text-neon-cyan font-bold mb-2">SYSTEM HEALTH</h3>
<div class="h-2 w-full bg-cyan-900 relative overflow-hidden">
<div id="health-bar" class="h-full bg-gradient-to-r from-cyan-600 to-neon-cyan animate-pulse" style="width: 85%"></div>
</div>
<div class="flex justify-between text-[10px] text-cyan-700 mt-1">
<span>CPU</span>
<span>MEM</span>
<span>NET</span>
</div>
</div>
</aside>
</div>
<!-- Footer: Log -->
<footer class="h-32 border-t border-cyan-900 bg-black/80 p-2 font-mono text-xs overflow-hidden relative z-20">
<div class="corner top-0 left-0 border-t-2 border-l-2"></div>
<div class="corner top-0 right-0 border-t-2 border-r-2"></div>
<div class="text-neon-cyan mb-1">> SYSTEM LOG</div>
<div id="log-output" class="space-y-1 overflow-y-auto h-[calc(100%-1.5rem)]"></div>
</footer>
<!-- Scripts -->
<script>
// State
const config = {
sampleRate: 10,
redactionEnabled: true,
redactFields: ['email', 'ip_address', 'location', 'user_id']
};
const stats = {
totalEvents: 0,
sampledEvents: 0,
redactedCount: 0,
purposeCounts: { analytics: 0, security: 0, billing: 0 }
};
// Purpose to color mapping
const purposeColors = {
analytics: 'cyan',
security: 'magenta',
billing: 'amber'
};
// Event templates
const eventTemplates = [
{ type: 'page_view', purpose: 'analytics' },
{ type: 'click', purpose: 'analytics' },
{ type: 'purchase', purpose: 'billing' },
{ type: 'login', purpose: 'security' }
];
// Helper functions
function escapeHtml(str) {
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
}
function formatJSON(obj) {
// Fixed key order for display
const keys = ['id', 'event_type', 'timestamp', 'purpose', 'user_id', 'session_id', 'ip_address', 'email', 'location', 'device'];
let html = '{\n';
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
let value = obj[key];
if (value === undefined) continue;
let valSpan;
if (value === '[REDACTED]') {
valSpan = `<span class="redacted">[REDACTED]</span>`;
} else if (typeof value === 'string') {
valSpan = `<span class="string">"${escapeHtml(value)}"</span>`;
} else if (value && typeof value === 'object') {
const jsonStr = escapeHtml(JSON.stringify(value));
valSpan = `<span class="string">${jsonStr}</span>`;
} else {
valSpan = `<span class="number">${value}</span>`;
}
html += ` <span class="key">"${key}"</span>: ${valSpan}${i < keys.length-1 ? ',' : ''}\n`;
}
html += '}';
return html;
}
function getPurposeColor(purpose) {
return purposeColors[purpose] || 'cyan';
}
function createFeedItem(event) {
const div = document.createElement('div');
div.className = 'feed-item border border-cyan-900 bg-black/60 p-2 relative hover:border-neon-cyan hover:shadow-glow transition-all duration-300 mb-2';
const idSpan = `<span class="text-amber-300">[ID:${event.id}]</span>`;
const timeStr = `<span class="text-cyan-700">${event.timestamp.substring(11,19)}</span>`;
const badgeColor = getPurposeColor(event.purpose);
const badgeClass = `badge-${badgeColor}`; // will use CSS classes .badge-cyan etc. define them? We'll use inline style for simplicity.
// Build badge inline style
const badgeStyle = `position:absolute; top:2px; right:2px; font-size:10px; padding:1px 4px; border-radius:3px; background:${badgeColor === 'cyan' ? 'rgba(0,243,255,0.1)' : badgeColor === 'magenta' ? 'rgba(255,0,255,0.1)' : 'rgba(255,170,0,0.1)'}; border:1px solid ${badgeColor === 'cyan' ? '#00f3ff' : badgeColor === 'magenta' ? '#ff00ff' : '#ffaa00'}; color:${badgeColor === 'cyan' ? '#00f3ff' : badgeColor === 'magenta' ? '#ff00ff' : '#ffaa00'};`;
div.innerHTML = `
<div class="flex justify-between text-[10px] mb-1">
${idSpan}
${timeStr}
</div>
<div style="${badgeStyle}">${event.purpose}</div>
<pre class="text-xs whitespace-pre overflow-x-auto">${formatJSON(event)}</pre>
`;
return div;
}
function addFeedItem(event) {
const feed = document.getElementById('telemetry-feed');
const item = createFeedItem(event);
feed.insertBefore(item, feed.firstChild);
if (feed.children.length > 50) feed.removeChild(feed.lastChild);
}
function updateStatsUI() {
document.getElementById('incoming-count').textContent = stats.totalEvents.toLocaleString();
document.getElementById('sampled-count').textContent = stats.sampledEvents.toLocaleString();
document.getElementById('total-events').textContent = stats.totalEvents.toLocaleString();
document.getElementById('sampled-events').textContent = stats.sampledEvents.toLocaleString();
document.getElementById('redacted-count').textContent = stats.redactedCount.toLocaleString();
const latency = Math.floor(10 + Math.random() * 4);
document.getElementById('avg-latency').textContent = latency + 'ms';
drawChart();
}
function drawChart() {
const canvas = document.getElementById('purpose-chart');
const ctx = canvas.getContext('2d');
const width = canvas.width;
const height = canvas.height;
ctx.clearRect(0, 0, width, height);
ctx.fillStyle = '#050505';
ctx.fillRect(0, 0, width, height);
const purposes = Object.keys(stats.purposeCounts);
const maxCount = Math.max(...purposes.map(p => stats.purposeCounts[p] || 0), 1);
const barHeight = 16;
const spacing = 8;
const totalHeight = purposes.length * (barHeight + spacing);
let y = (height - totalHeight) / 2;
const leftMargin = 50;
const rightMargin = 10;
const availWidth = width - leftMargin - rightMargin;
purposes.forEach(p => {
const count = stats.purposeCounts[p] || 0;
const barWidth = (count / maxCount) * availWidth;
const colorHex = purposeColors[p] === 'cyan' ? '#00f3ff' : purposeColors[p] === 'magenta' ? '#ff00ff' : '#ffaa00';
// Background track
ctx.fillStyle = 'rgba(10, 61, 61, 0.5)';
ctx.fillRect(leftMargin, y, availWidth, barHeight);
// Bar
ctx.fillStyle = colorHex;
ctx.shadowColor = colorHex;
ctx.shadowBlur = 4;
ctx.fillRect(leftMargin, y, barWidth, barHeight);
ctx.shadowBlur = 0;
// Label
ctx.fillStyle = '#ffaa00';
ctx.font = '10px "JetBrains Mono"';
ctx.textAlign = 'right';
ctx.fillText(p, leftMargin - 4, y + barHeight / 2 + 3);
// Count
ctx.fillStyle = '#00f3ff';
ctx.textAlign = 'left';
ctx.fillText(count, leftMargin + barWidth + 4, y + barHeight / 2 + 3);
y += barHeight + spacing;
});
}
function initRadar() {
const canvas = document.getElementById('radar-scan');
const ctx = canvas.getContext('2d');
const width = canvas.width;
const height = canvas.height;
const cx = width / 2;
const cy = height / 2;
const radius = Math.min(width, height) / 2 - 10;
// Generate static nodes
const nodes = [];
for (let i = 0; i < 8; i++) {
const angle = Math.random() * Math.PI * 2;
const dist = radius * 0.7 + Math.random() * radius * 0.3;
nodes.push({ angle, dist, active: false, timer: 0 });
}
let sweepAngle = 0;
const sweepSpeed = 0.02;
function animate() {
// Clear
ctx.fillStyle = '#050505';
ctx.fillRect(0, 0, width, height);
// Draw concentric circles
ctx.strokeStyle = 'rgba(0, 243, 255, 0.3)';
ctx.lineWidth = 1;
[1, 0.7, 0.4].forEach(r => {
ctx.beginPath();
ctx.arc(cx, cy, radius * r, 0, Math.PI * 2);
ctx.stroke();
});
// Crosshairs
ctx.beginPath();
ctx.moveTo(cx, cy - radius);
ctx.lineTo(cx, cy + radius);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(cx - radius, cy);
ctx.lineTo(cx + radius, cy);
ctx.stroke();
// Sweep line
ctx.beginPath();
ctx.moveTo(cx, cy);
const ex = cx + Math.cos(sweepAngle) * radius;
const ey = cy + Math.sin(sweepAngle) * radius;
ctx.lineTo(ex, ey);
ctx.strokeStyle = 'rgba(0, 243, 255, 0.8)';
ctx.lineWidth = 2;
ctx.stroke();
// Nodes
nodes.forEach(node => {
const x = cx + Math.cos(node.angle) * node.dist;
const y = cy + Math.sin(node.angle) * node.dist;
if (node.active) {
ctx.fillStyle = '#ff00ff';
ctx.shadowBlur = 10;
ctx.shadowColor = '#ff00ff';
ctx.beginPath();
ctx.arc(x, y, 4, 0, Math.PI * 2);
ctx.fill();
} else {
ctx.fillStyle = '#0a4a4a';
ctx.shadowBlur = 0;
ctx.beginPath();
ctx.arc(x, y, 3, 0, Math.PI * 2);
ctx.fill();
}
if (node.active) {
node.timer--;
if (node.timer <= 0) node.active = false;
}
});
// Random activation
if (Math.random() < 0.05) {
const node = nodes[Math.floor(Math.random() * nodes.length)];
node.active = true;
node.timer = 12;
}
sweepAngle += sweepSpeed;
if (sweepAngle > Math.PI * 2) sweepAngle -= Math.PI * 2;
requestAnimationFrame(animate);
}
animate();
}
function log(msg) {
const logOut = document.getElementById('log-output');
const time = new Date().toISOString().split('T')[1].split('.')[0];
const line = document.createElement('div');
line.textContent = `[${time}] ${msg}`;
line.className = 'text-neon-cyan mb-1';
logOut.insertBefore(line, logOut.firstChild);
if (logOut.children.length > 20) logOut.removeChild(logOut.lastChild);
}
function generateAndProcessEvent() {
const template = eventTemplates[Math.floor(Math.random() * eventTemplates.length)];
const now = new Date();
const timestamp = now.toISOString();
const id = Math.random().toString(36).substr(2, 9).toUpperCase();
const event = {
id: id,
event_type: template.type,
timestamp: timestamp,
purpose: template.purpose,
user_id: 'USER_' + Math.floor(Math.random() * 10000),
session_id: 'SESS_' + Math.random().toString(36).substr(2, 8),
ip_address: `${Math.floor(Math.random() * 255)}.${Math.floor(Math.random() * 255)}.${Math.floor(Math.random() * 255)}.${Math.floor(Math.random() * 255)}`,
email: `user${Math.floor(Math.random() * 10000)}@example.com`,
location: { lat: (Math.random() * 180 - 90).toFixed(4), lng: (Math.random() * 360 - 180).toFixed(4) },
device: {
os: ['Windows', 'macOS', 'Linux', 'iOS', 'Android'][Math.floor(Math.random() * 5)],
browser: ['Chrome', 'Firefox', 'Safari', 'Edge'][Math.floor(Math.random() * 4)]
}
};
stats.totalEvents++;
// Sampling
if (Math.random() * 100 < config.sampleRate) {
// Copy event for display (post-redaction)
const displayEvent = { ...event };
if (config.redactionEnabled) {
config.redactFields.forEach(field => {
if (displayEvent.hasOwnProperty(field)) {
displayEvent[field] = '[REDACTED]';
stats.redactedCount++;
}
});
}
stats.purposeCounts[displayEvent.purpose] = (stats.purposeCounts[displayEvent.purpose] || 0) + 1;
stats.sampledEvents++;
addFeedItem(displayEvent);
}
updateStatsUI();
}
// Clock
function updateClock() {
const now = new Date();
const iso = now.toISOString();
const timeStr = iso.split('T')[1].split('.')[0] + ' UTC';
document.getElementById('clock').textContent = timeStr;
}
// Initialization
window.addEventListener('DOMContentLoaded', () => {
// Set up controls
const sampleSlider = document.getElementById('sample-rate');
const sampleVal = document.getElementById('sample-rate-val');
sampleSlider.addEventListener('input', (e) => {
config.sampleRate = parseInt(e.target.value);
sampleVal.textContent = config.sampleRate + '%';
log(`Sampling rate set to ${config.sampleRate}%`);
});
const redactToggle = document.getElementById('redaction-toggle');
redactToggle.addEventListener('change', (e) => {
config.redactionEnabled = e.target.checked;
log(`Data redaction ${config.redactionEnabled ? 'ENABLED' : 'DISABLED'}`);
});
const redactCheckboxes = ['redact-email', 'redact-ip', 'redact-location', 'redact-userid'];
redactCheckboxes.forEach(id => {
const cb = document.getElementById(id);
cb.addEventListener('change', () => {
config.redactFields = [];
if (document.getElementById('redact-email').checked) config.redactFields.push('email');
if (document.getElementById('redact-ip').checked) config.redactFields.push('ip_address');
if (document.getElementById('redact-location').checked) config.redactFields.push('location');
if (document.getElementById('redact-userid').checked) config.redactFields.push('user_id');
log(`Redaction fields: ${config.redactFields.join(', ') || 'none'}`);
});
});
// Start systems
setInterval(generateAndProcessEvent, 350); // event generation
updateClock();
setInterval(updateClock, 1000);
initRadar();
drawChart();
log('SYSTEM INITIALIZED');
log('Privacy module loaded');
log('Telemetry stream active');
log('Waiting for events...');
});
</script>
</body>
</html>