diff --git a/README.md b/README.md
index 64ed812..2429d43 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# TailwindElements-React-Starter
-- __nothing__ - main styling
+- [DaisyUI](https://daisyui.com/) - main styling
- [react-icons](https://react-icons.github.io/react-icons/) - big icon library
- [recharts](https://echarts.apache.org/) - charts library
- [wouter](https://github.com/molefrog/wouter) - router library
diff --git a/bun.lockb b/bun.lockb
index 4b557db..5dd2ec3 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/index.html b/index.html
index d8888cf..1a7416c 100644
--- a/index.html
+++ b/index.html
@@ -4,7 +4,6 @@
-
diff --git a/package.json b/package.json
index a1d1e12..073fe61 100644
--- a/package.json
+++ b/package.json
@@ -15,13 +15,14 @@
"@hookform/resolvers": "^3.3.2",
"@tailwindcss/forms": "^0.5.7",
"@tanstack/react-table": "^8.10.7",
- "appwrite": "^13.0.0",
"axios": "^1.6.1",
"daisyui": "latest",
"echarts": "^5.4.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.48.2",
+ "react-icons": "^4.12.0",
+ "recharts": "^2.10.1",
"uuid": "^9.0.1",
"wouter": "^2.12.1",
"zod": "^3.22.4"
diff --git a/src/configure.tsx b/src/configure.tsx
index b697977..83d92d8 100644
--- a/src/configure.tsx
+++ b/src/configure.tsx
@@ -6,6 +6,7 @@ export const main = {
viteEnv.MODE ? " [development]" : ""
}`,
program_version: "1.0.0",
+ basePath: viteEnv.VITE_BASE_PATH,
};
//About page configuration
export const about = {
diff --git a/src/consts.ts b/src/consts.ts
new file mode 100644
index 0000000..2ca849c
--- /dev/null
+++ b/src/consts.ts
@@ -0,0 +1 @@
+export const ADMINISTRATION = "administration";
diff --git a/src/features/AdministrationPage.tsx b/src/features/AdministrationPage.tsx
new file mode 100644
index 0000000..6d22b66
--- /dev/null
+++ b/src/features/AdministrationPage.tsx
@@ -0,0 +1,5 @@
+const AdministrationPage = () => {
+ return 🚀AdministrationPage🚀
;
+};
+
+export default AdministrationPage;
diff --git a/src/features/App.tsx b/src/features/App.tsx
index 9b19f5a..83cb99f 100644
--- a/src/features/App.tsx
+++ b/src/features/App.tsx
@@ -1,19 +1,31 @@
import ThemeButton from "../components/ThemeButton";
import { main } from "../configure";
+import { Router } from "wouter";
+import SwitchRoutesGenerator from "../routes/RouteStructureGenerator";
+import DebugNavigationButtonsGenerator from "../routes/DebugNavigationButtonsGenerator";
function App() {
return (
-
-
-
- {main.program_name} v{main.program_version}
-
+
+
+
+
+ {main.program_name} v{main.program_version}
+
Base path is: {main.basePath}
+
+
+
+
+
+
+
-
+
+ {/* Paths in Route should be without base path (even without '/'). If want Route for base path than pass base path */}
+
-
-
+
);
}
diff --git a/src/features/HomePage.tsx b/src/features/HomePage.tsx
new file mode 100644
index 0000000..33f7271
--- /dev/null
+++ b/src/features/HomePage.tsx
@@ -0,0 +1,16 @@
+import { useState } from "react";
+
+const HomePage = () => {
+ const [counter, setCounter] = useState
(0);
+ return (
+
+
HomePage
+
+
Counter: {counter}
+
+ );
+};
+
+export default HomePage;
diff --git a/src/features/InboxPage.tsx b/src/features/InboxPage.tsx
new file mode 100644
index 0000000..29544af
--- /dev/null
+++ b/src/features/InboxPage.tsx
@@ -0,0 +1,5 @@
+const InboxPage = () => {
+ return InboxPage
;
+};
+
+export default InboxPage;
diff --git a/src/main.tsx b/src/main.tsx
index 0216d4a..5f8488f 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -5,6 +5,7 @@ import { viteEnv } from "./configure";
import App from "./features/App";
import inDev from "./utils/inDebug";
import { Global, css } from "@emotion/react";
+import "/style.css";
setupAxiosInterceptors();
inDev(() => console.log(viteEnv));
diff --git a/src/routes.tsx b/src/routes.tsx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/routes/DebugNavigationButtonsGenerator.tsx b/src/routes/DebugNavigationButtonsGenerator.tsx
new file mode 100644
index 0000000..7ef9afd
--- /dev/null
+++ b/src/routes/DebugNavigationButtonsGenerator.tsx
@@ -0,0 +1,26 @@
+import React from "react";
+import * as R from "../routes/routes";
+import { Link } from "wouter";
+/**
+ * This component is used to generate buttons for debug navigation
+ * UNFINISHED
+ */
+const DebugNavigationButtonsGenerator = () => {
+ return (
+
+
+ Home
+
+
+ {R.routesRoot[1].icon &&
+ React.createElement(R.routesRoot[1].icon, { className: "h-6 w-6" })}
+ {R.routesRoot[1].name}
+
+
+ );
+};
+
+export default DebugNavigationButtonsGenerator;
diff --git a/src/routes/RouteStructureGenerator.tsx b/src/routes/RouteStructureGenerator.tsx
new file mode 100644
index 0000000..230febb
--- /dev/null
+++ b/src/routes/RouteStructureGenerator.tsx
@@ -0,0 +1,19 @@
+import { Route, Switch } from "wouter";
+import * as R from "./routes";
+
+const SwitchRoutesGenerator = () => {
+ const routesCrawler = (parentPath?: string): JSX.Element[] => {
+ return R.routesRoot.map((route, index) => {
+ return (
+
+ );
+ });
+ };
+ return {routesCrawler()};
+};
+
+export default SwitchRoutesGenerator;
diff --git a/src/routes/routes.tsx b/src/routes/routes.tsx
new file mode 100644
index 0000000..645b3ab
--- /dev/null
+++ b/src/routes/routes.tsx
@@ -0,0 +1,65 @@
+// ----- IMPORT ICONS -----
+import { RiHome3Fill } from "react-icons/ri";
+import { IoMdOptions } from "react-icons/io";
+import { FaUsers } from "react-icons/fa";
+// ----- IMPORT PAGES -----
+import AdministrationPage from "../features/AdministrationPage";
+import HomePage from "../features/HomePage";
+// ----- IMPORT CONSTS -----
+import { ADMINISTRATION } from "../consts";
+
+// ----- TYPE DEFINITIONS -----
+type Route = {
+ name: string;
+ path: string;
+ component: () => JSX.Element;
+ icon?: () => JSX.Element;
+ children?: Route[];
+};
+type RoutesObject = {
+ [key: string]: Route[];
+};
+
+// ----- ROUTES DEFINITIONS -----
+//! Don't leave trailor '/' in paths
+//! Paths in Route should be without base path (even without '/'). If want Route for base path than pass base path
+//* Wouter is basically join paths with each other, so if base path is "/" every sub path souldn't have "/" at the beginning
+
+// const routesSecondLevel = {};
+
+const routesFirstLevel: RoutesObject = {
+ [ADMINISTRATION]: [
+ {
+ name: "Users",
+ path: "/users",
+ component: () => <>UserPage>,
+ icon: FaUsers,
+ },
+ {
+ name: "Roles",
+ path: "/roles",
+ component: () => <>Roles>,
+ },
+ {
+ name: "Permissions",
+ path: "/permissions",
+ component: () => <>Permissions>,
+ },
+ ],
+};
+
+export const routesRoot: Route[] = [
+ {
+ name: "Home",
+ path: "/",
+ component: HomePage,
+ icon: RiHome3Fill,
+ },
+ {
+ name: ADMINISTRATION,
+ path: "administration",
+ component: AdministrationPage,
+ icon: IoMdOptions,
+ children: routesFirstLevel[ADMINISTRATION],
+ },
+];