Skip to content

Commit fe90224

Browse files
committed
feat(ui): implement results pagination and improve light theme
1 parent de416ea commit fe90224

File tree

25 files changed

+1293
-1129
lines changed

25 files changed

+1293
-1129
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: pnpm lint
2929

3030
- name: Format check
31-
run: pnpm format --check || true
31+
run: pnpm format --check
3232

3333
- name: Build
3434
run: pnpm build

.github/workflows/deploy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727
uses: actions/setup-node@v4
2828
with:
2929
node-version: "18"
30-
cache: 'npm'
30+
cache: "npm"
3131

3232
- name: Setup Pages
3333
uses: actions/configure-pages@v4
34-
34+
3535
- name: Install dependencies
3636
run: npm install
3737

@@ -55,4 +55,4 @@ jobs:
5555
steps:
5656
- name: Deploy to GitHub Pages
5757
id: deployment
58-
uses: actions/deploy-pages@v4
58+
uses: actions/deploy-pages@v4

.prettierignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,50 @@
1+
# Node / Package Manager
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
pnpm-debug.log*
7+
package-lock.json
8+
yarn.lock
9+
pnpm-lock.yaml
10+
11+
# Build Artifacts
12+
dist/
13+
build/
14+
.next/
15+
out/
16+
17+
# Logs
18+
*.log
19+
logs
20+
*.log.*
21+
22+
# Test Artifacts
23+
coverage/
24+
test-results/
25+
junit.xml
26+
27+
# OS Generated Files
28+
.DS_Store
29+
Thumbs.db
30+
31+
# Environment Variables
32+
.env*
33+
!.env.example
34+
35+
# IDE / Editor Directories
36+
.idea/
37+
.vscode/
38+
*.swp
39+
*.swo
40+
41+
# Temporary / Cache Files
42+
.tmp/
43+
.cache/
44+
45+
# Specific Project Files (Adjust as needed)
46+
act.md
47+
format.md
48+
prettier.md
49+
lint-errors.json
150
public/__schema_templates/schema.hbs

app/api/list-schemas/route.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { NextResponse } from "next/server";
2+
import fs from "fs/promises";
3+
import path from "path";
4+
5+
const SCHEMAS_DIR = path.join(process.cwd(), "public", "schemas", "v1");
6+
7+
// Interface for the response items
8+
interface SchemaObject {
9+
name: string;
10+
filename: string;
11+
}
12+
13+
export async function GET() {
14+
// This route should only be used in development
15+
if (process.env.NODE_ENV === "production") {
16+
return NextResponse.json(
17+
{ error: "Endpoint not available in production. Use static index.json." },
18+
{ status: 404 },
19+
);
20+
}
21+
22+
try {
23+
const files = await fs.readdir(SCHEMAS_DIR);
24+
25+
// Filter to only include JSON files and exclude Zone.Identifier files
26+
const schemaFiles = files.filter(
27+
(file) => file.endsWith(".json") && !file.includes(":Zone.Identifier"),
28+
);
29+
30+
// Map to the expected SchemaObject format
31+
const schemas: SchemaObject[] = schemaFiles.map((filename) => ({
32+
name: filename.replace(".json", ""),
33+
filename,
34+
}));
35+
36+
return NextResponse.json(schemas);
37+
} catch (error) {
38+
console.error("Error listing schemas:", error);
39+
// Check if the error is because the directory doesn't exist
40+
if (
41+
error instanceof Error &&
42+
(error as NodeJS.ErrnoException).code === "ENOENT"
43+
) {
44+
return NextResponse.json(
45+
{ error: "Schema directory not found." },
46+
{ status: 404 },
47+
);
48+
}
49+
return NextResponse.json(
50+
{ error: "Failed to list schemas" },
51+
{ status: 500 },
52+
);
53+
}
54+
}
55+
56+
// Ensure this route is always dynamic and not cached in dev
57+
export const dynamic = "force-dynamic";

app/api/schemas/[name]/route.ts

Lines changed: 0 additions & 101 deletions
This file was deleted.

app/api/schemas/route.ts

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,38 @@ const getSchemasDirectory = () => {
99

1010
export async function GET() {
1111
console.log("[API /api/schemas] Getting list of schemas");
12-
12+
1313
try {
1414
const directory = getSchemasDirectory();
1515
const files = await fs.readdir(directory);
16-
16+
1717
// Filter to only include JSON files and exclude Zone.Identifier files
18-
const schemaNames = files.filter(file =>
19-
file.endsWith('.json') && !file.includes(':Zone.Identifier')
18+
const schemaNames = files.filter(
19+
(file) => file.endsWith(".json") && !file.includes(":Zone.Identifier"),
20+
);
21+
22+
console.log(
23+
`[API /api/schemas] Found ${schemaNames.length} schemas:`,
24+
schemaNames,
2025
);
21-
22-
console.log(`[API /api/schemas] Found ${schemaNames.length} schemas:`, schemaNames);
23-
26+
2427
// Format the response to match what the client expects
25-
const schemas = schemaNames.map(filename => ({
26-
name: filename.replace('.json', ''),
28+
const schemas = schemaNames.map((filename) => ({
29+
name: filename.replace(".json", ""),
2730
filename,
2831
}));
29-
32+
3033
return NextResponse.json(schemas);
3134
} catch (error) {
3235
const errorMsg = error instanceof Error ? error.message : String(error);
33-
console.error("[API /api/schemas] Error reading schemas directory:", errorMsg);
34-
36+
console.error(
37+
"[API /api/schemas] Error reading schemas directory:",
38+
errorMsg,
39+
);
40+
3541
return NextResponse.json(
3642
{ error: "Failed to read schemas directory" },
37-
{ status: 500 }
43+
{ status: 500 },
3844
);
3945
}
4046
}

app/globals.css

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44

55
@layer base {
66
:root {
7-
--background: 0 0% 90%;
8-
--foreground: 222.2 47.4% 11.2%;
9-
--card: 0 0% 98%;
10-
--card-foreground: 222.2 47.4% 11.2%;
11-
--popover: 0 0% 100%;
12-
--popover-foreground: 222.2 47.4% 11.2%;
7+
--background: 240 5.9% 96.1%;
8+
--foreground: 222.2 84% 4.9%;
9+
--card: 240 5.2% 93.9%;
10+
--card-foreground: 222.2 84% 4.9%;
11+
--popover: 240 5.2% 93.9%;
12+
--popover-foreground: 222.2 84% 4.9%;
1313
--primary: 262 83.3% 24.7%;
1414
--primary-foreground: 210 40% 98%;
15-
--secondary: 210 40% 96.1%;
16-
--secondary-foreground: 222.2 47.4% 11.2%;
17-
--muted: 210 40% 96.1%;
18-
--muted-foreground: 215.4 16.3% 46.9%;
15+
--secondary: 240 5.2% 93.9%;
16+
--secondary-foreground: 222.2 84% 4.9%;
17+
--muted: 240 4.8% 90.9%;
18+
--muted-foreground: 240 3.8% 46.1%;
1919
--accent: 262 83.3% 24.7%;
20-
--accent-foreground: 222.2 47.4% 11.2%;
20+
--accent-foreground: 210 40% 98%;
2121
--destructive: 0 84.2% 60.2%;
2222
--destructive-foreground: 210 40% 98%;
23-
--border: 214.3 31.8% 91.4%;
24-
--input: 214.3 31.8% 91.4%;
23+
--border: 240 5.9% 85.8%;
24+
--input: 240 5.9% 85.8%;
2525
--ring: 262 83.3% 24.7%;
2626
--radius: 0.75rem;
2727
}

0 commit comments

Comments
 (0)