Initial commit: BlackDice site rebuild with integrated CMS

Rebuilds content management around a single admin route (/admin —
"BlackDice Studio"), replacing blackdice-studio.html. Publishing writes
one JSON content document instead of regenerating HTML files, so it can
no longer overwrite hand-made site changes the way the old tool did.

- /admin: click-to-edit copy/images, article CRUD with a Word-safe rich
  text editor, demo clip management, per-page SEO, enquiry log, publish
  history with rollback
- Real per-page URLs for all pages and articles, each with its own
  meta/canonical/OG/JSON-LD
- Newsroom + article pages driven by the CMS post library, seeded from
  the old studio's export (17 articles) plus a drafted GSMA Open Gateway
  press release awaiting approval
- Demo sections on Mobile SDK and Halo CPE, interactive by default and
  upgradable to an uploaded clip per slot
- Dependency-free Node API server (auth, publish, uploads, snapshots,
  leads, live sitemap)
- Deployment configs for Node/nginx/IIS, Vercel and Netlify

See docs/ARCHITECTURE.md, docs/PROJECT-STRUCTURE.md, docs/CMS-GUIDE.md
and docs/DEPLOYMENT.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-12 23:52:44 +05:00
co-authored by Claude Sonnet 5
commit 63a36e0dca
77 changed files with 19487 additions and 0 deletions
+176
View File
@@ -0,0 +1,176 @@
import { useEffect, useMemo } from 'react'
import { useNavigate } from 'react-router-dom'
import { formatPostDate, publishedPosts, useContent } from '../../cms/store'
import { applyJsonLd, applyMeta, articleJsonLd } from '../../cms/seo'
import { categoryMeta, splitAuthor } from './NewsGrid'
import type { Post } from '../../cms/types'
/**
* A single article at /blog/<slug>. Rendered into the #pg-article container inside
* the site markup, so it inherits the real nav, footer and enquiry modal — and the
* white-section rule that makes the body copy readable.
*/
export default function ArticlePage({ slug, suppressMeta = false }: { slug: string; suppressMeta?: boolean }) {
const content = useContent()
const navigate = useNavigate()
// Drafts are reachable by direct link so they can be reviewed before going live,
// but they never appear in listings or the sitemap.
const post = useMemo(() => content.posts.find((p) => p.slug === slug), [content, slug])
const related = useMemo(() => {
const others = publishedPosts(content).filter((p) => p.slug !== slug)
const sameCategory = others.filter((p) => p.category === post?.category)
return [...sameCategory, ...others.filter((p) => p.category !== post?.category)].slice(0, 3)
}, [content, post, slug])
useEffect(() => {
if (suppressMeta) return // the admin preview leaves the document head alone
if (!post) {
applyMeta({
title: 'Article not found | BlackDice Cyber',
description: 'The article you are looking for is no longer available.',
path: `/blog/${slug}`,
siteUrl: content.settings.siteUrl,
robots: 'noindex, follow',
})
applyJsonLd(null)
return
}
applyMeta({
title: post.metaTitle || `${post.title} | BlackDice Cyber`,
description: post.metaDescription || post.excerpt,
path: `/blog/${post.slug}`,
image: post.hero || undefined,
type: 'article',
siteUrl: content.settings.siteUrl,
robots: post.status === 'draft' ? 'noindex, nofollow' : 'index, follow',
})
applyJsonLd(post.status === 'draft' ? null : articleJsonLd(post, content.settings.siteUrl))
}, [post, slug, content.settings.siteUrl, suppressMeta])
if (!post) {
return (
<section className="bd-sect t">
<div className="bd-si" style={{ maxWidth: 720 }}>
<span className="ey">NEWSROOM</span>
<h1 className="h1" style={{ fontSize: 'clamp(28px,3vw,40px)', marginBottom: 16 }}>
That article has moved.
</h1>
<p style={{ color: 'var(--t2)', fontSize: 16, marginBottom: 24 }}>
We could not find an article at <code>/blog/{slug}</code>. It may have been renamed or unpublished.
</p>
<button className="btn-p" onClick={() => navigate('/news')}>
Back to the newsroom
</button>
</div>
</section>
)
}
const cat = categoryMeta(post.category)
const { name, credit } = splitAuthor(post.author)
return (
<>
<section className="bd-hero-sh bd-article-hero">
<div className="bd-hero-gl" />
<div className="bd-si" style={{ position: 'relative', zIndex: 1 }}>
<button className="bd-article-back" onClick={() => navigate('/news')}>
← Newsroom
</button>
<span className={`news-tag ${cat.cls}`} style={{ marginBottom: 16, display: 'inline-block' }}>
{cat.label.toUpperCase()}
</span>
{post.status === 'draft' ? <span className="bd-news-draft" style={{ marginLeft: 8 }}>DRAFT — NOT PUBLISHED</span> : null}
<h1 className="h1 bd-article-title">{post.title}</h1>
<p className="bd-article-meta">
{formatPostDate(post.date)}
{name ? ` · ${name}` : ''}
</p>
</div>
</section>
<section className="bd-sect t">
<div className="bd-si bd-article-wrap">
{post.hero ? (
<figure className="bd-article-hero-img">
<img src={post.hero} alt={post.title} />
{credit ? <figcaption>{credit}</figcaption> : null}
</figure>
) : null}
<div className="bd-article-body" dangerouslySetInnerHTML={{ __html: post.body }} />
<ArticleShare post={post} siteUrl={content.settings.siteUrl} />
</div>
</section>
<section className="bd-sect t">
<div className="bd-si">
<div className="sect-hd">
<span className="ey">KEEP READING</span>
<h2 className="h2">More from BlackDice</h2>
</div>
<div className="news-grid">
{related.map((other) => (
<article key={other.id} className="news-card bd-news-card" onClick={() => navigate(`/blog/${other.slug}`)}>
<span className={`news-tag ${categoryMeta(other.category).cls}`}>
{categoryMeta(other.category).label.toUpperCase()}
</span>
<h3>{other.title}</h3>
<p className="bd-news-meta">{formatPostDate(other.date)}</p>
<p>{other.excerpt}</p>
<span className="bd-news-more">Read more →</span>
</article>
))}
</div>
</div>
</section>
<div className="cta-band">
<div className="cta-band-in">
<div>
<h2 className="h2">
Want to see this working on your network? <em>Talk to us.</em>
</h2>
</div>
<div>
<p>
Tell us about your subscriber base and we will show you the intelligence BlackDice surfaces from within
your own infrastructure.
</p>
<div className="btn-row">
<button className="btn-p" onClick={() => (window as { showDemo?: () => void }).showDemo?.()}>
Request a demonstration
</button>
</div>
</div>
</div>
</div>
</>
)
}
function ArticleShare({ post, siteUrl }: { post: Post; siteUrl: string }) {
const url = `${siteUrl.replace(/\/+$/, '')}/blog/${post.slug}`
const share = [
{ label: 'LinkedIn', href: `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}` },
{ label: 'X', href: `https://twitter.com/intent/tweet?url=${encodeURIComponent(url)}&text=${encodeURIComponent(post.title)}` },
]
return (
<div className="bd-article-share">
<span className="ey">SHARE THIS ARTICLE</span>
<div>
{share.map((s) => (
<a key={s.label} href={s.href} target="_blank" rel="noopener">
{s.label}
</a>
))}
<button
onClick={() => {
navigator.clipboard?.writeText(url)
}}>
Copy link
</button>
</div>
</div>
)
}
+114
View File
@@ -0,0 +1,114 @@
import { useMemo, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { POST_CATEGORIES, type Post, type PostCategory } from '../../cms/types'
import { formatPostDate, publishedPosts, useContent } from '../../cms/store'
export const categoryMeta = (id: string) => POST_CATEGORIES.find((c) => c.id === id) || POST_CATEGORIES[0]
/** Authors are stored as "Paul Hague (Image by … on Unsplash)" — split the credit out. */
export function splitAuthor(author: string) {
const match = /^(.*?)\s*\(([^)]*)\)\s*$/.exec(author || '')
return match ? { name: match[1].trim(), credit: match[2].trim() } : { name: (author || '').trim(), credit: '' }
}
function Card({ post, onOpen }: { post: Post; onOpen: (post: Post) => void }) {
const cat = categoryMeta(post.category)
const { name } = splitAuthor(post.author)
return (
<article
className="news-card bd-news-card"
role="link"
tabIndex={0}
onClick={() => onOpen(post)}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
onOpen(post)
}
}}>
{post.hero ? (
<div className="bd-news-thumb">
<img src={post.hero} alt="" loading="lazy" />
</div>
) : null}
<span className={`news-tag ${cat.cls}`}>{cat.label.toUpperCase()}</span>
{post.status === 'draft' ? <span className="bd-news-draft">DRAFT</span> : null}
<h3>{post.title}</h3>
<p className="bd-news-meta">
{formatPostDate(post.date)}
{name ? ` · ${name}` : ''}
</p>
<p>{post.excerpt}</p>
<span className="bd-news-more">Read more →</span>
</article>
)
}
/**
* The newsroom grid (/news) and the home page's latest-three strip. Both read the
* same CMS post library, so publishing an article puts it everywhere it belongs.
*/
export default function NewsGrid({ limit, showFilters = true, heading }: { limit?: number; showFilters?: boolean; heading?: string }) {
const content = useContent()
const navigate = useNavigate()
const [filter, setFilter] = useState<PostCategory | 'all'>('all')
const all = useMemo(() => publishedPosts(content), [content])
const counts = useMemo(() => {
const out: Record<string, number> = { all: all.length }
for (const post of all) out[post.category] = (out[post.category] || 0) + 1
return out
}, [all])
const posts = useMemo(() => {
const filtered = filter === 'all' ? all : all.filter((p) => p.category === filter)
return limit ? filtered.slice(0, limit) : filtered
}, [all, filter, limit])
const open = (post: Post) => navigate(`/blog/${post.slug}`)
if (!all.length) {
return (
<p style={{ color: 'var(--t2)', fontSize: 15 }}>
No articles have been published yet.
</p>
)
}
return (
<>
{heading ? (
<div className="sect-hd bd-news-head">
<div>
<span className="ey">FROM THE NEWSROOM</span>
<h2 className="h2">{heading}</h2>
</div>
<button className="bd-news-all" onClick={() => navigate('/news')}>
View all articles →
</button>
</div>
) : null}
{showFilters ? (
<div className="bd-news-filters">
{[{ id: 'all', label: 'All' }, ...POST_CATEGORIES].map((cat) => (
<button
key={cat.id}
className={`bd-news-chip${filter === cat.id ? ' on' : ''}`}
onClick={() => setFilter(cat.id as PostCategory | 'all')}
disabled={!counts[cat.id]}>
{cat.label}
<span>{counts[cat.id] || 0}</span>
</button>
))}
</div>
) : null}
<div className="news-grid">
{posts.map((post) => (
<Card key={post.id} post={post} onOpen={open} />
))}
</div>
</>
)
}