admin_lsac 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/.eslintrc.cjs +18 -0
  2. package/README.md +162 -162
  3. package/index.html +13 -0
  4. package/package.json +42 -73
  5. package/tsconfig.app.json +27 -0
  6. package/tsconfig.json +11 -31
  7. package/tsconfig.node.json +13 -0
  8. package/vite.config.ts +7 -0
  9. package/dist/App.d.ts +0 -76
  10. package/dist/App.js +0 -12
  11. package/dist/cjs/App.js +0 -12
  12. package/dist/cjs/components/GenericForm.js +0 -305
  13. package/dist/cjs/components/Page.js +0 -119
  14. package/dist/cjs/index.js +0 -18
  15. package/dist/cjs/pages/event.js +0 -134
  16. package/dist/cjs/pages/page.js +0 -375
  17. package/dist/cjs/reportWebVitals.js +0 -38
  18. package/dist/cjs/schema/schema.config.js +0 -9
  19. package/dist/cjs/schema/schema.js +0 -2
  20. package/dist/cjs/setupTests.js +0 -7
  21. package/dist/cjs/utils/websockets.js +0 -22
  22. package/dist/components/GenericForm.js +0 -305
  23. package/dist/components/Page.js +0 -119
  24. package/dist/esm/App.js +0 -10
  25. package/dist/esm/components/GenericForm.js +0 -275
  26. package/dist/esm/components/Page.js +0 -111
  27. package/dist/esm/index.js +0 -13
  28. package/dist/esm/pages/event.js +0 -128
  29. package/dist/esm/pages/page.js +0 -349
  30. package/dist/esm/reportWebVitals.js +0 -13
  31. package/dist/esm/schema/schema.config.js +0 -6
  32. package/dist/esm/schema/schema.js +0 -1
  33. package/dist/esm/setupTests.js +0 -5
  34. package/dist/esm/utils/websockets.js +0 -15
  35. package/dist/index.js +0 -18
  36. package/dist/pages/event.js +0 -134
  37. package/dist/pages/page.js +0 -375
  38. package/dist/reportWebVitals.js +0 -38
  39. package/dist/schema/schema.config.js +0 -9
  40. package/dist/schema/schema.js +0 -2
  41. package/dist/setupTests.js +0 -7
  42. package/dist/utils/websockets.js +0 -22
  43. package/public/favicon.ico +0 -0
  44. package/public/index.html +0 -43
  45. package/public/logo192.png +0 -0
  46. package/public/logo512.png +0 -0
  47. package/public/manifest.json +0 -25
  48. package/public/robots.txt +0 -3
  49. package/server/.env.example +0 -3
  50. package/server/deploy.js +0 -29
  51. package/server/package-lock.json +0 -712
  52. package/server/package.json +0 -18
  53. package/src/App.css +0 -38
  54. package/src/App.tsx +0 -50
  55. package/src/components/GenericForm.tsx +0 -308
  56. package/src/components/Page.tsx +0 -243
  57. package/src/index.css +0 -13
  58. package/src/index.tsx +0 -20
  59. package/src/logo.svg +0 -1
  60. package/src/pages/event.ts +0 -93
  61. package/src/pages/page.ts +0 -336
  62. package/src/react-app-env.d.ts +0 -1
  63. package/src/reportWebVitals.ts +0 -15
  64. package/src/schema/schema.config.ts +0 -8
  65. package/src/schema/schema.ts +0 -63
  66. package/src/setupTests.ts +0 -5
  67. package/src/utils/websockets.tsx +0 -17
  68. package/tsconfig.esm.json +0 -7
  69. package/webpack.config.js +0 -22
package/.eslintrc.cjs ADDED
@@ -0,0 +1,18 @@
1
+ module.exports = {
2
+ root: true,
3
+ env: { browser: true, es2020: true },
4
+ extends: [
5
+ 'eslint:recommended',
6
+ 'plugin:@typescript-eslint/recommended',
7
+ 'plugin:react-hooks/recommended',
8
+ ],
9
+ ignorePatterns: ['dist', '.eslintrc.cjs'],
10
+ parser: '@typescript-eslint/parser',
11
+ plugins: ['react-refresh'],
12
+ rules: {
13
+ 'react-refresh/only-export-components': [
14
+ 'warn',
15
+ { allowConstantExport: true },
16
+ ],
17
+ },
18
+ }
package/README.md CHANGED
@@ -1,162 +1,162 @@
1
- # Generic Admin Panel
2
-
3
- For configuring your own admin panel, follow the next instructions.
4
-
5
- ### `npm install admin_lsac`
6
-
7
- This command will download and install the specified package and its dependencies into your project's node_modules directory, making it available for use in your project.
8
-
9
- ### `npm install export-to-csv@1.2.1`
10
-
11
- Export-to-csv package latest version is not working properly, so make sure you have the last functional version of this package install.
12
-
13
- ## What do you need to import?
14
-
15
- ### `import { ChakraProvider } from '@chakra-ui/react'`
16
-
17
- ### `import { pageToUrl } from 'admin_lsac'`
18
-
19
- ### `import { AdminPage } from 'admin_lsac'`
20
-
21
- You can import these in App.js / App.ts. If your project is TypeScript-based, you need to write the following line as well:
22
-
23
- ### `import { PageSchema } from 'admin_lsac'`
24
-
25
- * Import the component from above where you want to write your schemas. (See below for details about schemas)
26
-
27
- You need to create an array of schemas for your own admin panel. You can write the following inside your Routes component from App.js / App.ts:
28
-
29
- ```
30
- {your_array.map((page) => (
31
- <Route
32
- path={`${your_url_to_admin_panel}/${pageToUrl(page)}`}
33
- element={
34
- <AdminPage
35
- pages={your_array}
36
- selectedPage={page}
37
- basePath={your_url_to_admin_panel}
38
- />
39
- }
40
- />
41
- ))}
42
- {your_array[0] ? (
43
- <Route
44
- path={`${your_url_to_admin_panel}/*`}
45
- element={
46
- <AdminPage
47
- pages={your_array}
48
- selectedPage={your_array[0]}
49
- basePath={your_url_to_admin_panel}
50
- />
51
- }
52
- />
53
- ) : null}
54
- ```
55
-
56
- #### ⚠️ Don't forget to wrap the Router component into a ChakraProvider component.
57
-
58
- ## What is a schema?
59
-
60
- ```
61
- export interface PageSchema {
62
- name: string;
63
- actions: Action[];
64
- rowActions: RowAction[];
65
- getRequest: () => Promise<any[]>;
66
- tableFields: TableField[];
67
- }
68
-
69
- export interface TableField {
70
- name: string;
71
- access: (obj: any) => string | number | React.ReactElement;
72
- }
73
-
74
- export interface SimpleField {
75
- name: string;
76
- label: string;
77
- type: "string" | "number" | "file";
78
- validationSchema: any;
79
- }
80
-
81
- export interface Option {
82
- value: string | number | boolean;
83
- display: string;
84
- }
85
-
86
- export interface DropdownField {
87
- name: string;
88
- label: string;
89
- type: "dropdown";
90
- options?: Option[] | undefined;
91
- getOptions: () => Promise<Option[]>;
92
- }
93
-
94
- export interface ObjectField {
95
- name: string;
96
- label: string;
97
- type: "object";
98
- fields: FormField[];
99
- }
100
-
101
- export interface ArrayField {
102
- name: string;
103
- label: string;
104
- type: "array";
105
- element: Exclude<FormField, ArrayField>;
106
- }
107
-
108
- export type FormField = SimpleField | DropdownField | ObjectField | ArrayField;
109
-
110
- export interface Action {
111
- name: string;
112
- fields?: FormField[];
113
- onSubmit: (obj1: any, obj2?: any) => Promise<any>;
114
- }
115
-
116
- export interface RowAction {
117
- name: string;
118
- fields?: FormField[];
119
- initialise?: (obj: any) => any;
120
- onSubmit: (obj1: any, obj2?: any) => Promise<any>;
121
- }
122
- ```
123
-
124
- A page schema is based on these interfaces, which can be imported into your files. A page schema describes how one table of your admin panel would need to be structured to accomplish what the user needs regarding an entity. (i.e. users, teams, companies, quizzes)
125
-
126
- #### An array of schemas would be defined as follows:
127
-
128
- ```
129
- const your_array = [
130
- {
131
- // schema 1
132
- },
133
- {
134
- // schema 2
135
- },
136
- ...
137
- ];
138
- ```
139
-
140
- * In TypeScript, it would slightly change:
141
-
142
- ```
143
- const your_array: PageSchema[] = [
144
- {
145
- // schema 1
146
- },
147
- {
148
- // schema 2
149
- },
150
- ...
151
- ];
152
- ```
153
-
154
- ## Other Specifications
155
-
156
- Due to some corrupt dependencies, you need a Node version >= 20.5.0 to use this package in a Vite app.
157
-
158
- For every entity you describe through a page schema, getRequest and onSubmit functions will use routes created for the entity. `getRequest` function will make a GET request, while `onSumbit` will probably make a POST, PATCH or DELETE request.
159
-
160
- ## Learn More
161
-
162
- For more details, especially about page schemas, contact the owner. :)
1
+ # Generic Admin Panel
2
+
3
+ For configuring your own admin panel, follow the next instructions.
4
+
5
+ ### `npm install admin_lsac`
6
+
7
+ This command will download and install the specified package and its dependencies into your project's node_modules directory, making it available for use in your project.
8
+
9
+ ### `npm install export-to-csv@1.2.1`
10
+
11
+ Export-to-csv package latest version is not working properly, so make sure you have the last functional version of this package install.
12
+
13
+ ## What do you need to import?
14
+
15
+ ### `import { ChakraProvider } from '@chakra-ui/react'`
16
+
17
+ ### `import { pageToUrl } from 'admin_lsac'`
18
+
19
+ ### `import { AdminPage } from 'admin_lsac'`
20
+
21
+ You can import these in App.js / App.ts. If your project is TypeScript-based, you need to write the following line as well:
22
+
23
+ ### `import { PageSchema } from 'admin_lsac'`
24
+
25
+ * Import the component from above where you want to write your schemas. (See below for details about schemas)
26
+
27
+ You need to create an array of schemas for your own admin panel. You can write the following inside your Routes component from App.js / App.ts:
28
+
29
+ ```
30
+ {your_array.map((page) => (
31
+ <Route
32
+ path={`${your_url_to_admin_panel}/${pageToUrl(page)}`}
33
+ element={
34
+ <AdminPage
35
+ pages={your_array}
36
+ selectedPage={page}
37
+ basePath={your_url_to_admin_panel}
38
+ />
39
+ }
40
+ />
41
+ ))}
42
+ {your_array[0] ? (
43
+ <Route
44
+ path={`${your_url_to_admin_panel}/*`}
45
+ element={
46
+ <AdminPage
47
+ pages={your_array}
48
+ selectedPage={your_array[0]}
49
+ basePath={your_url_to_admin_panel}
50
+ />
51
+ }
52
+ />
53
+ ) : null}
54
+ ```
55
+
56
+ #### ⚠️ Don't forget to wrap the Router component into a ChakraProvider component.
57
+
58
+ ## What is a schema?
59
+
60
+ ```
61
+ export interface PageSchema {
62
+ name: string;
63
+ actions: Action[];
64
+ rowActions: RowAction[];
65
+ getRequest: () => Promise<any[]>;
66
+ tableFields: TableField[];
67
+ }
68
+
69
+ export interface TableField {
70
+ name: string;
71
+ access: (obj: any) => string | number | React.ReactElement;
72
+ }
73
+
74
+ export interface SimpleField {
75
+ name: string;
76
+ label: string;
77
+ type: "string" | "number" | "file";
78
+ validationSchema: any;
79
+ }
80
+
81
+ export interface Option {
82
+ value: string | number | boolean;
83
+ display: string;
84
+ }
85
+
86
+ export interface DropdownField {
87
+ name: string;
88
+ label: string;
89
+ type: "dropdown";
90
+ options?: Option[] | undefined;
91
+ getOptions: () => Promise<Option[]>;
92
+ }
93
+
94
+ export interface ObjectField {
95
+ name: string;
96
+ label: string;
97
+ type: "object";
98
+ fields: FormField[];
99
+ }
100
+
101
+ export interface ArrayField {
102
+ name: string;
103
+ label: string;
104
+ type: "array";
105
+ element: Exclude<FormField, ArrayField>;
106
+ }
107
+
108
+ export type FormField = SimpleField | DropdownField | ObjectField | ArrayField;
109
+
110
+ export interface Action {
111
+ name: string;
112
+ fields?: FormField[];
113
+ onSubmit: (obj1: any, obj2?: any) => Promise<any>;
114
+ }
115
+
116
+ export interface RowAction {
117
+ name: string;
118
+ fields?: FormField[];
119
+ initialise?: (obj: any) => any;
120
+ onSubmit: (obj1: any, obj2?: any) => Promise<any>;
121
+ }
122
+ ```
123
+
124
+ A page schema is based on these interfaces, which can be imported into your files. A page schema describes how one table of your admin panel would need to be structured to accomplish what the user needs regarding an entity. (i.e. users, teams, companies, quizzes)
125
+
126
+ #### An array of schemas would be defined as follows:
127
+
128
+ ```
129
+ const your_array = [
130
+ {
131
+ // schema 1
132
+ },
133
+ {
134
+ // schema 2
135
+ },
136
+ ...
137
+ ];
138
+ ```
139
+
140
+ * In TypeScript, it would slightly change:
141
+
142
+ ```
143
+ const your_array: PageSchema[] = [
144
+ {
145
+ // schema 1
146
+ },
147
+ {
148
+ // schema 2
149
+ },
150
+ ...
151
+ ];
152
+ ```
153
+
154
+ ## Other Specifications
155
+
156
+ Due to some corrupt dependencies, you need a Node version >= 20.5.0 to use this package in a Vite app.
157
+
158
+ For every entity you describe through a page schema, getRequest and onSubmit functions will use routes created for the entity. `getRequest` function will make a GET request, while `onSumbit` will probably make a POST, PATCH or DELETE request.
159
+
160
+ ## Learn More
161
+
162
+ For more details, especially about page schemas, contact the owner. :)
package/index.html ADDED
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Admin Panel</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>
package/package.json CHANGED
@@ -1,73 +1,42 @@
1
- {
2
- "name": "admin_lsac",
3
- "version": "1.3.2",
4
- "description": "Generic Admin Panel created for storing events' data",
5
- "private": false,
6
- "dependencies": {
7
- "@chakra-ui/react": "^2.5.5",
8
- "@emotion/react": "^11.10.6",
9
- "@emotion/styled": "^11.10.6",
10
- "@tanstack/match-sorter-utils": "^8.8.4",
11
- "@tanstack/react-table": "^8.10.7",
12
- "@tanstack/react-virtual": "^3.0.0-beta.68",
13
- "@testing-library/jest-dom": "^5.16.5",
14
- "@testing-library/react": "^13.4.0",
15
- "@testing-library/user-event": "^13.5.0",
16
- "@types/jest": "^27.5.2",
17
- "@types/node": "^16.18.23",
18
- "@types/react-dom": "^18.0.11",
19
- "axios": "^1.3.5",
20
- "export-to-csv": "^1.2.1",
21
- "formik": "^2.2.9",
22
- "framer-motion": "^10.11.6",
23
- "material-react-table": "^2.0.2",
24
- "nth-check": "^2.1.1",
25
- "postcss": "^8.4.35",
26
- "prettier": "^2.8.7",
27
- "react": "^18.2.0",
28
- "react-dom": "^18.2.0",
29
- "react-router": "^6.10.0",
30
- "react-router-dom": "^6.10.0",
31
- "react-scripts": "^5.0.1",
32
- "react-table": "^7.8.0",
33
- "socket.io-client": "^4.7.5",
34
- "sweetalert2": "^11.6.13",
35
- "typescript": "^4.9.5",
36
- "web-vitals": "^2.1.4",
37
- "yup": "^1.0.2"
38
- },
39
- "scripts": {
40
- "start": "react-scripts start",
41
- "build": "react-scripts build",
42
- "test": "react-scripts test",
43
- "eject": "react-scripts eject",
44
- "format": "prettier --write \"src/**/*.ts\" \"src/**/*.tsx\""
45
- },
46
- "eslintConfig": {
47
- "extends": [
48
- "react-app",
49
- "react-app/jest"
50
- ]
51
- },
52
- "browserslist": {
53
- "production": [
54
- ">0.2%",
55
- "not dead",
56
- "not op_mini all"
57
- ],
58
- "development": [
59
- "last 1 chrome version",
60
- "last 1 firefox version",
61
- "last 1 safari version"
62
- ]
63
- },
64
- "devDependencies": {
65
- "@types/react": "^18.2.65",
66
- "@types/react-table": "^7.7.17",
67
- "ts-loader": "^9.5.1",
68
- "webpack-cli": "^5.1.4"
69
- },
70
- "main": "dist/components/Page.js",
71
- "module": "dist/esm/components/Page.js",
72
- "types": "dist/App.d.ts"
73
- }
1
+ {
2
+ "name": "admin_lsac",
3
+ "private": false,
4
+ "version": "1.4.0",
5
+ "description": "Generic Admin Panel created for storing events' data",
6
+ "type": "module",
7
+ "scripts": {
8
+ "dev": "vite",
9
+ "build": "tsc -b && vite build",
10
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
11
+ "preview": "vite preview"
12
+ },
13
+ "dependencies": {
14
+ "@chakra-ui/react": "^2.8.2",
15
+ "@mui/material": "^5.15.20",
16
+ "axios": "^1.7.2",
17
+ "export-to-csv": "^1.3.0",
18
+ "formik": "^2.4.6",
19
+ "material-react-table": "^2.13.0",
20
+ "react": "^18.3.1",
21
+ "react-dom": "^18.3.1",
22
+ "react-router-dom": "^6.24.0",
23
+ "socket.io-client": "^4.7.5",
24
+ "sweetalert2": "^11.12.0",
25
+ "yup": "^1.4.0"
26
+ },
27
+ "devDependencies": {
28
+ "@types/react": "^18.3.3",
29
+ "@types/react-dom": "^18.3.0",
30
+ "@typescript-eslint/eslint-plugin": "^7.13.1",
31
+ "@typescript-eslint/parser": "^7.13.1",
32
+ "@vitejs/plugin-react-swc": "^3.5.0",
33
+ "eslint": "^8.57.0",
34
+ "eslint-plugin-react-hooks": "^4.6.2",
35
+ "eslint-plugin-react-refresh": "^0.4.7",
36
+ "typescript": "^5.2.2",
37
+ "vite": "^5.3.1"
38
+ },
39
+ "main": "dist/components/AdminPage.js",
40
+ "module": "dist/esm/components/AdminPage.js",
41
+ "types": "dist/App.d.ts"
42
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "target": "ES2020",
6
+ "useDefineForClassFields": true,
7
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
8
+ "module": "ESNext",
9
+ "skipLibCheck": true,
10
+ "outDir": "./dist/esm",
11
+
12
+ /* Bundler mode */
13
+ "moduleResolution": "bundler",
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "moduleDetection": "force",
17
+ "noEmit": false,
18
+ "jsx": "react-jsx",
19
+
20
+ /* Linting */
21
+ "strict": true,
22
+ "noUnusedLocals": true,
23
+ "noUnusedParameters": true,
24
+ "noFallthroughCasesInSwitch": true
25
+ },
26
+ "include": ["src"]
27
+ }
package/tsconfig.json CHANGED
@@ -1,31 +1,11 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es5",
4
- "lib": [
5
- "dom",
6
- "dom.iterable",
7
- "esnext"
8
- ],
9
- "allowJs": true,
10
- "skipLibCheck": true,
11
- "esModuleInterop": true,
12
- "allowSyntheticDefaultImports": true,
13
- "strict": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "noFallthroughCasesInSwitch": true,
16
- "module": "commonjs",
17
- "moduleResolution": "node",
18
- "resolveJsonModule": true,
19
- "isolatedModules": true,
20
- "noEmit": false,
21
- "jsx": "react-jsx",
22
- "noUncheckedIndexedAccess": true,
23
- "outDir": "./dist/cjs"
24
- },
25
- "include": [
26
- "src"
27
- ],
28
- "exclude": [
29
- "node_modules"
30
- ]
31
- }
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ {
5
+ "path": "./tsconfig.app.json"
6
+ },
7
+ {
8
+ "path": "./tsconfig.node.json"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
5
+ "skipLibCheck": true,
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler",
8
+ "allowSyntheticDefaultImports": true,
9
+ "strict": true,
10
+ "noEmit": true
11
+ },
12
+ "include": ["vite.config.ts"]
13
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react-swc'
3
+
4
+ // https://vitejs.dev/config/
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ })
package/dist/App.d.ts DELETED
@@ -1,76 +0,0 @@
1
- import * as React from "react";
2
-
3
- declare module "admin_lsac" {
4
- export interface TableField {
5
- name: string;
6
- access: (obj: any) => string | number | React.ReactElement;
7
- }
8
-
9
- export interface SimpleField {
10
- name: string;
11
- label: string;
12
- type: "string" | "number" | "file";
13
- validationSchema: any;
14
- }
15
-
16
- export interface Option {
17
- value: string | number | boolean;
18
- display: string;
19
- }
20
-
21
- export interface DropdownField {
22
- name: string;
23
- label: string;
24
- type: "dropdown";
25
- options?: Option[] | undefined;
26
- getOptions: () => Promise<Option[]>;
27
- }
28
-
29
- export interface ObjectField {
30
- name: string;
31
- label: string;
32
- type: "object";
33
- fields: FormField[];
34
- }
35
-
36
- export interface ArrayField {
37
- name: string;
38
- label: string;
39
- type: "array";
40
- element: Exclude<FormField, ArrayField>;
41
- }
42
-
43
- export type FormField = SimpleField | DropdownField | ObjectField | ArrayField;
44
-
45
- export interface Action {
46
- name: string;
47
- fields?: FormField[];
48
- onSubmit: (obj1: any, obj2?: any) => Promise<any>;
49
- }
50
-
51
- export interface RowAction {
52
- name: string;
53
- fields?: FormField[];
54
- initialise?: (obj: any) => any;
55
- onSubmit: (obj1: any, obj2?: any) => Promise<any>;
56
- }
57
-
58
- export interface PageSchema {
59
- name: string;
60
- actions: Action[];
61
- rowActions: RowAction[];
62
- getRequest: () => Promise<any[]>;
63
- tableFields: TableField[];
64
- }
65
-
66
- export interface PageProps {
67
- pages: PageSchema[];
68
- selectedPage: PageSchema;
69
- basePath: string;
70
- apiURL?: string;
71
- }
72
-
73
- export function AdminPage(props: PageProps): React.ReactElement;
74
-
75
- export function pageToUrl(page: PageSchema): string;
76
- }
package/dist/App.js DELETED
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var jsx_runtime_1 = require("react/jsx-runtime");
4
- var react_1 = require("@chakra-ui/react");
5
- var react_router_dom_1 = require("react-router-dom");
6
- var Page_1 = require("./components/Page");
7
- var Page_2 = require("./components/Page");
8
- function App(_a) {
9
- var pages = _a.pages, basePath = _a.basePath;
10
- return ((0, jsx_runtime_1.jsx)(react_1.ChakraProvider, { children: (0, jsx_runtime_1.jsx)(react_router_dom_1.BrowserRouter, { children: (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [pages.map(function (page) { return ((0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "".concat(basePath, "/").concat((0, Page_2.pageToUrl)(page)), element: (0, jsx_runtime_1.jsx)(Page_1.AdminPage, { pages: pages, selectedPage: page, basePath: basePath, apiURL: "http://localhost:3001" }) })); }), pages[0] ? ((0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "".concat(basePath, "/*"), element: (0, jsx_runtime_1.jsx)(Page_1.AdminPage, { pages: pages, selectedPage: pages[0], basePath: basePath, apiURL: "http://localhost:3001" }) })) : null] }) }) }));
11
- }
12
- exports.default = App;