Merge branch 'feat/public-viewer' into feat/viewer-chat

This commit is contained in:
BigBodyCobain committed 2026-11-23 08:09:41 -07:00
commit b8c4535a03
2 files changed
+76 -23

No files matched your search

+70 -20
View File
@@ -1,8 +1,8 @@
'use client';
import React, { useEffect, useState } from 'react';
import { Eye, Info, X, Target, AlertTriangle, Minus, Wrench, ExternalLink } from 'lucide-react';
import { VIEWER_LINKS } from './config';
import { Eye, Info, X, Target, AlertTriangle, Minus, Wrench, MessagesSquare, Coins } from 'lucide-react';
import { VIEWER_LINKS, type ViewerLinkId } from './config';
import { feedAgeMs, feedIsStale, useFeedStatus } from './feedStatus';
function useNow(intervalMs: number): number {
@@ -52,34 +52,84 @@ export function ViewerHeaderCard({ onAbout }: { onAbout: () => void }) {
? `Feed paused · last update ${ageLabel(age ?? 0)}`
: `Live · updated ${ageLabel(age ?? 0)}`}
</span>
</div>
<div className="mt-2.5 flex flex-wrap items-center gap-2">
<button
type="button"
onClick={onAbout}
className="sb-chip flex items-center gap-1.5 px-3 py-1.5 text-[10.5px] font-mono tracking-[0.14em] uppercase text-cyan-300 hover:text-cyan-100"
className="ml-auto flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-mono tracking-[0.14em] uppercase text-cyan-300/90 hover:text-cyan-100 hover:bg-cyan-500/10 transition-colors"
>
<Info size={12} aria-hidden="true" />
About &amp; sources
<Info size={11} aria-hidden="true" />
About
</button>
{VIEWER_LINKS.map((link) => (
<a
key={link.href}
href={link.href}
title={link.title}
target="_blank"
rel="noopener noreferrer"
className="sb-chip flex items-center gap-1.5 px-3 py-1.5 text-[10.5px] font-mono tracking-[0.14em] uppercase text-cyan-300 hover:text-cyan-100"
>
<ExternalLink size={12} aria-hidden="true" />
{link.label}
</a>
))}
</div>
{/* Community links: one tile each, opening the project's page on that site. */}
<nav aria-label="Community links" className="mt-3 grid grid-cols-4 gap-2">
{VIEWER_LINKS.map((link) => {
const look = LINK_LOOK[link.id];
return (
<a
key={link.id}
href={link.href}
title={link.title}
aria-label={link.title}
target="_blank"
rel="noopener noreferrer"
className="sb-link-tile group relative flex flex-col items-center gap-1.5 rounded-lg border px-1 pt-2.5 pb-2 transition-all duration-200 hover:-translate-y-0.5"
style={{ '--tile': look.color } as React.CSSProperties}
>
<span className="sb-link-tile-icon grid place-items-center w-8 h-8 rounded-full transition-transform duration-200 group-hover:scale-110">
{look.icon}
</span>
<span className="text-[9.5px] font-mono font-bold tracking-[0.14em] uppercase text-[var(--text-primary)] group-hover:text-white">
{link.label}
</span>
</a>
);
})}
</nav>
<style>{`
.sb-link-tile {
border-color: color-mix(in srgb, var(--tile) 26%, transparent);
background: linear-gradient(180deg, color-mix(in srgb, var(--tile) 12%, transparent), color-mix(in srgb, var(--tile) 3%, transparent));
}
.sb-link-tile:hover, .sb-link-tile:focus-visible {
border-color: color-mix(in srgb, var(--tile) 70%, transparent);
box-shadow: 0 0 0 1px color-mix(in srgb, var(--tile) 25%, transparent), 0 6px 18px -8px var(--tile);
outline: none;
}
.sb-link-tile-icon {
color: var(--tile);
background: color-mix(in srgb, var(--tile) 16%, transparent);
}
@media (prefers-reduced-motion: reduce) {
.sb-link-tile, .sb-link-tile-icon { transition: none; transform: none !important; }
}
`}</style>
</div>
);
}
function BrandIcon({ path }: { path: string }) {
return (
<svg viewBox="0 0 24 24" width="17" height="17" fill="currentColor" aria-hidden="true">
<path d={path} />
</svg>
);
}
const DISCORD_PATH =
'M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z';
const GITHUB_PATH =
'M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12';
/** Each tile's accent colour and icon. */
const LINK_LOOK: Record<ViewerLinkId, { color: string; icon: React.ReactNode }> = {
discord: { color: '#7b88ff', icon: <BrandIcon path={DISCORD_PATH} /> },
github: { color: '#dbe7f7', icon: <BrandIcon path={GITHUB_PATH} /> },
discussions: { color: '#45d8ff', icon: <MessagesSquare size={16} aria-hidden="true" /> },
token: { color: '#2cf5a0', icon: <Coins size={16} aria-hidden="true" /> },
};
/** Top-center banner shown when the published data stopped updating. */
export function StaleBanner() {
const status = useFeedStatus();
+6 -3
View File
@@ -37,10 +37,13 @@ export const VIEWER_STALE_AFTER_MS = 4 * 60 * 1000;
export const VIEWER_REPO_URL = 'https://github.com/BigBodyCobain/Shadowbroker';
/** Top-right links. Each opens the project's own page on that site in a new tab. */
export const VIEWER_LINKS: readonly { label: string; title: string; href: string }[] = [
{ label: 'GitHub', title: 'Source code, and the full app to run yourself', href: VIEWER_REPO_URL },
{ label: 'Discussions', title: 'Project discussion board', href: `${VIEWER_REPO_URL}/discussions` },
export type ViewerLinkId = 'discord' | 'github' | 'discussions' | 'token';
export const VIEWER_LINKS: readonly { id: ViewerLinkId; label: string; title: string; href: string }[] = [
{ id: 'discord', label: 'Discord', title: 'Join the community on Discord', href: 'https://discord.gg/hTWprYS6gC' },
{ id: 'github', label: 'GitHub', title: 'Source code, and the full app to run yourself', href: VIEWER_REPO_URL },
{ id: 'discussions', label: 'Forum', title: 'Project discussion board on GitHub', href: `${VIEWER_REPO_URL}/discussions` },
{
id: 'token',
label: 'pump.fun',
title: 'The project token page on pump.fun',
href: 'https://pump.fun/coin/8Uk9f5WfJndkC9VkFRLDwEpHgD2KD8BcFbqh5zuBpump',