Skip to content

Commit a691484

Browse files
author
Terry Zhao
authored
nextjs to vite (#8)
1 parent f25ee53 commit a691484

40 files changed

+405
-224
lines changed

copier.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ _exclude:
2525
- ".github"
2626
- "copier"
2727
- "CONTRIBUTING.md"
28-
- "copier.yaml"
28+
- "copier.yaml"

test-proj/.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2-
_commit: '2014036'
2+
_commit: 3a6a0ad
33
_src_path: .
44
project_name: test-proj
55
project_title: Test Proj

test-proj/ui/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# next.js
1717
/.next/
1818
/out/
19+
/dist/
1920

2021
# production
2122
/build
@@ -39,3 +40,8 @@ yarn-error.log*
3940
# typescript
4041
*.tsbuildinfo
4142
next-env.d.ts
43+
44+
# Development files (not part of copier template)
45+
# These files exist for local development, .jinja versions are template sources
46+
package.json
47+
src/lib/config.ts

test-proj/ui/components.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "new-york",
4+
"rsc": true,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "",
8+
"css": "src/index.css",
9+
"baseColor": "zinc",
10+
"cssVariables": true,
11+
"prefix": ""
12+
},
13+
"aliases": {
14+
"components": "@/components",
15+
"utils": "@/lib/utils",
16+
"ui": "@/components/ui",
17+
"lib": "@/lib",
18+
"hooks": "@/hooks"
19+
},
20+
"iconLibrary": "lucide"
21+
}

test-proj/ui/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Test Proj</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="/src/main.tsx"></script>
11+
</body>
12+
</html>

test-proj/ui/next.config.ts

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

test-proj/ui/package.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
"name": "test-proj-ui",
33
"version": "0.1.0",
44
"private": true,
5+
"type": "module",
56
"scripts": {
6-
"dev": "next dev --turbopack",
7-
"build": "next build --experimental-build-mode compile",
8-
"start": "next start",
7+
"dev": "vite",
8+
"build": "tsc && vite build",
9+
"preview": "vite preview",
910
"lint": "tsc --noEmit",
1011
"format": "prettier --write src",
1112
"format-check": "prettier --check src",
@@ -19,12 +20,13 @@
1920
"@llamaindex/cloud": "^4.0.28",
2021
"@llamaindex/ui": "^0.3.2",
2122
"@radix-ui/themes": "^3.2.1",
23+
"@swc/helpers": "^0.5.17",
2224
"class-variance-authority": "^0.7.1",
2325
"clsx": "^2.1.1",
2426
"lucide-react": "^0.514.0",
25-
"next": "15.3.2",
2627
"react": "^18.3.0",
2728
"react-dom": "^18.3.0",
29+
"react-router-dom": "^6.30.0",
2830
"sonner": "^2.0.5",
2931
"tw-animate-css": "^1.3.5"
3032
},
@@ -33,11 +35,13 @@
3335
"@types/node": "^20",
3436
"@types/react": "^19",
3537
"@types/react-dom": "^19",
38+
"@vitejs/plugin-react": "^4.3.4",
3639
"postcss": "^8.5.5",
3740
"prettier": "^3.6.2",
3841
"tailwind-merge": "^3.3.1",
3942
"tailwindcss": "^4.1.8",
40-
"typescript": "^5"
43+
"typescript": "^5",
44+
"vite": "^6.0.5"
4145
},
4246
"packageManager": "pnpm@10.11.1+sha512.e519b9f7639869dc8d5c3c5dfef73b3f091094b0a006d7317353c72b124e80e1afd429732e28705ad6bfa1ee879c1fce46c128ccebd3192101f43dd67c667912"
4347
}

ui/src/app/layout.tsx renamed to test-proj/ui/src/App.tsx

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,37 @@
1-
"use client";
2-
import "@/lib/client";
3-
import { Geist, Geist_Mono } from "next/font/google";
4-
import "./globals.css";
1+
import React from "react";
2+
import { Routes, Route } from "react-router-dom";
53
import { Theme } from "@radix-ui/themes";
64
import {
75
Breadcrumb,
86
BreadcrumbItem,
97
BreadcrumbList,
108
BreadcrumbSeparator,
119
} from "@llamaindex/ui";
12-
import Link from "next/link";
13-
import React from "react";
10+
import { Link } from "react-router-dom";
1411
import { Toaster } from "@llamaindex/ui";
1512
import { useToolbar, ToolbarProvider } from "@/lib/ToolbarContext";
16-
import "@llamaindex/ui/styles.css";
17-
18-
const geistSans = Geist({
19-
variable: "--font-geist-sans",
20-
subsets: ["latin"],
21-
});
13+
import "@/lib/client";
2214

23-
const geistMono = Geist_Mono({
24-
variable: "--font-geist-mono",
25-
subsets: ["latin"],
26-
});
15+
// Import pages
16+
import HomePage from "./pages/HomePage";
17+
import ItemPage from "./pages/ItemPage";
2718

28-
export default function RootLayout({
29-
children,
30-
}: Readonly<{
31-
children: React.ReactNode;
32-
}>) {
19+
export default function App() {
3320
return (
34-
<html lang="en">
35-
<body className={`${geistSans.variable} ${geistMono.variable}`}>
36-
<Theme>
37-
<ToolbarProvider>
38-
<div className="grid grid-rows-[auto_1fr] h-screen">
39-
<Toolbar />
40-
<main className="overflow-auto">{children}</main>
41-
</div>
42-
<Toaster />
43-
</ToolbarProvider>
44-
</Theme>
45-
</body>
46-
</html>
21+
<Theme>
22+
<ToolbarProvider>
23+
<div className="grid grid-rows-[auto_1fr] h-screen">
24+
<Toolbar />
25+
<main className="overflow-auto">
26+
<Routes>
27+
<Route path="/" element={<HomePage />} />
28+
<Route path="/item/:itemId" element={<ItemPage />} />
29+
</Routes>
30+
</main>
31+
</div>
32+
<Toaster />
33+
</ToolbarProvider>
34+
</Theme>
4735
);
4836
}
4937

@@ -59,7 +47,7 @@ const Toolbar = () => {
5947
{index > 0 && <BreadcrumbSeparator />}
6048
<BreadcrumbItem>
6149
{item.href && !item.isCurrentPage ? (
62-
<Link href={item.href} className="font-medium text-base">
50+
<Link to={item.href} className="font-medium text-base">
6351
{item.label}
6452
</Link>
6553
) : (

test-proj/ui/src/components/workflow-trigger.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
"use client";
21
import {
32
Button,
43
FileUploader,
@@ -33,8 +32,7 @@ export default function TriggerFileWorkflow({
3332
onSuccess?: (result: any) => void;
3433
}) {
3534
const [deployment, setDeployment] = useState<string>("");
36-
37-
// Make sure it only runs on the client
35+
// Get deployment from path or environment
3836
useEffect(() => {
3937
const deploymentFromPath = window.location.pathname.split("/")[2];
4038
setDeployment(deploymentFromPath);

ui/src/app/globals.css renamed to test-proj/ui/src/index.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
@import "tailwindcss";
22
@import "tw-animate-css";
33

4-
@source "./src/**/*.{js,ts,jsx,tsx}";
5-
64
@custom-variant dark (&:is(.dark *));
75

86
@theme inline {

0 commit comments

Comments
 (0)