Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 48 additions & 2 deletions preview/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const config: Config = {
colorMode: {
defaultMode: 'light',
respectPrefersColorScheme: true,
disableSwitch: true,
},
announcementBar: {
id: 'dev_preview_banner',
Expand All @@ -95,19 +96,45 @@ const config: Config = {
position: 'left',
label: 'Documentation',
},
{
to: '/blog',
label: 'Blog',
position: 'left',
},
{
to: '/community',
label: 'Community',
position: 'left',
},
{
type: 'custom-version-dropdown' as any,
position: 'left',
},
{
href: 'https://llm-d.ai',
label: 'llm-d.ai',
type: 'custom-github-stars' as any,
position: 'right',
},
{
type: 'custom-slack-button' as any,
position: 'right',
},
{
type: 'custom-color-mode-toggle' as any,
position: 'right',
},
// Mobile-only fallbacks — hidden on desktop via CSS, surface in the
// hamburger drawer at <997px where the custom pills are hidden.
{
href: 'https://github.com/llm-d/llm-d',
label: 'GitHub',
position: 'right',
className: 'navbar-mobile-only',
},
{
href: 'https://llm-d.slack.com',
label: 'Join Slack',
position: 'right',
className: 'navbar-mobile-only',
},
],
},
Expand Down Expand Up @@ -139,6 +166,25 @@ const config: Config = {
{label: 'KV Cache', href: 'https://github.com/llm-d/llm-d-kv-cache'},
],
},
{
title: 'Social',
items: [
{
html: `
<div class="footer-social-icons">
<a href="https://github.com/llm-d/" aria-label="GitHub" target="_blank" rel="noopener noreferrer"><img src="/preview/img/social/github.svg" alt="GitHub" /></a>
<a href="https://linkedin.com/company/llm-d" aria-label="LinkedIn" target="_blank" rel="noopener noreferrer"><img src="/preview/img/social/linkedin.svg" alt="LinkedIn" /></a>
<a href="https://llm-d.slack.com" aria-label="Slack" target="_blank" rel="noopener noreferrer"><img src="/preview/img/social/slack.svg" alt="Slack" /></a>
<a href="https://www.reddit.com/r/llm_d/" aria-label="Reddit" target="_blank" rel="noopener noreferrer"><img src="/preview/img/social/reddit.svg" alt="Reddit" /></a>
<a href="https://bsky.app/profile/llm-d.ai" aria-label="Bluesky" target="_blank" rel="noopener noreferrer"><img src="/preview/img/social/bluesky.svg" alt="Bluesky" /></a>
<a href="https://x.com/_llm_d_" aria-label="X" target="_blank" rel="noopener noreferrer"><img src="/preview/img/social/x.svg" alt="X" /></a>
<a href="https://www.youtube.com/@llm-d-project" aria-label="YouTube" target="_blank" rel="noopener noreferrer"><img src="/preview/img/social/youtube.svg" alt="YouTube" /></a>
</div>
`,
},
{label: 'Join our Slack', href: 'https://llm-d.slack.com'},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} llm-d project. Apache 2.0 License.`,
},
Expand Down
18 changes: 13 additions & 5 deletions preview/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion preview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
"@docusaurus/faster": "3.10.0",
"@docusaurus/preset-classic": "3.10.0",
"@docusaurus/theme-mermaid": "^3.10.0",
"@fontsource/inter": "^5.2.8",
"@fontsource/ibm-plex-sans": "^5.2.8",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.0.0",
"lucide-react": "^1.14.0",
"prism-react-renderer": "^2.3.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"
Expand Down
26 changes: 26 additions & 0 deletions preview/src/components/ColorModeToggleSwitch.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import {useColorMode} from '@docusaurus/theme-common';
import {Moon, Sun} from 'lucide-react';

export default function ColorModeToggleSwitch(): React.JSX.Element {
const {colorMode, setColorMode} = useColorMode();
const isDark = colorMode === 'dark';

return (
<button
type="button"
role="switch"
aria-checked={isDark}
aria-label="Toggle dark mode"
className="color-toggle"
data-state={isDark ? 'dark' : 'light'}
onClick={() => setColorMode(isDark ? 'light' : 'dark')}
>
<span className="color-toggle__track" aria-hidden="true">
<span className="color-toggle__thumb">
{isDark ? <Moon size={11} /> : <Sun size={11} />}
</span>
</span>
</button>
);
}
105 changes: 105 additions & 0 deletions preview/src/components/GitHubStars.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import React, {useEffect, useState} from 'react';
import {Star} from 'lucide-react';

// lucide-react 1.x dropped brand marks; inline the GitHub Octicon (MIT) so we
// don't depend on the older 0.x line.
function GitHubMark({size = 16}: {size?: number}): React.JSX.Element {
return (
<svg
width={size}
height={size}
viewBox="0 0 16 16"
fill="currentColor"
aria-hidden="true"
>
<path
fillRule="evenodd"
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"
/>
</svg>
);
}

const REPO_URL = 'https://github.com/llm-d/llm-d';
const API_URL = 'https://api.github.com/repos/llm-d/llm-d';
const CACHE_KEY = 'llmd-github-stars';
const CACHE_TTL_MS = 60 * 60 * 1000;

type CacheEntry = {count: number; ts: number};

function formatStars(n: number): string {
if (n < 1000) return n.toString();
return (Math.round(n / 100) / 10).toFixed(1) + 'k';
}

function readCache(): number | null {
try {
const raw = sessionStorage.getItem(CACHE_KEY);
if (!raw) return null;
const parsed = JSON.parse(raw) as CacheEntry;
if (Date.now() - parsed.ts > CACHE_TTL_MS) return null;
return parsed.count;
} catch {
return null;
}
}

function writeCache(count: number): void {
try {
sessionStorage.setItem(CACHE_KEY, JSON.stringify({count, ts: Date.now()}));
} catch {
/* ignore quota / privacy mode */
}
}

export default function GitHubStars(): React.JSX.Element {
const [stars, setStars] = useState<number | null>(null);

useEffect(() => {
const cached = readCache();
if (cached !== null) {
setStars(cached);
return;
}
let cancelled = false;
fetch(API_URL)
.then((r) => {
if (!r.ok) throw new Error(`HTTP ${r.status}`);
return r.json() as Promise<{stargazers_count: number}>;
})
.then((data) => {
if (cancelled) return;
setStars(data.stargazers_count);
writeCache(data.stargazers_count);
})
.catch(() => {
/* swallow — we just won't show a count */
});
return () => {
cancelled = true;
};
}, []);

return (
<a
href={REPO_URL}
target="_blank"
rel="noopener noreferrer"
className="nav-pill nav-pill--gh"
aria-label={
stars !== null
? `GitHub repository, ${stars} stars`
: 'GitHub repository'
}
>
<GitHubMark size={14} />
<span className="nav-pill__label">GitHub</span>
{stars !== null && (
<span className="nav-pill__chip">
<Star size={11} fill="currentColor" aria-hidden="true" />
{formatStars(stars)}
</span>
)}
</a>
);
}
16 changes: 16 additions & 0 deletions preview/src/components/SlackButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';

const SLACK_URL = 'https://llm-d.slack.com';

export default function SlackButton(): React.JSX.Element {
return (
<a
href={SLACK_URL}
target="_blank"
rel="noopener noreferrer"
className="nav-pill nav-pill--slack"
>
<span className="nav-pill__label">Join Slack</span>
</a>
);
}
10 changes: 9 additions & 1 deletion preview/src/components/VersionDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import React from 'react';
import {usePluginData} from '@docusaurus/useGlobalData';
import {useLocation} from '@docusaurus/router';
import useBaseUrl from '@docusaurus/useBaseUrl';

const REPO_URL = 'https://github.com/llm-d/llm-d/tree';

export default function VersionDropdown(): React.JSX.Element {
export default function VersionDropdown(): React.JSX.Element | null {
const {releases} = usePluginData('llmd-versions-plugin') as {
releases: string[];
};
const {pathname} = useLocation();
const docsBasePath = useBaseUrl('/docs/');

if (!pathname.startsWith(docsBasePath)) {
return null;
}

// Latest stable version (first in releases list)
const latestTag = releases?.[0];
Expand Down
Loading