admin_lsac 1.0.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 (42) hide show
  1. package/README.md +46 -0
  2. package/build/asset-manifest.json +15 -0
  3. package/build/favicon.ico +0 -0
  4. package/build/index.html +1 -0
  5. package/build/logo192.png +0 -0
  6. package/build/logo512.png +0 -0
  7. package/build/manifest.json +25 -0
  8. package/build/robots.txt +3 -0
  9. package/build/static/css/main.6471d273.css +2 -0
  10. package/build/static/css/main.6471d273.css.map +1 -0
  11. package/build/static/js/592.91aa6b4b.chunk.js +2 -0
  12. package/build/static/js/592.91aa6b4b.chunk.js.map +1 -0
  13. package/build/static/js/main.366f5b12.js +3 -0
  14. package/build/static/js/main.366f5b12.js.LICENSE.txt +139 -0
  15. package/build/static/js/main.366f5b12.js.map +1 -0
  16. package/package.json +71 -0
  17. package/public/favicon.ico +0 -0
  18. package/public/index.html +43 -0
  19. package/public/logo192.png +0 -0
  20. package/public/logo512.png +0 -0
  21. package/public/manifest.json +25 -0
  22. package/public/robots.txt +3 -0
  23. package/server/.env.example +3 -0
  24. package/server/deploy.js +29 -0
  25. package/server/package-lock.json +712 -0
  26. package/server/package.json +18 -0
  27. package/src/App.css +38 -0
  28. package/src/App.tsx +92 -0
  29. package/src/components/GenericForm.tsx +281 -0
  30. package/src/components/Page.tsx +207 -0
  31. package/src/index.css +13 -0
  32. package/src/index.tsx +20 -0
  33. package/src/logo.svg +1 -0
  34. package/src/pages/event.ts +69 -0
  35. package/src/react-app-env.d.ts +1 -0
  36. package/src/reportWebVitals.ts +15 -0
  37. package/src/schema/schema.config.ts +6 -0
  38. package/src/schema/schema.ts +68 -0
  39. package/src/setupTests.ts +5 -0
  40. package/tsconfig.esm.json +7 -0
  41. package/tsconfig.json +31 -0
  42. package/webpack.config.js +22 -0
@@ -0,0 +1,69 @@
1
+ import axios from "axios";
2
+ import React from "react";
3
+ import { PageSchema } from "../schema/schema";
4
+
5
+ const domain = "http://localhost:3001";
6
+
7
+ export const event: PageSchema = {
8
+ name: "Events",
9
+ actions: [],
10
+ rowActions: [],
11
+ getRequest: async () => {
12
+ // const res = await axios.get(domain + "/events");
13
+ // return res.data;
14
+ return [];
15
+ },
16
+ tableFields: [
17
+ {
18
+ name: "Id",
19
+ access: (obj: any) => obj.id,
20
+ },
21
+ {
22
+ name: "Event Name",
23
+ access: (obj: any) => obj.name,
24
+ },
25
+ {
26
+ name: "Description",
27
+ access: (obj: any) => obj.description,
28
+ },
29
+ {
30
+ name: "Category",
31
+ access: (obj: any) => obj.category,
32
+ },
33
+ {
34
+ name: "Ticket Type",
35
+ access: (obj: any) => obj.ticketType,
36
+ },
37
+ {
38
+ name: "Date",
39
+ access: (obj: any) => obj.date,
40
+ },
41
+ {
42
+ name: "Release",
43
+ access: (obj: any) => obj.release,
44
+ },
45
+ {
46
+ name: "Is Released",
47
+ access: (obj: any) => (obj.isReleased ? "Is Released" : "Not Released"),
48
+ },
49
+ {
50
+ name: "Available Tickets",
51
+ access: (obj: any) => obj.availableTickets,
52
+ },
53
+ {
54
+ name: "Max Tickets",
55
+ access: (obj: any) => obj.maxTickets,
56
+ },
57
+ {
58
+ name: "Image",
59
+ access: (obj: any) =>
60
+ obj.imgUrl
61
+ ? React.createElement("img", {
62
+ src: obj.imgUrl,
63
+ alt: "ERROR",
64
+ style: { width: "100px" },
65
+ })
66
+ : "No Image Available",
67
+ },
68
+ ],
69
+ };
@@ -0,0 +1 @@
1
+ /// <reference types="react-scripts" />
@@ -0,0 +1,15 @@
1
+ import { ReportHandler } from "web-vitals";
2
+
3
+ const reportWebVitals = (onPerfEntry?: ReportHandler) => {
4
+ if (onPerfEntry && onPerfEntry instanceof Function) {
5
+ import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
6
+ getCLS(onPerfEntry);
7
+ getFID(onPerfEntry);
8
+ getFCP(onPerfEntry);
9
+ getLCP(onPerfEntry);
10
+ getTTFB(onPerfEntry);
11
+ });
12
+ }
13
+ };
14
+
15
+ export default reportWebVitals;
@@ -0,0 +1,6 @@
1
+ import { PageSchema } from "./schema";
2
+ import { event } from "../pages/event";
3
+
4
+ export const pages: PageSchema[] = [
5
+ event, // example schema
6
+ ];
@@ -0,0 +1,68 @@
1
+ import * as React from "react";
2
+
3
+ export interface TableField {
4
+ name: string;
5
+ access: (obj: any) => string | number | React.ReactElement;
6
+ }
7
+
8
+ export interface SimpleField {
9
+ name: string;
10
+ label: string;
11
+ type: "string" | "number" | "file";
12
+ validationSchema: any;
13
+ }
14
+
15
+ export interface Option {
16
+ value: string | number | boolean;
17
+ display: string;
18
+ }
19
+
20
+ export interface DropdownField {
21
+ name: string;
22
+ label: string;
23
+ type: "dropdown";
24
+ options?: Option[] | undefined;
25
+ getOptions: () => Promise<Option[]>;
26
+ }
27
+
28
+ export interface ObjectField {
29
+ name: string;
30
+ label: string;
31
+ type: "object";
32
+ fields: FormField[];
33
+ }
34
+
35
+ export interface ArrayField {
36
+ name: string;
37
+ label: string;
38
+ type: "array";
39
+ element: Exclude<FormField, ArrayField>;
40
+ }
41
+
42
+ export type FormField = SimpleField | DropdownField | ObjectField | ArrayField;
43
+
44
+ export interface Action {
45
+ name: string;
46
+ fields?: FormField[];
47
+ onSubmit: (obj1: any, obj2?: any) => Promise<any>;
48
+ }
49
+
50
+ export interface RowAction {
51
+ name: string;
52
+ fields?: FormField[];
53
+ initialise?: (obj: any) => any;
54
+ onSubmit: (obj1: any, obj2?: any) => Promise<any>;
55
+ }
56
+
57
+ export interface PageSchema {
58
+ name: string;
59
+ actions: Action[];
60
+ rowActions: RowAction[];
61
+
62
+ getRequest: () => Promise<any[]>;
63
+ tableFields: TableField[];
64
+ }
65
+
66
+ export function pageToUrl(page: PageSchema): string {
67
+ return `/${page.name.toLowerCase().replace(" ", "_")}`;
68
+ }
@@ -0,0 +1,5 @@
1
+ // jest-dom adds custom jest matchers for asserting on DOM nodes.
2
+ // allows you to do things like:
3
+ // expect(element).toHaveTextContent(/react/i)
4
+ // learn more: https://github.com/testing-library/jest-dom
5
+ import "@testing-library/jest-dom";
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "esnext",
5
+ "outDir": "./dist/esm"
6
+ }
7
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,31 @@
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": true,
21
+ "jsx": "react-jsx",
22
+ "noUncheckedIndexedAccess": true,
23
+ "outDir": "./dist/cjs"
24
+ },
25
+ "include": [
26
+ "src"
27
+ ],
28
+ "exclude": [
29
+ "node_modules"
30
+ ]
31
+ }
@@ -0,0 +1,22 @@
1
+ const path = require('path');
2
+
3
+ module.exports = {
4
+ mode: 'production',
5
+ entry: './src/App.tsx',
6
+ output: {
7
+ filename: 'bundle.js',
8
+ path: path.resolve(__dirname, 'dist'),
9
+ },
10
+ resolve: {
11
+ extensions: ['.tsx', '.ts', '.js'],
12
+ },
13
+ module: {
14
+ rules: [
15
+ {
16
+ test: /\.(ts|tsx)$/,
17
+ exclude: /node_modules/,
18
+ use: 'ts-loader',
19
+ },
20
+ ],
21
+ },
22
+ };