diff --git a/.pnp.cjs b/.pnp.cjs index a7df68a..998f84d 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -30,6 +30,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@eslint/js", "npm:9.39.3"],\ ["@popperjs/core", "npm:2.11.8"],\ + ["@tanstack/query-core", "npm:5.90.20"],\ ["@types/bootstrap", "npm:5.2.10"],\ ["@types/node", "npm:24.11.0"],\ ["@types/react", "npm:19.2.14"],\ @@ -42,6 +43,8 @@ const RAW_RUNTIME_STATE = ["eslint-plugin-react-refresh", "virtual:ae939b5bf1c4da31987d1d461851d6cc956667f76e9d6d3a45643e06af20bf533b9bcec6bab70ed0ca795aebf9ce43b3ed74bd20004783b74b2a0cc963cd86b8#npm:0.4.26"],\ ["globals", "npm:16.5.0"],\ ["jotai", "virtual:ae939b5bf1c4da31987d1d461851d6cc956667f76e9d6d3a45643e06af20bf533b9bcec6bab70ed0ca795aebf9ce43b3ed74bd20004783b74b2a0cc963cd86b8#npm:2.18.0"],\ + ["jotai-tanstack-query", "virtual:ae939b5bf1c4da31987d1d461851d6cc956667f76e9d6d3a45643e06af20bf533b9bcec6bab70ed0ca795aebf9ce43b3ed74bd20004783b74b2a0cc963cd86b8#npm:0.11.0"],\ + ["prettier", "npm:3.8.1"],\ ["react", "npm:19.2.4"],\ ["react-bootstrap", "virtual:ae939b5bf1c4da31987d1d461851d6cc956667f76e9d6d3a45643e06af20bf533b9bcec6bab70ed0ca795aebf9ce43b3ed74bd20004783b74b2a0cc963cd86b8#npm:2.10.10"],\ ["react-dom", "virtual:ae939b5bf1c4da31987d1d461851d6cc956667f76e9d6d3a45643e06af20bf533b9bcec6bab70ed0ca795aebf9ce43b3ed74bd20004783b74b2a0cc963cd86b8#npm:19.2.4"],\ @@ -1155,6 +1158,15 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["@tanstack/query-core", [\ + ["npm:5.90.20", {\ + "packageLocation": "./.yarn/cache/@tanstack-query-core-npm-5.90.20-fe193b58bc-70637dfcec.zip/node_modules/@tanstack/query-core/",\ + "packageDependencies": [\ + ["@tanstack/query-core", "npm:5.90.20"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["@types/babel__core", [\ ["npm:7.20.5", {\ "packageLocation": "./.yarn/cache/@types-babel__core-npm-7.20.5-4d95f75eab-bdee3bb699.zip/node_modules/@types/babel__core/",\ @@ -1641,6 +1653,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@eslint/js", "npm:9.39.3"],\ ["@popperjs/core", "npm:2.11.8"],\ + ["@tanstack/query-core", "npm:5.90.20"],\ ["@types/bootstrap", "npm:5.2.10"],\ ["@types/node", "npm:24.11.0"],\ ["@types/react", "npm:19.2.14"],\ @@ -1653,6 +1666,8 @@ const RAW_RUNTIME_STATE = ["eslint-plugin-react-refresh", "virtual:ae939b5bf1c4da31987d1d461851d6cc956667f76e9d6d3a45643e06af20bf533b9bcec6bab70ed0ca795aebf9ce43b3ed74bd20004783b74b2a0cc963cd86b8#npm:0.4.26"],\ ["globals", "npm:16.5.0"],\ ["jotai", "virtual:ae939b5bf1c4da31987d1d461851d6cc956667f76e9d6d3a45643e06af20bf533b9bcec6bab70ed0ca795aebf9ce43b3ed74bd20004783b74b2a0cc963cd86b8#npm:2.18.0"],\ + ["jotai-tanstack-query", "virtual:ae939b5bf1c4da31987d1d461851d6cc956667f76e9d6d3a45643e06af20bf533b9bcec6bab70ed0ca795aebf9ce43b3ed74bd20004783b74b2a0cc963cd86b8#npm:0.11.0"],\ + ["prettier", "npm:3.8.1"],\ ["react", "npm:19.2.4"],\ ["react-bootstrap", "virtual:ae939b5bf1c4da31987d1d461851d6cc956667f76e9d6d3a45643e06af20bf533b9bcec6bab70ed0ca795aebf9ce43b3ed74bd20004783b74b2a0cc963cd86b8#npm:2.10.10"],\ ["react-dom", "virtual:ae939b5bf1c4da31987d1d461851d6cc956667f76e9d6d3a45643e06af20bf533b9bcec6bab70ed0ca795aebf9ce43b3ed74bd20004783b74b2a0cc963cd86b8#npm:19.2.4"],\ @@ -2573,6 +2588,40 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["jotai-tanstack-query", [\ + ["npm:0.11.0", {\ + "packageLocation": "./.yarn/cache/jotai-tanstack-query-npm-0.11.0-03b723286e-9c87d69cb2.zip/node_modules/jotai-tanstack-query/",\ + "packageDependencies": [\ + ["jotai-tanstack-query", "npm:0.11.0"]\ + ],\ + "linkType": "SOFT"\ + }],\ + ["virtual:ae939b5bf1c4da31987d1d461851d6cc956667f76e9d6d3a45643e06af20bf533b9bcec6bab70ed0ca795aebf9ce43b3ed74bd20004783b74b2a0cc963cd86b8#npm:0.11.0", {\ + "packageLocation": "./.yarn/__virtual__/jotai-tanstack-query-virtual-986809521a/0/cache/jotai-tanstack-query-npm-0.11.0-03b723286e-9c87d69cb2.zip/node_modules/jotai-tanstack-query/",\ + "packageDependencies": [\ + ["@tanstack/query-core", "npm:5.90.20"],\ + ["@tanstack/react-query", null],\ + ["@types/jotai", null],\ + ["@types/react", "npm:19.2.14"],\ + ["@types/tanstack__query-core", null],\ + ["@types/tanstack__react-query", null],\ + ["jotai", "virtual:ae939b5bf1c4da31987d1d461851d6cc956667f76e9d6d3a45643e06af20bf533b9bcec6bab70ed0ca795aebf9ce43b3ed74bd20004783b74b2a0cc963cd86b8#npm:2.18.0"],\ + ["jotai-tanstack-query", "virtual:ae939b5bf1c4da31987d1d461851d6cc956667f76e9d6d3a45643e06af20bf533b9bcec6bab70ed0ca795aebf9ce43b3ed74bd20004783b74b2a0cc963cd86b8#npm:0.11.0"],\ + ["react", "npm:19.2.4"]\ + ],\ + "packagePeers": [\ + "@tanstack/query-core",\ + "@tanstack/react-query",\ + "@types/jotai",\ + "@types/react",\ + "@types/tanstack__query-core",\ + "@types/tanstack__react-query",\ + "jotai",\ + "react"\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["js-tokens", [\ ["npm:4.0.0", {\ "packageLocation": "./.yarn/cache/js-tokens-npm-4.0.0-0ac852e9e2-e248708d37.zip/node_modules/js-tokens/",\ @@ -3027,6 +3076,15 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["prettier", [\ + ["npm:3.8.1", {\ + "packageLocation": "./.yarn/unplugged/prettier-npm-3.8.1-04022a855f/node_modules/prettier/",\ + "packageDependencies": [\ + ["prettier", "npm:3.8.1"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["proc-log", [\ ["npm:6.1.0", {\ "packageLocation": "./.yarn/cache/proc-log-npm-6.1.0-84e609b3f4-4f178d4062.zip/node_modules/proc-log/",\ diff --git a/.yarn/cache/@tanstack-query-core-npm-5.90.20-fe193b58bc-70637dfcec.zip b/.yarn/cache/@tanstack-query-core-npm-5.90.20-fe193b58bc-70637dfcec.zip new file mode 100644 index 0000000..ca405f5 Binary files /dev/null and b/.yarn/cache/@tanstack-query-core-npm-5.90.20-fe193b58bc-70637dfcec.zip differ diff --git a/.yarn/cache/jotai-tanstack-query-npm-0.11.0-03b723286e-9c87d69cb2.zip b/.yarn/cache/jotai-tanstack-query-npm-0.11.0-03b723286e-9c87d69cb2.zip new file mode 100644 index 0000000..a7144c3 Binary files /dev/null and b/.yarn/cache/jotai-tanstack-query-npm-0.11.0-03b723286e-9c87d69cb2.zip differ diff --git a/.yarn/cache/prettier-npm-3.8.1-04022a855f-33169b5940.zip b/.yarn/cache/prettier-npm-3.8.1-04022a855f-33169b5940.zip new file mode 100644 index 0000000..283c02d Binary files /dev/null and b/.yarn/cache/prettier-npm-3.8.1-04022a855f-33169b5940.zip differ diff --git a/README.md b/README.md index d2e7761..8c2d760 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ If you are developing a production application, we recommend updating the config ```js export default defineConfig([ - globalIgnores(['dist']), + globalIgnores(["dist"]), { - files: ['**/*.{ts,tsx}'], + files: ["**/*.{ts,tsx}"], extends: [ // Other configs... @@ -34,40 +34,40 @@ export default defineConfig([ ], languageOptions: { parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], + project: ["./tsconfig.node.json", "./tsconfig.app.json"], tsconfigRootDir: import.meta.dirname, }, // other options... }, }, -]) +]); ``` You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: ```js // eslint.config.js -import reactX from 'eslint-plugin-react-x' -import reactDom from 'eslint-plugin-react-dom' +import reactX from "eslint-plugin-react-x"; +import reactDom from "eslint-plugin-react-dom"; export default defineConfig([ - globalIgnores(['dist']), + globalIgnores(["dist"]), { - files: ['**/*.{ts,tsx}'], + files: ["**/*.{ts,tsx}"], extends: [ // Other configs... // Enable lint rules for React - reactX.configs['recommended-typescript'], + reactX.configs["recommended-typescript"], // Enable lint rules for React DOM reactDom.configs.recommended, ], languageOptions: { parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], + project: ["./tsconfig.node.json", "./tsconfig.app.json"], tsconfigRootDir: import.meta.dirname, }, // other options... }, }, -]) +]); ``` diff --git a/eslint.config.js b/eslint.config.js index 5e6b472..75d3c46 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,14 +1,14 @@ -import js from '@eslint/js' -import globals from 'globals' -import reactHooks from 'eslint-plugin-react-hooks' -import reactRefresh from 'eslint-plugin-react-refresh' -import tseslint from 'typescript-eslint' -import { defineConfig, globalIgnores } from 'eslint/config' +import js from "@eslint/js"; +import globals from "globals"; +import reactHooks from "eslint-plugin-react-hooks"; +import reactRefresh from "eslint-plugin-react-refresh"; +import tseslint from "typescript-eslint"; +import { defineConfig, globalIgnores } from "eslint/config"; export default defineConfig([ - globalIgnores(['dist']), + globalIgnores(["dist"]), { - files: ['**/*.{ts,tsx}'], + files: ["**/*.{ts,tsx}"], extends: [ js.configs.recommended, tseslint.configs.recommended, @@ -20,4 +20,4 @@ export default defineConfig([ globals: globals.browser, }, }, -]) +]); diff --git a/index.html b/index.html index 1f75b69..456a374 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,6 @@ - am_i_up_ui diff --git a/package.json b/package.json index eb9dd72..9831a7e 100644 --- a/package.json +++ b/package.json @@ -5,16 +5,26 @@ "type": "module", "scripts": { "dev": "vite", - "build": "tsc -b && vite build", + "build": "vite build", "lint": "eslint .", + "prettier": "npx prettier --write .", "preview": "vite preview" }, "dependencies": { + "@popperjs/core": "^2.11.8", + "@tanstack/query-core": "^5.90.20", + "bootstrap": "^5.3.8", + "jotai": "^2.18.0", + "jotai-tanstack-query": "^0.11.0", + "prettier": "^3.8.1", "react": "^19.2.0", - "react-dom": "^19.2.0" + "react-bootstrap": "^2.10.10", + "react-dom": "^19.2.0", + "react-router-dom": "^7.13.1" }, "devDependencies": { "@eslint/js": "^9.39.1", + "@types/bootstrap": "^5", "@types/node": "^24.10.1", "@types/react": "^19.2.7", "@types/react-dom": "^19.2.3", diff --git a/package.xml b/package.xml index f8bbd0e..78192c8 100644 --- a/package.xml +++ b/package.xml @@ -10,6 +10,9 @@ ament_cmake + + python3-aiohttp + python3-aiohttp-cors ament_cmake diff --git a/public/vite.svg b/public/vite.svg deleted file mode 100644 index e7b8dfb..0000000 --- a/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/App.css b/src/App.css index b9d355d..15b872a 100644 --- a/src/App.css +++ b/src/App.css @@ -1,42 +1,26 @@ -#root { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; +.App { text-align: center; } -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; - transition: filter 300ms; -} -.logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); -} -.logo.react:hover { - filter: drop-shadow(0 0 2em #61dafbaa); +.padded { + padding-left: 10px; + padding-right: 10px; + padding-top: 10px; + padding-bottom: 10px; } -@keyframes logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } +.vert-padded { + padding-top: 10px; + padding-bottom: 10px; } -@media (prefers-reduced-motion: no-preference) { - a:nth-of-type(2) .logo { - animation: logo-spin infinite 20s linear; - } +.vert-padded-status { + padding-top: 15px; } -.card { - padding: 2em; -} - -.read-the-docs { - color: #888; +.footer { + text-align: center; + padding-top: 30px; + font-size: 0.5em; + color: grey; } diff --git a/src/App.tsx b/src/App.tsx index 3d7ded3..07598d1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,35 +1,38 @@ -import { useState } from 'react' -import reactLogo from './assets/react.svg' -import viteLogo from '/vite.svg' -import './App.css' +import { useState } from "react"; +import { createBrowserRouter, RouterProvider } from "react-router-dom"; +import { Provider as JotaiProvider } from "jotai"; +import { Home } from "./Home.tsx"; +import { Version } from "./Version.tsx"; +import { Network } from "./Network.tsx"; +import "./App.css"; function App() { - const [count, setCount] = useState(0) - return ( - <> -
- - Vite logo - - - React logo - -
-

Vite + React

-
- -

- Edit src/App.tsx and save to test HMR -

-
-

- Click on the Vite and React logos to learn more -

- - ) +
+ + + +
+ ); } -export default App +const router = createBrowserRouter([ + { + path: "/", + element: , + }, + { + path: "/index.html", + element: , + }, + { + path: "/network", + element: , + }, + { + path: "/version", + element: , + }, +]); + +export default App; diff --git a/src/AppNav.tsx b/src/AppNav.tsx new file mode 100644 index 0000000..9d52852 --- /dev/null +++ b/src/AppNav.tsx @@ -0,0 +1,32 @@ +import { Navbar, Nav, Container } from "react-bootstrap"; +import { Link } from "react-router-dom"; + +export function AppNav() { + return ( + + + + N-DRIVE + + + + + + + + ); +} + +export function Footer() { + return

Made with {"<3"} by James Pace.

; +} diff --git a/src/Home.tsx b/src/Home.tsx new file mode 100644 index 0000000..87855d0 --- /dev/null +++ b/src/Home.tsx @@ -0,0 +1,14 @@ +import { AppNav, Footer } from "./AppNav.tsx"; +import { Container, Row, Col, Image } from "react-bootstrap"; + +export function Home() { + return ( +
+ + +

Hello World!

+
+
+
+ ); +} diff --git a/src/Network.tsx b/src/Network.tsx new file mode 100644 index 0000000..f4e7009 --- /dev/null +++ b/src/Network.tsx @@ -0,0 +1,14 @@ +import { AppNav, Footer } from "./AppNav.tsx"; +import { Container, Row, Col, Image } from "react-bootstrap"; + +export function Network() { + return ( +
+ + +

Hello World!

+
+
+
+ ); +} diff --git a/src/Version.tsx b/src/Version.tsx new file mode 100644 index 0000000..c0aa482 --- /dev/null +++ b/src/Version.tsx @@ -0,0 +1,47 @@ +import { AppNav, Footer } from "./AppNav.tsx"; +import { Container, Row, Col, Image } from "react-bootstrap"; +import { atom, useAtom } from 'jotai'; +import { atomWithQuery } from 'jotai-tanstack-query'; + +const versionQueryFn = async () => { + const resp = await fetch("api/build_info"); + if(!resp.ok) { + throw new Error('Network response was not ok') + } + console.log(resp); + return resp.json(); +} + +const versionAtom = atomWithQuery( () => + ({ + queryKey: ["version"], + queryFn: versionQueryFn, + }) +); + +export function Version() { + const [{ data, isPending, isError }] = useAtom(versionAtom); + + let versionText = () => { + if(isPending) { + return "Loading..."; + } + if(isError) { + return "Error loading!"; + } + return JSON.stringify(data); + }; + + + return ( +
+ + +

+ {versionText()} +

+
+
+
+ ); +} diff --git a/src/assets/react.svg b/src/assets/react.svg deleted file mode 100644 index 6c87de9..0000000 --- a/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/index.css b/src/index.css deleted file mode 100644 index 08a3ac9..0000000 --- a/src/index.css +++ /dev/null @@ -1,68 +0,0 @@ -:root { - font-family: system-ui, Avenir, Helvetica, Arial, sans-serif; - line-height: 1.5; - font-weight: 400; - - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} -a:hover { - color: #535bf2; -} - -body { - margin: 0; - display: flex; - place-items: center; - min-width: 320px; - min-height: 100vh; -} - -h1 { - font-size: 3.2em; - line-height: 1.1; -} - -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - background-color: #1a1a1a; - cursor: pointer; - transition: border-color 0.25s; -} -button:hover { - border-color: #646cff; -} -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #ffffff; - } - a:hover { - color: #747bff; - } - button { - background-color: #f9f9f9; - } -} diff --git a/src/main.tsx b/src/main.tsx index bef5202..6a6166f 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,10 +1,10 @@ -import { StrictMode } from 'react' -import { createRoot } from 'react-dom/client' -import './index.css' -import App from './App.tsx' +import { StrictMode } from "react"; +import { createRoot } from "react-dom/client"; +import App from "./App.tsx"; +import "bootstrap/dist/css/bootstrap.min.css"; -createRoot(document.getElementById('root')!).render( +createRoot(document.getElementById("root")!).render( , -) +); diff --git a/vite.config.ts b/vite.config.ts index 8b0f57b..82bc573 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,10 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; // https://vite.dev/config/ export default defineConfig({ plugins: [react()], -}) + server: { + cors: false, + }, +}); diff --git a/yarn.lock b/yarn.lock index 462c79c..108cd7d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -852,6 +852,13 @@ __metadata: languageName: node linkType: hard +"@tanstack/query-core@npm:^5.90.20": + version: 5.90.20 + resolution: "@tanstack/query-core@npm:5.90.20" + checksum: 10c0/70637dfcecd5ed9d810629aa27f1632af8a4bcd083e75cf29408d058c32f8234704a3231ec280e2c4016ea0485b16124fdf70ab97793b5a7b670f43f7659e9fe + languageName: node + linkType: hard + "@types/babel__core@npm:^7.20.5": version: 7.20.5 resolution: "@types/babel__core@npm:7.20.5" @@ -1167,6 +1174,7 @@ __metadata: dependencies: "@eslint/js": "npm:^9.39.1" "@popperjs/core": "npm:^2.11.8" + "@tanstack/query-core": "npm:^5.90.20" "@types/bootstrap": "npm:^5" "@types/node": "npm:^24.10.1" "@types/react": "npm:^19.2.7" @@ -1178,6 +1186,8 @@ __metadata: eslint-plugin-react-refresh: "npm:^0.4.24" globals: "npm:^16.5.0" jotai: "npm:^2.18.0" + jotai-tanstack-query: "npm:^0.11.0" + prettier: "npm:^3.8.1" react: "npm:^19.2.0" react-bootstrap: "npm:^2.10.10" react-dom: "npm:^19.2.0" @@ -1970,6 +1980,23 @@ __metadata: languageName: node linkType: hard +"jotai-tanstack-query@npm:^0.11.0": + version: 0.11.0 + resolution: "jotai-tanstack-query@npm:0.11.0" + peerDependencies: + "@tanstack/query-core": "*" + "@tanstack/react-query": "*" + jotai: ">=2.0.0" + react: ^18.0.0 || ^19.0.0 + peerDependenciesMeta: + "@tanstack/react-query": + optional: true + react: + optional: true + checksum: 10c0/9c87d69cb2a401eb55e796d1aa7241bd42db787f2647e1f43c7c9279a153af0ed04569930c7c85a461d63e15e3959972cbdf7c83a3cc145330739b8a0ca5c458 + languageName: node + linkType: hard + "jotai@npm:^2.18.0": version: 2.18.0 resolution: "jotai@npm:2.18.0" @@ -2402,6 +2429,15 @@ __metadata: languageName: node linkType: hard +"prettier@npm:^3.8.1": + version: 3.8.1 + resolution: "prettier@npm:3.8.1" + bin: + prettier: bin/prettier.cjs + checksum: 10c0/33169b594009e48f570471271be7eac7cdcf88a209eed39ac3b8d6d78984039bfa9132f82b7e6ba3b06711f3bfe0222a62a1bfb87c43f50c25a83df1b78a2c42 + languageName: node + linkType: hard + "proc-log@npm:^6.0.0": version: 6.1.0 resolution: "proc-log@npm:6.1.0"