+
+
setBgFocus(true)} />
+
);
}
diff --git a/public/model b/public/model
new file mode 100644
index 0000000..5c0b6b7
Binary files /dev/null and b/public/model differ
diff --git a/server.ts b/server.ts
new file mode 100644
index 0000000..46e9c34
--- /dev/null
+++ b/server.ts
@@ -0,0 +1,87 @@
+import chalk from "chalk";
+import express from "express";
+import ViteExpress from "vite-express";
+import pjson from "./package.json";
+import { networkInterfaces } from "os";
+import cac from "cac";
+const start = new Date();
+
+const cli = cac();
+const nets = networkInterfaces();
+const ips: string[] = [];
+for (const name of Object.keys(nets)) {
+ if (nets[name] === undefined) {
+ continue;
+ }
+ for (const net of nets[name]) {
+ // Skip over non-IPv4 and internal (i.e. 127.0.0.1) addresses
+ // 'IPv4' is in Node <= 17, from 18 it's a number 4 or 6
+ const familyV4Value = typeof net.family === "string" ? "IPv4" : 4;
+ if (net.family === familyV4Value && !net.internal) {
+ ips.push(net.address);
+ }
+ }
+}
+
+const app = express();
+const port = 3000;
+let host = "localhost";
+
+cli.option("--host [host]", "Sepcify host name")
+cli.help()
+cli.version(pjson.version);
+const parsed = cli.parse();
+if (parsed.options.host!==undefined && typeof parsed.options.host == "boolean" && parsed.options.host) {
+ host = "0.0.0.0";
+}
+
+app.get("/message", (_, res) => res.send("Hello from express!"));
+
+async function helloMessage() {
+ const { base } = await ViteExpress.getViteConfig();
+ //console.clear();
+ const timeCost = new Date().getTime() - start.getTime();
+ console.log("");
+ console.log(
+ " ",
+ chalk.redBright("SparkHome"),
+ chalk.redBright("v" + pjson.version),
+ chalk.whiteBright(" ready in"),
+ `${Math.round(timeCost)} ms`
+ );
+ console.log("");
+ console.log(" ", chalk.redBright("➜ "), "Local:\t", chalk.cyan(`http://${host}:${port}${base}`));
+ if (host !== "localhost") {
+ for (const ip of ips) {
+ console.log(" ", chalk.redBright("➜ "), "Network:\t", chalk.cyan(`http://${ip}:${port}${base}`));
+ }
+ }
+ console.log(" ", chalk.red("➜ "), chalk.whiteBright("press"), "h + enter", chalk.whiteBright("to show help"))
+}
+
+const server = app.listen(port, host);
+
+ViteExpress.bind(app, server, helloMessage);
+
+async function a() {
+ for await (const line of console) {
+ switch (line) {
+ case "h":
+ console.log(" Shortcuts");
+ console.log(" ", chalk.whiteBright("press"), "c + enter ", chalk.whiteBright("to clear console"));
+ console.log(" ", chalk.whiteBright("press"), "q + enter ", chalk.whiteBright("to quit"));
+ break;
+ case "c":
+ console.clear();
+ break;
+ case "q":
+ server.on("vite:close", ()=>{});
+ server.close();
+ return;
+ default:
+ break;
+ }
+ }
+}
+
+a();
\ No newline at end of file
diff --git a/src/app.tsx b/src/app.tsx
index ce118cb..a432ff6 100644
--- a/src/app.tsx
+++ b/src/app.tsx
@@ -3,19 +3,20 @@ import { useRoutes } from "react-router-dom";
import routes from "~react-pages";
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
-import LanguageDetector from 'i18next-browser-languagedetector';
-import ICU from 'i18next-icu';
-import * as en from "i18n/en.json"
-import * as zh from "i18n/zh.json"
-import * as ja from "i18n/ja.json"
-import * as ar from "i18n/ar.json"
-import * as de from "i18n/de.json"
-import * as es from "i18n/es.json"
-import * as fr from "i18n/fr.json"
-import * as it from "i18n/it.json"
-import * as ko from "i18n/ko.json"
-import * as pt from "i18n/pt.json"
-import * as ru from "i18n/ru.json"
+import LanguageDetector from "i18next-browser-languagedetector";
+import ICU from "i18next-icu";
+import * as en from "i18n/en.json";
+import * as zh from "i18n/zh.json";
+import * as ja from "i18n/ja.json";
+import * as ar from "i18n/ar.json";
+import * as de from "i18n/de.json";
+import * as es from "i18n/es.json";
+import * as fr from "i18n/fr.json";
+import * as it from "i18n/it.json";
+import * as ko from "i18n/ko.json";
+import * as pt from "i18n/pt.json";
+import * as ru from "i18n/ru.json";
+import { NextUIProvider } from "@nextui-org/react";
i18n.use(initReactI18next) // passes i18n down to react-i18next
.use(LanguageDetector)
@@ -63,12 +64,15 @@ i18n.use(initReactI18next) // passes i18n down to react-i18next
},
detection: {
- order: ['navigator'],
+ order: ["navigator"],
caches: []
}
});
-
export function App() {
- return
Loading...}>{useRoutes(routes)};
+ return (
+
+ Loading...}>{useRoutes(routes)}
+
+ );
}
diff --git a/tailwind.config.ts b/tailwind.config.ts
index b52deb2..ca7c3e9 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -1,9 +1,12 @@
import type { Config } from "tailwindcss";
+import { nextui } from "@nextui-org/react";
+
const config: Config = {
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
+ "./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}",
"./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}"
],
theme: {
@@ -13,6 +16,8 @@ const config: Config = {
"gradient-conic": "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))"
}
}
- }
+ },
+ darkMode: "class",
+ plugins: [nextui()],
};
export default config;