Skip to content

Commit d2004b5

Browse files
committed
updating for github pages
1 parent 79a32be commit d2004b5

4 files changed

Lines changed: 77 additions & 62 deletions

File tree

website/next.config.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@ import { createMDX } from 'fumadocs-mdx/next';
22

33
const withMDX = createMDX();
44

5+
const basePath = process.env.GITHUB_PAGES ? '/gnata-sqlite' : '';
6+
57
/** @type {import('next').NextConfig} */
68
const config = {
79
serverExternalPackages: ['@takumi-rs/image-response'],
810
output: 'export',
911
reactStrictMode: true,
10-
basePath: process.env.GITHUB_PAGES ? '/gnata-sqlite' : '',
12+
basePath,
13+
assetPrefix: basePath ? `${basePath}/` : undefined,
1114
images: { unoptimized: true },
15+
env: {
16+
NEXT_PUBLIC_BASE_PATH: basePath,
17+
},
1218
};
1319

1420
export default withMDX(config);

website/src/app/(home)/page.tsx

Lines changed: 56 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,15 @@ const features = [
6363
},
6464
];
6565

66-
const sqlCode = `-- Evaluate JSONata inside SQL queries
67-
SELECT jsonata('price * quantity', data)
68-
FROM orders
69-
WHERE jsonata('status = "shipped"', data);`;
66+
const sqlCode = `SELECT status, count(*) as orders,
67+
jsonata_query('{
68+
"revenue": $round($sum(total), 2),
69+
"avg": $round($average(total), 2),
70+
"top": $max(total)
71+
}', data) as stats
72+
FROM orders
73+
GROUP BY status
74+
ORDER BY orders DESC;`;
7075

7176
const reactCode = `import { JsonataPlayground } from '@gnata-sqlite/react'
7277
@@ -165,6 +170,53 @@ export default async function HomePage() {
165170
</a>
166171
</section>
167172

173+
{/* Code examples */}
174+
<section className="mx-auto max-w-5xl px-6 py-16">
175+
<h2 className="mb-8 text-center text-2xl font-bold landing-text-strong">
176+
From database to browser
177+
</h2>
178+
179+
<div className="grid gap-6 lg:grid-cols-2">
180+
{/* SQL example */}
181+
<div className="overflow-hidden rounded-md border landing-code-bg">
182+
<div
183+
className="flex items-center gap-2 border-b px-4 py-2 text-xs font-semibold landing-code-header"
184+
style={{ borderLeft: '3px solid #7aa2f7' }}
185+
>
186+
<Database className="size-3.5" style={{ color: '#7aa2f7' }} />
187+
SQLite Extension
188+
</div>
189+
<div
190+
className="overflow-x-auto text-[13px] leading-relaxed [&_pre]:!m-0 [&_pre]:!rounded-none [&_pre]:!p-4"
191+
style={{
192+
fontFamily:
193+
'ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace',
194+
}}
195+
dangerouslySetInnerHTML={{ __html: sqlHtml }}
196+
/>
197+
</div>
198+
199+
{/* React example */}
200+
<div className="overflow-hidden rounded-md border landing-code-bg">
201+
<div
202+
className="flex items-center gap-2 border-b px-4 py-2 text-xs font-semibold landing-code-header"
203+
style={{ borderLeft: '3px solid #bb9af7' }}
204+
>
205+
<Component className="size-3.5" style={{ color: '#bb9af7' }} />
206+
React Editor
207+
</div>
208+
<div
209+
className="overflow-x-auto text-[13px] leading-relaxed [&_pre]:!m-0 [&_pre]:!rounded-none [&_pre]:!p-4"
210+
style={{
211+
fontFamily:
212+
'ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace',
213+
}}
214+
dangerouslySetInnerHTML={{ __html: reactHtml }}
215+
/>
216+
</div>
217+
</div>
218+
</section>
219+
168220
{/* Features grid */}
169221
<section className="mx-auto max-w-5xl px-6 py-16">
170222
<div className="grid gap-6 sm:grid-cols-2">
@@ -211,53 +263,6 @@ export default async function HomePage() {
211263
<ScreenshotGallery />
212264
</section>
213265

214-
{/* Code examples */}
215-
<section className="mx-auto max-w-5xl px-6 py-16">
216-
<h2 className="mb-8 text-center text-2xl font-bold landing-text-strong">
217-
From database to browser
218-
</h2>
219-
220-
<div className="grid gap-6 lg:grid-cols-2">
221-
{/* SQL example */}
222-
<div className="overflow-hidden rounded-md border landing-code-bg">
223-
<div
224-
className="flex items-center gap-2 border-b px-4 py-2 text-xs font-semibold landing-code-header"
225-
style={{ borderLeft: '3px solid #7aa2f7' }}
226-
>
227-
<Database className="size-3.5" style={{ color: '#7aa2f7' }} />
228-
SQL
229-
</div>
230-
<div
231-
className="overflow-x-auto text-[13px] leading-relaxed [&_pre]:!m-0 [&_pre]:!rounded-none [&_pre]:!p-4"
232-
style={{
233-
fontFamily:
234-
'ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace',
235-
}}
236-
dangerouslySetInnerHTML={{ __html: sqlHtml }}
237-
/>
238-
</div>
239-
240-
{/* React example */}
241-
<div className="overflow-hidden rounded-md border landing-code-bg">
242-
<div
243-
className="flex items-center gap-2 border-b px-4 py-2 text-xs font-semibold landing-code-header"
244-
style={{ borderLeft: '3px solid #bb9af7' }}
245-
>
246-
<Component className="size-3.5" style={{ color: '#bb9af7' }} />
247-
React
248-
</div>
249-
<div
250-
className="overflow-x-auto text-[13px] leading-relaxed [&_pre]:!m-0 [&_pre]:!rounded-none [&_pre]:!p-4"
251-
style={{
252-
fontFamily:
253-
'ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace',
254-
}}
255-
dangerouslySetInnerHTML={{ __html: reactHtml }}
256-
/>
257-
</div>
258-
</div>
259-
</section>
260-
261266
{/* Footer */}
262267
<footer
263268
className="mt-auto border-t px-6 py-10 landing-card"

website/src/components/run-example.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ interface RunExampleProps {
1717
showInput?: boolean;
1818
}
1919

20+
const base = process.env.NEXT_PUBLIC_BASE_PATH || '';
21+
2022
const WASM_OPTIONS = {
21-
evalWasmUrl: '/gnata.wasm',
22-
evalExecUrl: '/wasm_exec.js',
23-
lspWasmUrl: '/gnata-lsp.wasm',
24-
lspExecUrl: '/lsp-wasm_exec.js',
23+
evalWasmUrl: `${base}/gnata.wasm`,
24+
evalExecUrl: `${base}/wasm_exec.js`,
25+
lspWasmUrl: `${base}/gnata-lsp.wasm`,
26+
lspExecUrl: `${base}/lsp-wasm_exec.js`,
2527
};
2628

2729
interface Palette {

website/src/components/screenshot-gallery.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22

33
import { useState, useRef, useEffect, useCallback } from 'react';
44

5+
const base = process.env.NEXT_PUBLIC_BASE_PATH || '';
6+
57
interface Screenshot {
68
src: string;
79
alt: string;
810
}
911

1012
const screenshots: Screenshot[] = [
11-
{ src: '/screenshots/playground-gnata-autocomplete.png', alt: 'Context-aware autocomplete' },
12-
{ src: '/screenshots/playground-gnata-hover.png', alt: 'Hover documentation' },
13-
{ src: '/screenshots/playground-gnata-transform.png', alt: 'Object construction' },
14-
{ src: '/screenshots/playground-gnata-pipeline.png', alt: 'Pipeline chaining' },
15-
{ src: '/screenshots/playground-sqlite-dashboard.png', alt: 'SQLite dashboard query' },
16-
{ src: '/screenshots/playground-sqlite-revenue.png', alt: 'Revenue aggregation' },
13+
{ src: `${base}/screenshots/playground-gnata-autocomplete.png`, alt: 'Context-aware autocomplete' },
14+
{ src: `${base}/screenshots/playground-gnata-hover.png`, alt: 'Hover documentation' },
15+
{ src: `${base}/screenshots/playground-gnata-transform.png`, alt: 'Object construction' },
16+
{ src: `${base}/screenshots/playground-gnata-pipeline.png`, alt: 'Pipeline chaining' },
17+
{ src: `${base}/screenshots/playground-sqlite-dashboard.png`, alt: 'SQLite dashboard query' },
18+
{ src: `${base}/screenshots/playground-sqlite-revenue.png`, alt: 'Revenue aggregation' },
1719
];
1820

1921
export function ScreenshotGallery() {

0 commit comments

Comments
 (0)