Skip to content

Commit 0a4262b

Browse files
committed
add router
1 parent 7fa0bef commit 0a4262b

File tree

6 files changed

+34
-33
lines changed

6 files changed

+34
-33
lines changed

apps/web/index.html

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,19 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
5+
<link rel="icon" type="image/png" href="/enra.png" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Vite + React</title>
7+
<title>Envision Technologist Chat</title>
88
<script>
99
(function () {
10-
if (
11-
!globalThis.chatbase ||
12-
globalThis.chatbase("getState") !== "initialized"
13-
) {
14-
globalThis.chatbase = (...args) => {
15-
if (!globalThis.chatbase.q) {
16-
globalThis.chatbase.q = [];
10+
if (!window.chatbase || window.chatbase("getState") !== "initialized") {
11+
window.chatbase = (...args) => {
12+
if (!window.chatbase.q) {
13+
window.chatbase.q = [];
1714
}
18-
globalThis.chatbase.q.push(args);
15+
window.chatbase.q.push(args);
1916
};
20-
globalThis.chatbase = new Proxy(globalThis.chatbase, {
17+
window.chatbase = new Proxy(window.chatbase, {
2118
get(target, prop) {
2219
if (prop === "q") {
2320
return target.q;
@@ -36,13 +33,13 @@
3633
if (document.readyState === "complete") {
3734
onLoad();
3835
} else {
39-
globalThis.addEventListener("load", onLoad);
36+
window.addEventListener("load", onLoad);
4037
}
4138
})();
4239
</script>
4340
</head>
4441
<body>
4542
<div id="app"></div>
46-
<!-- <script type="module" src="/src/main.tsx"></script> -->
43+
<script type="module" src="/src/main.tsx"></script>
4744
</body>
4845
</html>

apps/web/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"dependencies": {
1313
"@repo/ui": "workspace:*",
1414
"react": "^19.2.3",
15-
"react-dom": "^19.2.3"
15+
"react-dom": "^19.2.3",
16+
"react-router": "^7.11.0"
1617
},
1718
"devDependencies": {
1819
"@repo/eslint-config": "workspace:*",

apps/web/public/enra.png

1.66 KB
Loading

apps/web/public/typescript.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/web/public/vite.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/web/src/main.tsx

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
1+
import React from "react";
12
import { createRoot } from "react-dom/client";
23
import "./style.css";
3-
import typescriptLogo from "/typescript.svg";
4-
import { Header, Counter } from "@repo/ui";
4+
import { Header } from "@repo/ui";
5+
import { BrowserRouter, Route, Routes } from "react-router";
56

6-
const App = () => (
7+
const LandingPage = () => (
8+
<div>
9+
<Header title="Envision Technologist Assistant" />
10+
</div>
11+
);
12+
13+
const ChatPage = () => (
714
<div>
8-
<a href="https://vitejs.dev" target="_blank">
9-
<img src="/vite.svg" className="logo" alt="Vite logo" />
10-
</a>
11-
<a href="https://www.typescriptlang.org/" target="_blank">
12-
<img
13-
src={typescriptLogo}
14-
className="logo vanilla"
15-
alt="TypeScript logo"
16-
/>
17-
</a>
18-
<Header title="Web React Vite 12:02PM" />
19-
<div className="card">
20-
<Counter />
21-
</div>
15+
<Header title="Chat with the Envision Technologist" />
2216
</div>
2317
);
2418

19+
const App = () => (
20+
<React.StrictMode>
21+
<BrowserRouter>
22+
<Routes>
23+
<Route path="/" element={<LandingPage />} />
24+
<Route path="/chat" element={<ChatPage />} />
25+
</Routes>
26+
</BrowserRouter>
27+
</React.StrictMode>
28+
);
29+
2530
createRoot(document.getElementById("app")!).render(<App />);

0 commit comments

Comments
 (0)