admin_lsac 1.4.6 → 1.4.8
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.
- package/.eslintrc.cjs +1 -1
- package/.prettierignore +1 -0
- package/.prettierrc.cjs +16 -0
- package/dist/esm/src/App.d.ts +2 -2
- package/dist/esm/src/App.js +5 -5
- package/dist/esm/src/testSchemas/event.d.ts +1 -1
- package/dist/esm/src/testSchemas/event.js +46 -43
- package/package.json +17 -2
- package/dist/esm/src/admin_lsac.d.ts +0 -63
package/.eslintrc.cjs
CHANGED
|
@@ -6,7 +6,7 @@ module.exports = {
|
|
|
6
6
|
'plugin:@typescript-eslint/recommended',
|
|
7
7
|
'plugin:react-hooks/recommended',
|
|
8
8
|
],
|
|
9
|
-
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
|
9
|
+
ignorePatterns: ['dist', '.eslintrc.cjs', 'src/testSchemas'],
|
|
10
10
|
parser: '@typescript-eslint/parser',
|
|
11
11
|
plugins: ['react-refresh'],
|
|
12
12
|
rules: {
|
package/.prettierignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
**/node_modules
|
package/.prettierrc.cjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
printWidth: 100,
|
|
3
|
+
tabWidth: 2,
|
|
4
|
+
singleQuote: true,
|
|
5
|
+
semi: true,
|
|
6
|
+
trailingComma: 'all',
|
|
7
|
+
arrowParens: 'always',
|
|
8
|
+
overrides: [
|
|
9
|
+
{
|
|
10
|
+
files: '*.{js,jsx,tsx,ts,scss,json,html}',
|
|
11
|
+
options: {
|
|
12
|
+
tabWidth: 2,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
};
|
package/dist/esm/src/App.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PageSchema } from
|
|
1
|
+
import { PageSchema } from './schema';
|
|
2
2
|
import './App.css';
|
|
3
|
-
declare function App({ pages, basePath
|
|
3
|
+
declare function App({ pages, basePath }: {
|
|
4
4
|
pages: PageSchema[];
|
|
5
5
|
basePath: string;
|
|
6
6
|
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/esm/src/App.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ChakraProvider } from
|
|
3
|
-
import { BrowserRouter, Route, Routes } from
|
|
4
|
-
import { AdminPage } from
|
|
5
|
-
import { pageToUrl } from
|
|
2
|
+
import { ChakraProvider } from '@chakra-ui/react';
|
|
3
|
+
import { BrowserRouter, Route, Routes } from 'react-router-dom';
|
|
4
|
+
import { AdminPage } from './components/AdminPage';
|
|
5
|
+
import { pageToUrl } from './components/AdminPage';
|
|
6
6
|
import './App.css';
|
|
7
|
-
function App({ pages, basePath
|
|
7
|
+
function App({ pages, basePath }) {
|
|
8
8
|
return (_jsx(ChakraProvider, { children: _jsx(BrowserRouter, { children: _jsxs(Routes, { children: [pages.map((page) => (_jsx(Route, { path: `${basePath}/${pageToUrl(page)}`, element: _jsx(AdminPage, { pages: pages, selectedPage: page, basePath: basePath, apiURL: "http://localhost:3001/" }) }))), pages[0] ? (_jsx(Route, { path: `${basePath}/*`, element: _jsx(AdminPage, { pages: pages, selectedPage: pages[0], basePath: basePath, apiURL: "http://localhost:3001/" }) })) : null] }) }) }));
|
|
9
9
|
}
|
|
10
10
|
export default App;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PageSchema } from
|
|
1
|
+
import { PageSchema } from '../schema';
|
|
2
2
|
export declare const event: PageSchema;
|
|
@@ -1,86 +1,89 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import React from
|
|
3
|
-
const domain = "http://localhost:3001";
|
|
1
|
+
// import axios from "axios";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
// const domain = "http://localhost:3001";
|
|
4
4
|
export const event = {
|
|
5
|
-
name:
|
|
5
|
+
name: 'Events',
|
|
6
6
|
actions: [],
|
|
7
7
|
rowActions: [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
// {
|
|
9
|
+
// name: "Delete Event",
|
|
10
|
+
// fields: [
|
|
11
|
+
// {
|
|
12
|
+
// name: "input",
|
|
13
|
+
// label: "Mock Field",
|
|
14
|
+
// type: "string",
|
|
15
|
+
// validationSchema: "",
|
|
16
|
+
// },
|
|
17
|
+
// ],
|
|
18
|
+
// initialise: async (eventId: number) => {
|
|
19
|
+
// const res = await axios.get(domain + "/events/" + eventId);
|
|
20
|
+
// let obj: any = {};
|
|
21
|
+
// obj.input = res.data.name;
|
|
22
|
+
// return obj;
|
|
23
|
+
// },
|
|
24
|
+
// onSubmit: async (_: any, eventId: number) => {
|
|
25
|
+
// const res = await axios.delete(
|
|
26
|
+
// domain + "/events/" + eventId
|
|
27
|
+
// );
|
|
28
|
+
// return res.data;
|
|
29
|
+
// },
|
|
30
|
+
// }
|
|
29
31
|
],
|
|
30
32
|
getRequest: async () => {
|
|
31
|
-
const res = await axios.get(domain + "/events");
|
|
32
|
-
return res.data;
|
|
33
|
+
// const res = await axios.get(domain + "/events");
|
|
34
|
+
// return res.data;
|
|
35
|
+
return [];
|
|
33
36
|
},
|
|
34
37
|
tableFields: [
|
|
35
38
|
{
|
|
36
|
-
name:
|
|
39
|
+
name: 'Id',
|
|
37
40
|
access: (obj) => obj.id,
|
|
38
41
|
},
|
|
39
42
|
{
|
|
40
|
-
name:
|
|
43
|
+
name: 'Event Name',
|
|
41
44
|
access: (obj) => obj.name,
|
|
42
45
|
},
|
|
43
46
|
{
|
|
44
|
-
name:
|
|
47
|
+
name: 'Description',
|
|
45
48
|
access: (obj) => obj.description,
|
|
46
49
|
},
|
|
47
50
|
{
|
|
48
|
-
name:
|
|
51
|
+
name: 'Category',
|
|
49
52
|
access: (obj) => obj.category,
|
|
50
53
|
},
|
|
51
54
|
{
|
|
52
|
-
name:
|
|
55
|
+
name: 'Ticket Type',
|
|
53
56
|
access: (obj) => obj.ticketType,
|
|
54
57
|
},
|
|
55
58
|
{
|
|
56
|
-
name:
|
|
59
|
+
name: 'Date',
|
|
57
60
|
access: (obj) => obj.date,
|
|
58
61
|
},
|
|
59
62
|
{
|
|
60
|
-
name:
|
|
63
|
+
name: 'Release',
|
|
61
64
|
access: (obj) => obj.release,
|
|
62
65
|
},
|
|
63
66
|
{
|
|
64
|
-
name:
|
|
65
|
-
access: (obj) => (obj.isReleased ?
|
|
67
|
+
name: 'Is Released',
|
|
68
|
+
access: (obj) => (obj.isReleased ? 'Is Released' : 'Not Released'),
|
|
66
69
|
},
|
|
67
70
|
{
|
|
68
|
-
name:
|
|
71
|
+
name: 'Available Tickets',
|
|
69
72
|
access: (obj) => obj.availableTickets,
|
|
70
73
|
},
|
|
71
74
|
{
|
|
72
|
-
name:
|
|
75
|
+
name: 'Max Tickets',
|
|
73
76
|
access: (obj) => obj.maxTickets,
|
|
74
77
|
},
|
|
75
78
|
{
|
|
76
|
-
name:
|
|
79
|
+
name: 'Image',
|
|
77
80
|
access: (obj) => obj.imgUrl
|
|
78
|
-
? React.createElement(
|
|
81
|
+
? React.createElement('img', {
|
|
79
82
|
src: obj.imgUrl,
|
|
80
|
-
alt:
|
|
81
|
-
style: { width:
|
|
83
|
+
alt: 'ERROR',
|
|
84
|
+
style: { width: '100px' },
|
|
82
85
|
})
|
|
83
|
-
:
|
|
86
|
+
: 'No Image Available',
|
|
84
87
|
},
|
|
85
88
|
],
|
|
86
89
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "admin_lsac",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.8",
|
|
5
5
|
"description": "Generic Admin Panel created for storing events' data",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
8
|
"build": "tsc -b && vite build",
|
|
9
9
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
10
|
-
"preview": "vite preview"
|
|
10
|
+
"preview": "vite preview",
|
|
11
|
+
"prepare": "cd .. && husky install admin/.husky",
|
|
12
|
+
"lint-staged": "lint-staged"
|
|
13
|
+
},
|
|
14
|
+
"lint-staged": {
|
|
15
|
+
"*.{js,ts,tsx, jsx}": [
|
|
16
|
+
"eslint --quiet --fix"
|
|
17
|
+
],
|
|
18
|
+
"*.{json,md,html,js,jsx,ts,tsx}": [
|
|
19
|
+
"prettier --write"
|
|
20
|
+
]
|
|
11
21
|
},
|
|
12
22
|
"dependencies": {
|
|
13
23
|
"@chakra-ui/react": "^2.8.2",
|
|
@@ -30,8 +40,13 @@
|
|
|
30
40
|
"@typescript-eslint/parser": "^7.13.1",
|
|
31
41
|
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
32
42
|
"eslint": "^8.57.0",
|
|
43
|
+
"eslint-config-prettier": "^9.1.0",
|
|
44
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
33
45
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
34
46
|
"eslint-plugin-react-refresh": "^0.4.7",
|
|
47
|
+
"husky": "^9.0.11",
|
|
48
|
+
"lint-staged": "^15.2.7",
|
|
49
|
+
"prettier": "3.3.2",
|
|
35
50
|
"typescript": "^5.2.2",
|
|
36
51
|
"vite": "^5.3.1"
|
|
37
52
|
},
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
declare module 'admin_lsac' {
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
export interface TableField {
|
|
4
|
-
name: string;
|
|
5
|
-
access: (obj: any) => string | number | React.ReactElement;
|
|
6
|
-
}
|
|
7
|
-
export interface SimpleField {
|
|
8
|
-
name: string;
|
|
9
|
-
label: string;
|
|
10
|
-
type: "string" | "number" | "file";
|
|
11
|
-
validationSchema: any;
|
|
12
|
-
}
|
|
13
|
-
export interface Option {
|
|
14
|
-
value: string | number | boolean;
|
|
15
|
-
display: string;
|
|
16
|
-
}
|
|
17
|
-
export interface DropdownField {
|
|
18
|
-
name: string;
|
|
19
|
-
label: string;
|
|
20
|
-
type: "dropdown";
|
|
21
|
-
options?: Option[] | undefined;
|
|
22
|
-
getOptions: () => Promise<Option[]>;
|
|
23
|
-
}
|
|
24
|
-
export interface ObjectField {
|
|
25
|
-
name: string;
|
|
26
|
-
label: string;
|
|
27
|
-
type: "object";
|
|
28
|
-
fields: FormField[];
|
|
29
|
-
}
|
|
30
|
-
export interface ArrayField {
|
|
31
|
-
name: string;
|
|
32
|
-
label: string;
|
|
33
|
-
type: "array";
|
|
34
|
-
element: Exclude<FormField, ArrayField>;
|
|
35
|
-
}
|
|
36
|
-
export type FormField = SimpleField | DropdownField | ObjectField | ArrayField;
|
|
37
|
-
export interface Action {
|
|
38
|
-
name: string;
|
|
39
|
-
fields?: FormField[];
|
|
40
|
-
onSubmit: (obj1: any, obj2?: any) => Promise<any>;
|
|
41
|
-
}
|
|
42
|
-
export interface RowAction {
|
|
43
|
-
name: string;
|
|
44
|
-
fields?: FormField[];
|
|
45
|
-
initialise?: (obj: any) => any;
|
|
46
|
-
onSubmit: (obj1: any, obj2?: any) => Promise<any>;
|
|
47
|
-
}
|
|
48
|
-
export interface PageSchema {
|
|
49
|
-
name: string;
|
|
50
|
-
actions: Action[];
|
|
51
|
-
rowActions: RowAction[];
|
|
52
|
-
getRequest: () => Promise<any[]>;
|
|
53
|
-
tableFields: TableField[];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function pageToUrl(page: PageSchema): string;
|
|
57
|
-
export function AdminPage({ pages, selectedPage, basePath, apiURL }: {
|
|
58
|
-
pages: PageSchema[];
|
|
59
|
-
selectedPage: PageSchema;
|
|
60
|
-
basePath: string;
|
|
61
|
-
apiURL?: string;
|
|
62
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
63
|
-
}
|