@@ -12,145 +12,8 @@ import { resolve, dirname } from "path";
1212import { fileURLToPath } from "url" ;
1313
1414const FAVICON_LINK = '<link rel="icon" type="image/svg+xml" href="/favicon.svg">' ;
15- const DARK_STYLE = '<style>body,#redoc-container{background:#0a0a0f!important}</style>' ;
1615const UMAMI_SCRIPT = '<script defer src="https://umami.decasteljau.factorial.io/script.js" data-website-id="d93c0515-ea1e-497d-94ec-669b72d1ba0a"></script>' ;
1716
18- const NAV_HEIGHT = 56 ;
19-
20- const NAV_STYLE = `<style>
21- #fd-nav {
22- position: fixed;
23- top: 0; left: 0; right: 0;
24- z-index: 9999;
25- background: rgba(10, 10, 15, 0.92);
26- backdrop-filter: blur(12px);
27- -webkit-backdrop-filter: blur(12px);
28- border-bottom: 1px solid #3e3e54;
29- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
30- }
31- #fd-nav-inner {
32- display: flex;
33- align-items: center;
34- height: ${ NAV_HEIGHT } px;
35- max-width: 1200px;
36- margin: 0 auto;
37- padding: 0 clamp(16px, 4vw, 48px);
38- gap: 32px;
39- }
40- .fd-logo {
41- font-size: 1.0625rem;
42- font-weight: 700;
43- color: #e8e8f0;
44- text-decoration: none;
45- letter-spacing: -0.01em;
46- flex-shrink: 0;
47- }
48- .fd-logo:hover { color: #fff; }
49- .fd-links {
50- display: flex;
51- align-items: center;
52- gap: 4px;
53- flex: 1;
54- }
55- .fd-nav-link {
56- padding: 6px 12px;
57- font-size: 0.9375rem;
58- font-weight: 500;
59- color: #9a9ab8;
60- border-radius: 6px;
61- text-decoration: none;
62- transition: color 200ms, background 200ms;
63- }
64- .fd-nav-link:hover, .fd-nav-link-active {
65- color: #e8e8f0;
66- background: #17171f;
67- }
68- .fd-nav-actions { flex-shrink: 0; }
69- .fd-btn {
70- display: inline-block;
71- padding: 7px 16px;
72- font-size: 0.875rem;
73- font-weight: 600;
74- color: #fff;
75- background: #6c63ff;
76- border-radius: 6px;
77- text-decoration: none;
78- transition: background 200ms;
79- }
80- .fd-btn:hover { background: #7c74ff; }
81- .fd-menu-toggle {
82- display: none;
83- flex-direction: column;
84- gap: 5px;
85- padding: 8px;
86- cursor: pointer;
87- background: none;
88- border: none;
89- margin-left: auto;
90- }
91- .fd-menu-toggle span {
92- display: block;
93- width: 22px;
94- height: 2px;
95- background: #e8e8f0;
96- border-radius: 2px;
97- }
98- #fd-mobile-menu {
99- display: none;
100- flex-direction: column;
101- gap: 8px;
102- padding: 16px clamp(16px, 4vw, 48px) 24px;
103- background: rgba(10, 10, 15, 0.97);
104- border-top: 1px solid #3e3e54;
105- }
106- #fd-mobile-menu.open { display: flex; }
107- .fd-mobile-link {
108- padding: 10px 12px;
109- font-size: 1rem;
110- font-weight: 500;
111- color: #9a9ab8;
112- border-radius: 6px;
113- text-decoration: none;
114- }
115- .fd-mobile-link:hover { color: #e8e8f0; }
116- /* Push Redocly sidebar below the nav */
117- .menu-content {
118- top: ${ NAV_HEIGHT } px !important;
119- height: calc(100vh - ${ NAV_HEIGHT } px) !important;
120- }
121- /* Push Redocly main content area below nav */
122- .redoc-wrap { padding-top: ${ NAV_HEIGHT } px; }
123- @media (max-width: 768px) {
124- .fd-links, .fd-nav-actions { display: none; }
125- .fd-menu-toggle { display: flex; }
126- }
127- </style>` ;
128-
129- const NAV_HTML = `<nav id="fd-nav">
130- <div id="fd-nav-inner">
131- <a href="https://flowdrop.io" class="fd-logo">FlowDrop™</a>
132- <div class="fd-links">
133- <a href="https://flowdrop.io/blog" class="fd-nav-link">Blog</a>
134- <a href="https://docs.flowdrop.io" class="fd-nav-link">Docs</a>
135- <a href="https://api.flowdrop.io/v1/" class="fd-nav-link fd-nav-link-active">API</a>
136- <a href="https://github.com/d34dman/flowdrop" class="fd-nav-link" target="_blank" rel="noopener noreferrer">GitHub</a>
137- </div>
138- <div class="fd-nav-actions">
139- <a href="https://docs.flowdrop.io/getting-started/quick-start" class="fd-btn" target="_blank" rel="noopener noreferrer">Get started</a>
140- </div>
141- <button class="fd-menu-toggle" aria-label="Toggle menu" onclick="var m=document.getElementById('fd-mobile-menu');m.classList.toggle('open')">
142- <span></span><span></span><span></span>
143- </button>
144- </div>
145- <div id="fd-mobile-menu">
146- <a href="https://flowdrop.io/blog" class="fd-mobile-link">Blog</a>
147- <a href="https://docs.flowdrop.io" class="fd-mobile-link">Docs</a>
148- <a href="https://api.flowdrop.io/v1/" class="fd-mobile-link">API</a>
149- <a href="https://github.com/d34dman/flowdrop" class="fd-mobile-link" target="_blank" rel="noopener noreferrer">GitHub</a>
150- <a href="https://docs.flowdrop.io/getting-started/quick-start" class="fd-btn" target="_blank" rel="noopener noreferrer" style="margin-top:8px">Get started</a>
151- </div>
152- </nav>` ;
153-
15417const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
15518const rootDir = resolve ( __dirname , ".." ) ;
15619const apiDir = resolve ( rootDir , "../../libs/flowdrop/api" ) ;
@@ -187,12 +50,9 @@ for (const version of versions) {
18750 // Copy bundled spec for download
18851 cpSync ( specFile , resolve ( distDir , version . id , "openapi.yaml" ) ) ;
18952
190- // Inject favicon, dark theme, nav and analytics into Redocly-generated HTML
191- // Also strip Google Fonts link injected by Redocly by default
53+ // Inject favicon and analytics into Redocly-generated HTML
19254 let html = readFileSync ( outFile , "utf-8" ) ;
193- html = html . replace ( / < l i n k [ ^ > ] * f o n t s \. g o o g l e a p i s \. c o m [ ^ > ] * > / g, "" ) ;
194- html = html . replace ( "<head>" , `<head>\n ${ FAVICON_LINK } \n ${ DARK_STYLE } \n ${ NAV_STYLE } \n ${ UMAMI_SCRIPT } ` ) ;
195- html = html . replace ( "<body>" , `<body>\n ${ NAV_HTML } ` ) ;
55+ html = html . replace ( "<head>" , `<head>\n ${ FAVICON_LINK } \n ${ UMAMI_SCRIPT } ` ) ;
19656 writeFileSync ( outFile , html ) ;
19757
19858 console . log ( ` -> ${ version . id } /index.html` ) ;
@@ -223,98 +83,27 @@ writeFileSync(resolve(distDir, "404.html"), redirectHtml);
22383console . log ( "\nBuild complete!" ) ;
22484
22585function generateLandingPage ( versions , defaultVersion ) {
226- const versionCards = versions
86+ const versionLinks = versions
22787 . map (
228- ( v ) => `
229- <a href="${ v . id } /" class="version-card${ v . default ? " default" : "" } ">
230- <h2>${ v . label } </h2>
231- ${ v . default ? '<span class="badge">Latest</span>' : "" }
232- <span class="link">View Documentation →</span>
233- </a>` ,
88+ ( v ) => `<li><a href="${ v . id } /">${ v . label } ${ v . default ? " (latest)" : "" } </a></li>` ,
23489 )
235- . join ( "\n" ) ;
90+ . join ( "\n " ) ;
23691
23792 return `<!DOCTYPE html>
23893<html lang="en">
23994<head>
24095 <meta charset="UTF-8">
24196 <meta name="viewport" content="width=device-width, initial-scale=1.0">
242- <title>FlowDrop™ API Documentation</title>
97+ <title>FlowDrop API Documentation</title>
24398 <link rel="icon" type="image/svg+xml" href="/favicon.svg">
24499 <script defer src="https://umami.decasteljau.factorial.io/script.js" data-website-id="d93c0515-ea1e-497d-94ec-669b72d1ba0a"></script>
245- ${ NAV_STYLE }
246- <style>
247- * { margin: 0; padding: 0; box-sizing: border-box; }
248- body {
249- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
250- background: #0a0a0f;
251- color: #e8e8f0;
252- min-height: 100vh;
253- display: flex;
254- flex-direction: column;
255- align-items: center;
256- justify-content: center;
257- padding: 2rem;
258- padding-top: calc(2rem + ${ NAV_HEIGHT } px);
259- }
260- h1 {
261- font-size: 2rem;
262- margin-bottom: 0.5rem;
263- }
264- .subtitle {
265- color: #7a7a9a;
266- margin-bottom: 2rem;
267- }
268- .versions {
269- display: flex;
270- flex-wrap: wrap;
271- gap: 1rem;
272- justify-content: center;
273- max-width: 600px;
274- }
275- .version-card {
276- display: flex;
277- flex-direction: column;
278- align-items: center;
279- gap: 0.5rem;
280- padding: 1.5rem 2rem;
281- background: #13131a;
282- border: 1px solid #2a2a3a;
283- border-radius: 8px;
284- text-decoration: none;
285- color: #e8e8f0;
286- transition: border-color 0.2s, background 0.2s;
287- min-width: 180px;
288- }
289- .version-card:hover {
290- border-color: #6c63ff;
291- background: #1a1a25;
292- }
293- .version-card.default {
294- border-color: #6c63ff;
295- }
296- .badge {
297- background: #6c63ff;
298- color: #ffffff;
299- font-size: 0.75rem;
300- font-weight: 600;
301- padding: 0.15rem 0.5rem;
302- border-radius: 4px;
303- text-transform: uppercase;
304- }
305- .link {
306- color: #6c63ff;
307- font-size: 0.875rem;
308- }
309- </style>
310100</head>
311101<body>
312- ${ NAV_HTML }
313- <h1>FlowDrop™ API</h1>
314- <p class="subtitle">Select an API version</p>
315- <div class="versions">
316- ${ versionCards }
317- </div>
102+ <h1>FlowDrop API Documentation</h1>
103+ <p>Select an API version:</p>
104+ <ul>
105+ ${ versionLinks }
106+ </ul>
318107</body>
319108</html>` ;
320109}
0 commit comments