@genesislcap/blank-app-seed 3.22.0 → 3.23.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 (54) hide show
  1. package/.genx/package.json +1 -1
  2. package/.genx/static.js +3 -2
  3. package/.genx/templates/react/chart.hbs +9 -0
  4. package/.genx/templates/react/entityManager.hbs +45 -0
  5. package/.genx/templates/react/form.hbs +8 -0
  6. package/.genx/templates/react/grid.hbs +18 -0
  7. package/.genx/templates/react/gridLayout.hbs +30 -0
  8. package/.genx/templates/react/horizontalLayout.hbs +7 -0
  9. package/.genx/templates/react/route.hbs +35 -0
  10. package/.genx/templates/react/route.styles.hbs +3 -0
  11. package/.genx/templates/react/tabsLayout.hbs +7 -0
  12. package/.genx/utils/generateRoute.js +21 -9
  13. package/CHANGELOG.md +7 -0
  14. package/client-tmp/react/.eslintrc.cjs +18 -0
  15. package/client-tmp/react/README.md +48 -0
  16. package/client-tmp/react/git +0 -0
  17. package/client-tmp/react/index.html +13 -0
  18. package/client-tmp/react/package.json +54 -0
  19. package/client-tmp/react/src/App.tsx +66 -0
  20. package/client-tmp/react/src/assets/logo-icon--light.svg +3 -0
  21. package/client-tmp/react/src/config.ts +31 -0
  22. package/client-tmp/react/src/custom-elements.d.ts +11 -0
  23. package/client-tmp/react/src/guards/AuthGuard.tsx +32 -0
  24. package/client-tmp/react/src/index.js +17 -0
  25. package/client-tmp/react/src/layouts/LayoutWrapper.tsx +20 -0
  26. package/client-tmp/react/src/layouts/blank/BlankLayout.module.css +9 -0
  27. package/client-tmp/react/src/layouts/blank/BlankLayout.tsx +26 -0
  28. package/client-tmp/react/src/layouts/default/DefaultLayout.module.css +35 -0
  29. package/client-tmp/react/src/layouts/default/DefaultLayout.tsx +80 -0
  30. package/client-tmp/react/src/main.tsx +10 -0
  31. package/client-tmp/react/src/pages/auth/AuthPage.css +0 -0
  32. package/client-tmp/react/src/pages/auth/AuthPage.jsx +11 -0
  33. package/client-tmp/react/src/reportWebVitals.js +13 -0
  34. package/client-tmp/react/src/services/auth.service.ts +13 -0
  35. package/client-tmp/react/src/services/connect.service.ts +26 -0
  36. package/client-tmp/react/src/setupTests.js +5 -0
  37. package/client-tmp/react/src/share/foundation-login.ts +21 -0
  38. package/client-tmp/react/src/share/genesis-components.ts +32 -0
  39. package/client-tmp/react/src/store/AuthContext.tsx +56 -0
  40. package/client-tmp/react/src/styles/design-tokens.json +56 -0
  41. package/client-tmp/react/src/styles/styles.css +39 -0
  42. package/client-tmp/react/src/svg-elements.d.ts +4 -0
  43. package/client-tmp/react/src/types/RouteLayouts.ts +3 -0
  44. package/client-tmp/react/src/types/layers.ts +9 -0
  45. package/client-tmp/react/src/types/menu.ts +8 -0
  46. package/client-tmp/react/src/utils/history.ts +5 -0
  47. package/client-tmp/react/src/utils/navigation.ts +5 -0
  48. package/client-tmp/react/src/vite-env.d.ts +1 -0
  49. package/client-tmp/react/tsconfig.app.json +28 -0
  50. package/client-tmp/react/tsconfig.json +11 -0
  51. package/client-tmp/react/tsconfig.node.json +13 -0
  52. package/client-tmp/react/vite.config.ts +14 -0
  53. package/package.json +1 -1
  54. package/client-tmp/react/react-file.ts +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed-config",
3
3
  "description": "Genesis Blank App Seed Configuration",
4
- "version": "3.22.0",
4
+ "version": "3.23.0",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "lint": "eslint .",
package/.genx/static.js CHANGED
@@ -52,14 +52,15 @@ const DIR_TEMPLATE_BY_FRAMEWORK = {
52
52
  DIR_TEMPLATE_WEB_COMPONENT_ALIAS,
53
53
  ),
54
54
  [FRAMEWORK_ANGULAR_ALIAS]: DIRS_MAP.get(DIR_TEMPLATE_ANGULAR_ALIAS),
55
+ [FRAMEWORK_REACT_ALIAS]: DIRS_MAP.get(FRAMEWORK_REACT_ALIAS),
55
56
  };
56
57
 
57
58
  const COMPONENT_TYPE = {
58
59
  'entity-manager': 'manager',
59
60
  'grid-pro': 'grid',
60
61
  'smart-form': 'form',
61
- 'chart': 'chart'
62
- }
62
+ chart: 'chart',
63
+ };
63
64
 
64
65
  const TEXTS = {
65
66
  INTRO_API_HOST:
@@ -0,0 +1,9 @@
1
+ <rapid-g2plot-chart
2
+ type="{{ config.type }}"
3
+ config={tile{{ config.index }}.chartConfig}
4
+ >
5
+ <chart-datasource
6
+ resourceName="{{ config.resourceName }}"
7
+ server-fields="{{ config.xField }} {{ config.yField }}"
8
+ ></chart-datasource>
9
+ </rapid-g2plot-chart>
@@ -0,0 +1,45 @@
1
+ <entity-management
2
+ design-system-prefix="rapid"
3
+ enable-row-flashing
4
+ enable-cell-flashing
5
+ {{#if config.title}}
6
+ title="{{ config.title }}"
7
+ {{/if}}
8
+ resourceName="{{ config.resourceName }}"
9
+ {{#if config.createEvent}}
10
+ createEvent="{{ config.createEvent }}"
11
+ {{#if config.createFormUiSchema}}
12
+ createFormUiSchema={tile{{ config.index }}.createFormUiSchema}
13
+ {{/if}}
14
+ {{/if}}
15
+ {{#if config.updateEvent}}
16
+ updateEvent="{{ config.updateEvent }}"
17
+ {{#if config.updateFormUiSchema}}
18
+ updateFormUiSchema={tile{{ config.index }}.updateFormUiSchema}
19
+ {{/if}}
20
+ {{/if}}
21
+ {{#if config.deleteEvent}}
22
+ deleteEvent="{{ config.deleteEvent }}"
23
+ {{/if}}
24
+ {{#if config.gridOptions}}
25
+ gridOptions={{{ config.gridOptions }}}
26
+ {{/if}}
27
+ {{#if config.snapshot}}
28
+ datasourceConfig={ isSnapshot: {{ config.snapshot }} }
29
+ {{/if}}
30
+ {{#if config.reqrep}}
31
+ datasourceConfig={tile{{ config.index }}.reqrep}
32
+ {{/if}}
33
+ {{#if config.columns}}
34
+ columns={tile{{ config.index }}.columns}
35
+ {{/if}}
36
+ {{#if config.modalPosition}}
37
+ modal-position="{{ config.modalPosition }}"
38
+ {{/if}}
39
+ {{#if config.sizeColumnsToFit}}
40
+ size-columns-to-fit
41
+ {{/if}}
42
+ {{#if config.enableSearchBar}}
43
+ enable-search-bar
44
+ {{/if}}
45
+ ></entity-management>
@@ -0,0 +1,8 @@
1
+ <foundation-form
2
+ design-system-prefix="rapid"
3
+ resourceName="{{config.resourceName}}"
4
+ {{#if config.uischema}}
5
+ uischema={tile{{ config.index }}.uischema}
6
+ {{/if}}
7
+ >
8
+ </foundation-form>
@@ -0,0 +1,18 @@
1
+ <rapid-grid-pro
2
+ enable-row-flashing
3
+ enable-cell-flashing
4
+ >
5
+ <grid-pro-genesis-datasource
6
+ resource-name="{{config.resourceName}}"
7
+ {{#if config.snapshot}}
8
+ isSnapshot="{{config.snapshot}}"
9
+ {{/if}}
10
+ {{#if config.reqrep}}
11
+ [datasourceConfig]="tile{{ config.index }}.reqrep"
12
+ {{/if}}
13
+ {{#if config.gridOptions}}
14
+ [deferredGridOptions]="tile{{ config.index }}.gridOptions"
15
+ {{/if}}
16
+ >
17
+ </grid-pro-genesis-datasource>
18
+ </rapid-grid-pro>
@@ -0,0 +1,30 @@
1
+ <rapid-layout-region type="horizontal">
2
+ <rapid-layout-region type="vertical">
3
+ {{#each route.tiles}}
4
+ {{#ifEquals @index 0}}
5
+ <rapid-layout-item title="{{../title}}">
6
+ {{> (lookup ../this 'type') ../this}}
7
+ </rapid-layout-item>
8
+ {{/ifEquals}}
9
+ {{#ifEquals @index 1}}
10
+ <rapid-layout-item title="{{../title}}">
11
+ {{> (lookup ../this 'type') ../this}}
12
+ </rapid-layout-item>
13
+ {{/ifEquals}}
14
+ {{/each}}
15
+ </rapid-layout-region>
16
+ <rapid-layout-region type="vertical">
17
+ {{#each route.tiles}}
18
+ {{#ifEquals @index 2}}
19
+ <rapid-layout-item title="{{../title}}">
20
+ {{> (lookup ../this 'type') ../this}}
21
+ </rapid-layout-item>
22
+ {{/ifEquals}}
23
+ {{#ifEquals @index 3}}
24
+ <rapid-layout-item title="{{../title}}">
25
+ {{> (lookup ../this 'type') ../this}}
26
+ </rapid-layout-item>
27
+ {{/ifEquals}}
28
+ {{/each}}
29
+ </rapid-layout-region>
30
+ </rapid-layout-region>
@@ -0,0 +1,7 @@
1
+ <rapid-layout-region>
2
+ {{#each route.tiles}}
3
+ <rapid-layout-item title="{{this.title}}">
4
+ {{> (lookup . 'type') }}
5
+ </rapid-layout-item>
6
+ {{/each}}
7
+ </rapid-layout-region>
@@ -0,0 +1,35 @@
1
+ import './{{pascalCase route.name}}.css';
2
+
3
+ const {{pascalCase route.name}} = () => {
4
+ {{#each route.tiles}}
5
+ const tile{{this.config.index}} = { {{#if this.config.createFormUiSchema}}
6
+ "createFormUiSchema": {{{ this.config.createFormUiSchema }}},{{/if}}{{#if this.config.updateFormUiSchema}}
7
+ "updateFormUiSchema": {{{ this.config.updateFormUiSchema }}},{{/if}}{{#if this.config.uischema}}
8
+ "uischema": {{{ this.config.uischema }}},{{/if}}{{#if this.config.gridOptions}}
9
+ "gridOptions": {{{ this.config.gridOptions }}},{{/if}}{{#if this.config.reqrep}}
10
+ "reqrep": {{{ this.config.reqrep }}},{{/if}}{{#if this.config.columns}}
11
+ "columns": {{{ this.config.columns }}},{{/if}}{{#if this.config.type}}
12
+ "chartConfig": { {{#ifEquals this.config.type 'pie'}}
13
+ "radius": 0.75,
14
+ "angleField": "value",
15
+ "colorField": "groupBy",{{else}}
16
+ "xField": "groupBy",
17
+ "yField": "value",{{/ifEquals}}
18
+ },{{/if}}
19
+ };
20
+ {{/each}}
21
+
22
+ return (
23
+ <section className="{{kebabCase route.name}}-page">
24
+ {{#if route.tiles}}
25
+ <rapid-layout auto-save-key="{{route.layoutKey}}">
26
+ {{> (lookup ./route 'layoutType') }}
27
+ </rapid-layout>
28
+ {{else}}
29
+ Welcome to {{sentenceCase route.name}}
30
+ {{/if}}
31
+ </section>
32
+ );
33
+ };
34
+
35
+ export default {{pascalCase route.name}};
@@ -0,0 +1,3 @@
1
+ :host {
2
+ height: 100%;
3
+ }
@@ -0,0 +1,7 @@
1
+ <rapid-layout-region type="tabs">
2
+ {{#each route.tiles}}
3
+ <rapid-layout-item title="{{this.title}}">
4
+ {{> (lookup . 'type') }}
5
+ </rapid-layout-item>
6
+ {{/each}}
7
+ </rapid-layout-region>
@@ -4,6 +4,7 @@ const generateTile = require('./generateTile');
4
4
  const {
5
5
  FRAMEWORK_WEB_COMPONENTS_ALIAS,
6
6
  FRAMEWORK_ANGULAR_ALIAS,
7
+ FRAMEWORK_REACT_ALIAS,
7
8
  DIR_TEMPLATE_BY_FRAMEWORK,
8
9
  } = require('../static');
9
10
 
@@ -23,11 +24,17 @@ const getPathByFramework = {
23
24
  `${routeDir}/${routeName}.component.html`,
24
25
  style: (routePath, routeName) => `${routePath}/${routeName}.component.css`,
25
26
  },
27
+ [FRAMEWORK_REACT_ALIAS]: {
28
+ clientSrcPath: `../../client/src/pages`,
29
+ route: (clientSrcPath, routeName) => `${clientSrcPath}/${routeName}`,
30
+ component: (routeDir, routeName, changeCase) =>
31
+ `${routeDir}/${changeCase.pascalCase(routeName)}.jsx`,
32
+ style: (routePath, routeName, changeCase) =>
33
+ `${routePath}/${changeCase.pascalCase(routeName)}.css`,
34
+ },
26
35
  };
27
36
 
28
37
  const generateRoute = (route, { changeCase, writeFileWithData }, framework) => {
29
- const routeName = changeCase.paramCase(route.name);
30
- const sourceTemplateDir = `../${DIR_TEMPLATE_BY_FRAMEWORK[framework]}`;
31
38
  const {
32
39
  clientSrcPath,
33
40
  route: getRouteDir,
@@ -35,23 +42,28 @@ const generateRoute = (route, { changeCase, writeFileWithData }, framework) => {
35
42
  template: getTemplateTarget,
36
43
  style: getStyleTarget,
37
44
  } = getPathByFramework[framework];
45
+ const routeName = changeCase.paramCase(route.name);
46
+ const sourceTemplateDir = `../${DIR_TEMPLATE_BY_FRAMEWORK[framework]}`;
38
47
  const routeDir = getRouteDir(clientSrcPath, routeName);
39
48
 
40
49
  const filesToWrite = [
41
50
  {
42
51
  source: `${sourceTemplateDir}/route.hbs`,
43
- target: getComponentTarget(routeDir, routeName),
44
- },
45
- {
46
- source: `${sourceTemplateDir}/route.template.hbs`,
47
- target: getTemplateTarget(routeDir, routeName),
52
+ target: getComponentTarget(routeDir, routeName, changeCase),
48
53
  },
49
54
  {
50
55
  source: `${sourceTemplateDir}/route.styles.hbs`,
51
- target: getStyleTarget(routeDir, routeName),
56
+ target: getStyleTarget(routeDir, routeName, changeCase),
52
57
  },
53
58
  ];
54
59
 
60
+ if (getTemplateTarget) {
61
+ filesToWrite.push({
62
+ source: `${sourceTemplateDir}/route.template.hbs`,
63
+ target: getTemplateTarget(routeDir, routeName),
64
+ });
65
+ }
66
+
55
67
  makeDirectory(resolve(__dirname, routeDir));
56
68
  filesToWrite.forEach(({ source, target }) => {
57
69
  writeFileWithData(
@@ -61,7 +73,7 @@ const generateRoute = (route, { changeCase, writeFileWithData }, framework) => {
61
73
  );
62
74
  });
63
75
 
64
- // Remove condition after adding changes for angular
76
+ // Remove condition after adding changes for angular & react
65
77
  if (framework === FRAMEWORK_WEB_COMPONENTS_ALIAS && route?.tiles?.length) {
66
78
  route.tiles.forEach((tile) => {
67
79
  generateTile(tile, route, { changeCase, writeFileWithData }, framework);
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.23.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.22.0...v3.23.0) (2024-07-15)
4
+
5
+
6
+ ### Features
7
+
8
+ * react blank-app-seed (#278) 83b1767
9
+
3
10
  ## [3.22.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.21.0...v3.22.0) (2024-07-15)
4
11
 
5
12
 
@@ -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
+ }
@@ -0,0 +1,48 @@
1
+
2
+ # {{capitalCase appName}}
3
+
4
+ This project is built with React.
5
+
6
+ ## Development
7
+
8
+ 1. Install dependencies:
9
+
10
+ ```shell
11
+ npm run bootstrap
12
+ ```
13
+
14
+ 2. Start the development server:
15
+
16
+ ```shell
17
+ npm run start
18
+ ```
19
+
20
+ 3. Build for production:
21
+
22
+ ```shell
23
+ npm run build
24
+ ```
25
+
26
+ Preview the production build:
27
+
28
+ ```shell
29
+ npm run serve
30
+ ```
31
+
32
+ ## Clean
33
+
34
+ Remove `build` and `node_modules` directories:
35
+
36
+ ```shell
37
+ npm run clean
38
+ ```
39
+
40
+ Baseline task combines `clean` and `install` tasks into a single command:
41
+
42
+ ```shell
43
+ npm run baseline
44
+ ```
45
+
46
+ ## Further help
47
+
48
+ To get more help on React, check out the [React documentation](https://reactjs.org/docs/getting-started.html).
File without changes
@@ -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>{{pkgName}}</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "{{pkgName}}",
3
+ "version": "{{applicationVersionWeb}}",
4
+ "private": true,
5
+ "scripts": {
6
+ "baseline": "npm run clean && npm run bootstrap",
7
+ "bootstrap": "npm i --legacy-peer-deps",
8
+ "dev": "vite",
9
+ "build": "tsc -b && vite build",
10
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
11
+ "serve": "vite preview",
12
+ "clean": "rm -rf node_modules dist",
13
+
14
+ "lint:fix": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix"
15
+ },
16
+ "dependencies": {
17
+ "@ag-grid-community/client-side-row-model": "29.2.0",
18
+ "@ag-grid-community/core": "29.2.0",
19
+ "@ag-grid-community/csv-export": "29.2.0",
20
+ "@ag-grid-enterprise/core": "29.2.0",
21
+ "@ag-grid-enterprise/row-grouping": "29.2.0",
22
+ "@ag-grid-enterprise/server-side-row-model": "29.2.0",
23
+ "@genesislcap/foundation-comms": "{{versions.UI}}",
24
+ "@genesislcap/foundation-login": "{{versions.UI}}",
25
+ "@genesislcap/foundation-entity-management": "{{versions.UI}}",
26
+ "@genesislcap/foundation-header": "{{versions.UI}}",
27
+ "@genesislcap/foundation-ui": "{{versions.UI}}",
28
+ "@genesislcap/rapid-design-system": "{{versions.UI}}",
29
+ "@genesislcap/rapid-grid-pro": "{{versions.UI}}",
30
+ "@genesislcap/foundation-layout": "{{versions.UI}}",
31
+ "@genesislcap/g2plot-chart": "{{versions.UI}}",
32
+ "history": "^5.3.0",
33
+ "react": "^19.0.0-beta-94eed63c49-20240425",
34
+ "react-dom": "^19.0.0-beta-94eed63c49-20240425",
35
+ "react-router-dom": "6.24.1"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^20.14.10",
39
+ "@types/react": "npm:types-react@alpha",
40
+ "@types/react-dom": "npm:types-react-dom@alpha",
41
+ "@typescript-eslint/eslint-plugin": "^7.13.1",
42
+ "@typescript-eslint/parser": "^7.13.1",
43
+ "@vitejs/plugin-react": "^4.3.1",
44
+ "eslint": "^8.57.0",
45
+ "eslint-plugin-react-hooks": "^4.6.2",
46
+ "eslint-plugin-react-refresh": "^0.4.7",
47
+ "typescript": "^5.2.2",
48
+ "vite": "^5.3.1"
49
+ },
50
+ "overrides": {
51
+ "@types/react": "npm:types-react@alpha",
52
+ "@types/react-dom": "npm:types-react-dom@alpha"
53
+ }
54
+ }
@@ -0,0 +1,66 @@
1
+ import React from 'react';
2
+ import {
3
+ unstable_HistoryRouter as HistoryRouter,
4
+ Routes,
5
+ Route,
6
+ useLocation,
7
+ } from 'react-router-dom';
8
+ import history from './utils/history';
9
+ import LayoutWrapper from './layouts/LayoutWrapper';
10
+ import { routeLayouts } from './config';
11
+ import AuthGuard from './guards/AuthGuard';
12
+ import { AuthProvider } from './store/AuthContext';
13
+ // Pages Components
14
+ import AuthPage from './pages/auth/AuthPage';
15
+ {{#each routes}}
16
+ import {{pascalCase this.name}} from './pages/{{kebabCase this.name}}/{{pascalCase this.name}}';
17
+ {{/each}}
18
+ // Genesis Components
19
+ import './share/genesis-components';
20
+
21
+ const LayoutWithLocation = () => {
22
+ const location = useLocation();
23
+ const layout = routeLayouts[location.pathname] || 'default';
24
+
25
+ let pageComponent;
26
+
27
+ switch (location.pathname) {
28
+ case '/auth':
29
+ pageComponent = <AuthPage />;
30
+ break;
31
+ {{#each routes}}
32
+ case '/{{kebabCase this.name}}':
33
+ pageComponent = <{{pascalCase this.name}} />;
34
+ break;
35
+ {{/each}}
36
+ default:
37
+ pageComponent = <AuthPage />;
38
+ }
39
+
40
+ if (
41
+ location.pathname === '/auth' ||
42
+ location.pathname === '/'
43
+ ) {
44
+ return <LayoutWrapper layout={layout}>{pageComponent}</LayoutWrapper>;
45
+ } else {
46
+ return (
47
+ <AuthGuard>
48
+ <LayoutWrapper layout={layout}>{pageComponent}</LayoutWrapper>
49
+ </AuthGuard>
50
+ );
51
+ }
52
+ };
53
+
54
+ const App: React.FC = () => {
55
+ return (
56
+ <AuthProvider>
57
+ <HistoryRouter history={history}>
58
+ <Routes>
59
+ <Route path="*" element={<LayoutWithLocation />} />
60
+ </Routes>
61
+ </HistoryRouter>
62
+ </AuthProvider>
63
+ );
64
+ };
65
+
66
+ export default App;
@@ -0,0 +1,3 @@
1
+ <svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M18.7702 23.0437C18.7702 22.4675 18.8526 21.8089 19.0995 21.3149C19.3465 20.7386 19.6758 20.2447 20.0874 19.833C20.4991 19.4214 20.993 19.0921 21.5693 18.8451C22.1456 18.5982 22.7219 18.5158 23.2981 18.5158H25.9326V11.6828H19.1819V14.3172C19.1819 15.5521 18.6879 16.7047 17.8647 17.5279C17.0414 18.3512 15.8888 18.8451 14.7363 18.9275H6.7507V6.99025H16.4651V0.157227H3.54C2.63442 0.157227 1.72884 0.568855 1.07023 1.22746C0.411628 1.88606 0 2.79165 0 3.77955V22.2205C0 23.1261 0.411628 24.0316 1.07023 24.7726C1.72884 25.4312 2.63442 25.8428 3.54 25.8428H18.7702V23.0437Z" fill="white"/>
3
+ </svg>
@@ -0,0 +1,31 @@
1
+ import { RouteLayouts } from './types/RouteLayouts';
2
+
3
+ export const routeLayouts: RouteLayouts = {
4
+ '/auth-mock': 'blank',
5
+ '/auth': 'blank',
6
+ '/': 'blank',
7
+ };
8
+
9
+ import type { MainMenu } from './types/menu';
10
+
11
+ export const AUTH_PATH = 'auth';
12
+
13
+ export const API_DATA = {
14
+ URL: '',
15
+ AUTH: {
16
+ username: '', // provide login to a user in given environment
17
+ password: '', // provide password to a user in given environment
18
+ },
19
+ };
20
+
21
+ export const mainMenu: MainMenu = [
22
+ {{#each routes}}
23
+ {
24
+ index: {{@index}},
25
+ path: '{{kebabCase this.name}}',
26
+ title: '{{#if this.title}}{{this.title}}{{else}}{{this.name}}{{/if}}',
27
+ icon: '{{this.icon}}',
28
+ variant: 'solid'
29
+ }{{#unless @last}},{{/unless}}
30
+ {{/each}}
31
+ ];
@@ -0,0 +1,11 @@
1
+ declare namespace JSX {
2
+ interface IntrinsicElements {
3
+ // Wildcard for all webcomponents:
4
+ [elemName: string]: any;
5
+ }
6
+ }
7
+
8
+ declare module '*.module.css' {
9
+ const classes: { [key: string]: string };
10
+ export default classes;
11
+ }
@@ -0,0 +1,32 @@
1
+ import { useEffect, useState, ReactNode } from 'react';
2
+ import { useAuth } from '../store/AuthContext';
3
+ import { Navigate } from 'react-router-dom';
4
+ import { AUTH_PATH } from '../config';
5
+ interface AuthGuardProps {
6
+ children: ReactNode;
7
+ }
8
+ const AuthGuard: React.FC<AuthGuardProps> = ({ children }: AuthGuardProps) => {
9
+ const { user, checkAuthStatus } = useAuth();
10
+ const [isLoading, setIsLoading] = useState(true);
11
+
12
+ useEffect(() => {
13
+ const verifyAuth = async () => {
14
+ await checkAuthStatus();
15
+ setIsLoading(false);
16
+ };
17
+
18
+ verifyAuth();
19
+ }, []);
20
+
21
+ if (isLoading) {
22
+ return <div>Loading...</div>; // Or some loading component
23
+ }
24
+
25
+ if (!user) {
26
+ return <Navigate to={`/${AUTH_PATH}`} />;
27
+ }
28
+
29
+ return <>{children}</>;
30
+ };
31
+
32
+ export default AuthGuard;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import './styles/styles.css';
4
+ import App from './App';
5
+ import reportWebVitals from './reportWebVitals';
6
+
7
+ const root = ReactDOM.createRoot(document.getElementById('root'));
8
+ root.render(
9
+ <React.StrictMode>
10
+ <App />
11
+ </React.StrictMode>,
12
+ );
13
+
14
+ // If you want to start measuring performance in your app, pass a function
15
+ // to log results (for example: reportWebVitals(console.log))
16
+ // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17
+ reportWebVitals();
@@ -0,0 +1,20 @@
1
+ import React, { ReactNode } from 'react';
2
+ import BlankLayout from './blank/BlankLayout';
3
+ import DefaultLayout from './default/DefaultLayout';
4
+
5
+ interface LayoutWrapperProps {
6
+ layout: 'blank' | 'default';
7
+ children: ReactNode;
8
+ }
9
+
10
+ const layoutMap = {
11
+ blank: BlankLayout,
12
+ default: DefaultLayout,
13
+ };
14
+
15
+ const LayoutWrapper: React.FC<LayoutWrapperProps> = ({ layout, children }) => {
16
+ const Layout = layoutMap[layout] || DefaultLayout;
17
+ return <Layout>{children}</Layout>;
18
+ };
19
+
20
+ export default LayoutWrapper;
@@ -0,0 +1,9 @@
1
+ .blank-layout {
2
+ height: 100%;
3
+ }
4
+
5
+ .content {
6
+ position: absolute;
7
+ width: 100%;
8
+ height: 100%;
9
+ }
@@ -0,0 +1,26 @@
1
+ import React, { ReactNode, useEffect, useRef } from 'react';
2
+ import { configureDesignSystem } from '@genesislcap/foundation-ui';
3
+ import styles from './BlankLayout.module.css';
4
+ import * as designTokens from '../../styles/design-tokens.json';
5
+
6
+ interface BlankLayoutProps {
7
+ children: ReactNode;
8
+ }
9
+
10
+ const BlankLayout: React.FC<BlankLayoutProps> = ({ children }) =>{
11
+ const designSystemProviderRef = useRef<HTMLDivElement>(null);
12
+
13
+ useEffect(() => {
14
+ if (designSystemProviderRef.current) {
15
+ configureDesignSystem(designSystemProviderRef.current, designTokens);
16
+ }
17
+ }, []);
18
+
19
+ return (
20
+ <zero-design-system-provider className={styles['blank-layout']}>
21
+ <section className={styles.content}>{children}</section>
22
+ </zero-design-system-provider>
23
+ );
24
+ };
25
+
26
+ export default BlankLayout;
@@ -0,0 +1,35 @@
1
+ .default-layout {
2
+ height: 100%;
3
+ display: flex;
4
+ flex-direction: column;
5
+ background-color: var(--neutral-fill-stealth-active);
6
+ color: var(--neutral-foreground-rest);
7
+ overflow: hidden;
8
+ }
9
+
10
+ .default-layout foundation-header {
11
+ z-index: 999;
12
+ position: absolute;
13
+ top: 0px;
14
+ left: 0px;
15
+ width: 100%;
16
+ align-items: center;
17
+ border: none;
18
+ }
19
+
20
+ .routes-wrapper {
21
+ display: flex;
22
+ gap: calc(var(--design-unit) * 2px);
23
+ margin: calc(var(--design-unit) * 1px) 0;
24
+ }
25
+
26
+ .content {
27
+ width: 100%;
28
+ flex-grow: 1;
29
+ position: absolute;
30
+ top: 0;
31
+ bottom: 0;
32
+ left: 0;
33
+ right: 0;
34
+ padding-top: var(--nav-height);
35
+ }
@@ -0,0 +1,80 @@
1
+ import React, { ReactNode, useEffect, useRef } from 'react';
2
+ import { configureDesignSystem } from '@genesislcap/foundation-ui';
3
+ import { useNavigate } from 'react-router-dom';
4
+ import {
5
+ baseLayerLuminance,
6
+ StandardLuminance,
7
+ } from '@microsoft/fast-components';
8
+ import styles from './DefaultLayout.module.css';
9
+ import { mainMenu } from '../../config';
10
+ import * as designTokens from '../../styles/design-tokens.json';
11
+
12
+ interface DefaultLayoutProps {
13
+ children: ReactNode;
14
+ }
15
+
16
+ const DefaultLayout: React.FC<DefaultLayoutProps> = ({ children }) => {
17
+ const navigate = useNavigate();
18
+
19
+ const designSystemProviderRef = useRef<HTMLElement>(null);
20
+ const foundationHeaderRef = useRef<HTMLElement>(null);
21
+ const allRoutes = mainMenu;
22
+
23
+ const onLuminanceToggle = (): void => {
24
+ if (designSystemProviderRef.current) {
25
+ baseLayerLuminance.setValueFor(
26
+ designSystemProviderRef.current,
27
+ baseLayerLuminance.getValueFor(designSystemProviderRef.current) ===
28
+ StandardLuminance.DarkMode
29
+ ? StandardLuminance.LightMode
30
+ : StandardLuminance.DarkMode,
31
+ );
32
+ }
33
+ };
34
+
35
+ useEffect(() => {
36
+ if (designSystemProviderRef.current) {
37
+ configureDesignSystem(designSystemProviderRef.current, designTokens);
38
+ }
39
+
40
+ const handleLuminanceIconClicked = () => {
41
+ onLuminanceToggle();
42
+ };
43
+
44
+ const foundationHeader = foundationHeaderRef.current;
45
+ if (foundationHeader) {
46
+ foundationHeader.addEventListener('luminance-icon-clicked', handleLuminanceIconClicked);
47
+ }
48
+
49
+ return () => {
50
+ if (foundationHeader) {
51
+ foundationHeader.removeEventListener('luminance-icon-clicked', handleLuminanceIconClicked);
52
+ }
53
+ };
54
+ }, []);
55
+
56
+ const className = `${styles['default-layout']}`;
57
+
58
+ return (
59
+ <rapid-design-system-provider ref={designSystemProviderRef} class={className}>
60
+ <foundation-header
61
+ ref={foundationHeaderRef}
62
+ show-luminance-toggle-button
63
+ show-misc-toggle-button
64
+ navigateTo={(path) => navigate(path)}
65
+ >
66
+ <section className={styles['routes-wrapper']} slot="routes">
67
+ {allRoutes.map((route, index) => (
68
+ <rapid-button key={index} onClick={() => navigate(route.path)}>
69
+ <rapid-icon name={route.icon}></rapid-icon>
70
+ {route.title}
71
+ </rapid-button>
72
+ ))}
73
+ </section>
74
+ </foundation-header>
75
+ <section className={styles['content']}>{children}</section>
76
+ </rapid-design-system-provider>
77
+ );
78
+ };
79
+
80
+ export default DefaultLayout;
@@ -0,0 +1,10 @@
1
+ import React from 'react'
2
+ import ReactDOM from 'react-dom/client'
3
+ import App from './App.tsx'
4
+ import './styles/styles.css'
5
+
6
+ ReactDOM.createRoot(document.getElementById('root')!).render(
7
+ <React.StrictMode>
8
+ <App />
9
+ </React.StrictMode>,
10
+ )
File without changes
@@ -0,0 +1,11 @@
1
+ import './AuthPage.css';
2
+
3
+ const AuthPage = () => {
4
+ return (
5
+ <section className="auth-page">
6
+ <client-app-login></client-app-login>
7
+ </section>
8
+ );
9
+ };
10
+
11
+ export default AuthPage;
@@ -0,0 +1,13 @@
1
+ const reportWebVitals = (onPerfEntry) => {
2
+ if (onPerfEntry && onPerfEntry instanceof Function) {
3
+ import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4
+ getCLS(onPerfEntry);
5
+ getFID(onPerfEntry);
6
+ getFCP(onPerfEntry);
7
+ getLCP(onPerfEntry);
8
+ getTTFB(onPerfEntry);
9
+ });
10
+ }
11
+ };
12
+
13
+ export default reportWebVitals;
@@ -0,0 +1,13 @@
1
+ import { Auth } from '@genesislcap/foundation-comms';
2
+ import { DI } from '@microsoft/fast-foundation';
3
+
4
+ class AuthService {
5
+ isAuthenticated = false;
6
+
7
+ async isUserAuthenticated(): Promise<boolean> {
8
+ const auth: Auth = DI.getOrCreateDOMContainer().get(Auth);
9
+ return auth.isLoggedIn;
10
+ }
11
+ }
12
+
13
+ export const authService = new AuthService();
@@ -0,0 +1,26 @@
1
+ import { DI } from '@microsoft/fast-foundation';
2
+ import { Connect } from '@genesislcap/foundation-comms';
3
+ import { API_DATA } from '../config';
4
+
5
+ class ConnectService {
6
+ private container = DI.getOrCreateDOMContainer();
7
+ private connect: Connect = this.container.get(Connect);
8
+
9
+ getContainer() {
10
+ return this.container;
11
+ }
12
+
13
+ getConnect() {
14
+ return this.connect;
15
+ }
16
+
17
+ isConnected() {
18
+ return this.connect.isConnected;
19
+ }
20
+
21
+ init() {
22
+ return this.connect.connect(API_DATA.URL);
23
+ }
24
+ }
25
+
26
+ export const connectService = new ConnectService();
@@ -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,21 @@
1
+ import {configure, define} from '@genesislcap/foundation-login';
2
+ import { AUTH_PATH } from '../config';
3
+ import { DI } from '@microsoft/fast-foundation';
4
+ import history from '../utils/history';
5
+
6
+ /**
7
+ * Configure the micro frontend
8
+ */
9
+ export const configureFoundationLogin = () => {
10
+ configure(DI.getOrCreateDOMContainer(), {
11
+ showConnectionIndicator: true,
12
+ hostPath: AUTH_PATH,
13
+ redirectHandler: () => {
14
+ history.push('/{{kebabCase routes.[0].name}}');
15
+ },
16
+ });
17
+
18
+ return define({
19
+ name: `client-app-login`,
20
+ });
21
+ };
@@ -0,0 +1,32 @@
1
+ import { configure as configureHeader }from '@genesislcap/foundation-header/config';
2
+ import { foundationLayoutComponents } from '@genesislcap/foundation-layout';
3
+ import { EntityManagement } from '@genesislcap/foundation-entity-management';
4
+ import { g2plotChartsComponents } from '@genesislcap/g2plot-chart';
5
+ import * as rapidDesignSystem from '@genesislcap/rapid-design-system';
6
+ import { rapidGridComponents } from '@genesislcap/rapid-grid-pro';
7
+ import { configureFoundationLogin } from './foundation-login';
8
+
9
+ EntityManagement;
10
+
11
+ configureHeader({
12
+ templateOptions: {
13
+ provider: 'template',
14
+ icon: 'rapid-icon',
15
+ button: 'rapid-button',
16
+ connectionIndicator: 'rapid-connection-indicator',
17
+ select: 'rapid-select',
18
+ option: 'rapid-option',
19
+ flyout: 'rapid-flyout',
20
+ },
21
+ });
22
+
23
+ configureFoundationLogin();
24
+
25
+ rapidDesignSystem
26
+ .provideDesignSystem()
27
+ .register(
28
+ rapidDesignSystem.baseComponents,
29
+ rapidGridComponents,
30
+ g2plotChartsComponents,
31
+ foundationLayoutComponents,
32
+ );
@@ -0,0 +1,56 @@
1
+ import {
2
+ createContext,
3
+ useState,
4
+ useContext,
5
+ ReactNode,
6
+ FunctionComponent,
7
+ } from 'react';
8
+ import { authService } from '../services/auth.service';
9
+
10
+ interface AuthContextType {
11
+ user: User | null;
12
+ setUser: (user: User | null) => void;
13
+ checkAuthStatus: () => Promise<void>;
14
+ }
15
+
16
+ interface AuthProviderProps {
17
+ children: ReactNode;
18
+ }
19
+
20
+ interface User {
21
+ authorized: boolean;
22
+ }
23
+
24
+ const AuthContext = createContext<AuthContextType | undefined>(undefined);
25
+
26
+ export const useAuth = () => {
27
+ const context = useContext(AuthContext);
28
+ if (!context) {
29
+ throw new Error('useAuth must be used within an AuthProvider');
30
+ }
31
+ return context;
32
+ };
33
+
34
+ export const AuthProvider: FunctionComponent<AuthProviderProps> = ({
35
+ children,
36
+ }) => {
37
+ const [user, setUser] = useState<User | null>(null);
38
+
39
+ const checkAuthStatus = async () => {
40
+ const isUserAuthenticated = await authService.isUserAuthenticated();
41
+
42
+ if (isUserAuthenticated) {
43
+ const user = {
44
+ authorized: isUserAuthenticated,
45
+ };
46
+
47
+ setUser(user);
48
+ }
49
+ };
50
+
51
+
52
+
53
+ const value = { user, setUser, checkAuthStatus };
54
+
55
+ return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;
56
+ };
@@ -0,0 +1,56 @@
1
+ {
2
+ "design_tokens": {
3
+ "color": {
4
+ "accent": {
5
+ "$value": "#0EAFE2",
6
+ "$type": "color"
7
+ },
8
+ "neutral": {
9
+ "$value": "#7C909B",
10
+ "$type": "color"
11
+ }
12
+ },
13
+ "fontFamily": {
14
+ "bodyFont": {
15
+ "$value": "Roboto, \"Segoe UI\", Arial, Helvetica, sans-serif",
16
+ "$type": "fontFamily"
17
+ }
18
+ },
19
+ "typography": {
20
+ "baseFontSize": {
21
+ "$value": "14px",
22
+ "$type": "dimension"
23
+ },
24
+ "baseLineHeight": {
25
+ "$value": "20px",
26
+ "$type": "dimension"
27
+ }
28
+ },
29
+ "mode": {
30
+ "luminance": {
31
+ "$value": 0.23,
32
+ "$type": "number"
33
+ }
34
+ },
35
+ "style": {
36
+ "density": {
37
+ "$value": 0,
38
+ "$type": "number"
39
+ },
40
+ "borderRadius": {
41
+ "$value": 4,
42
+ "$type": "number"
43
+ },
44
+ "strokeWidth": {
45
+ "$value": 1,
46
+ "$type": "number"
47
+ }
48
+ },
49
+ "space": {
50
+ "designUnit": {
51
+ "$value": 4,
52
+ "$type": "number"
53
+ }
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,39 @@
1
+ @font-face {
2
+ font-family: Segoe UI;
3
+ font-weight: 300;
4
+ src: local("Segoe UI Semilight"), local("Segoe UI");
5
+ }
6
+
7
+ * {
8
+ font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
9
+ font-style: normal;
10
+ font-weight: normal;
11
+ }
12
+
13
+ html,
14
+ body,
15
+ #root,
16
+ [class$='-page'] {
17
+ width: 100%;
18
+ height: 100%;
19
+ padding: 0;
20
+ margin: 0;
21
+
22
+ --nav-height: 60px;
23
+ }
24
+
25
+ body{
26
+ overflow: hidden;
27
+ }
28
+
29
+ rapid-design-system-provider,
30
+ .dynamic-template,
31
+ foundation-router {
32
+ display: flex;
33
+ width: 100%;
34
+ height: 100%;
35
+ }
36
+
37
+ rapid-design-system-provider {
38
+ overflow: hidden;
39
+ }
@@ -0,0 +1,4 @@
1
+ declare module '*.svg' {
2
+ const content: any;
3
+ export default content;
4
+ }
@@ -0,0 +1,3 @@
1
+ export interface RouteLayouts {
2
+ [key: string]: 'blank' | 'default';
3
+ }
@@ -0,0 +1,9 @@
1
+ export interface LayersState {
2
+ [key: string]: boolean; // Each key is a layer name, value is its visibility (true/false)
3
+ }
4
+
5
+ export interface LayerContextState {
6
+ state: LayersState;
7
+ updateState: (newState: Partial<LayerContextState['state']>) => void;
8
+ setLayerState: (layerName: string, isVisible: boolean) => void;
9
+ }
@@ -0,0 +1,8 @@
1
+ export type MainMenuLink = {
2
+ index: number;
3
+ path: string;
4
+ title: string;
5
+ icon: string;
6
+ variant?: string;
7
+ };
8
+ export type MainMenu = MainMenuLink[];
@@ -0,0 +1,5 @@
1
+ import { createBrowserHistory } from 'history';
2
+
3
+ const history = createBrowserHistory();
4
+
5
+ export default history;
@@ -0,0 +1,5 @@
1
+ import { history } from './history';
2
+
3
+ export const navigateTo = (path: string): void => {
4
+ history.push(path);
5
+ };
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,28 @@
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
+
11
+ /* Bundler mode */
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "moduleDetection": "force",
17
+ "noEmit": true,
18
+ "jsx": "react-jsx",
19
+
20
+ /* Linting */
21
+ "strict": true,
22
+ "noUnusedLocals": true,
23
+ "noUnusedParameters": true,
24
+ "noFallthroughCasesInSwitch": true,
25
+ "types": ["node", "react"]
26
+ },
27
+ "include": ["src"]
28
+ }
@@ -0,0 +1,11 @@
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
+ }
@@ -0,0 +1,14 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+ import { resolve } from 'path';
4
+
5
+ export default defineConfig({
6
+ plugins: [
7
+ react(),
8
+ ],
9
+ resolve: {
10
+ alias: {
11
+ 'foundationZero/ZeroDesignSystem': resolve(__dirname, 'node_modules/@genesislcap/foundation-zero'),
12
+ },
13
+ },
14
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed",
3
3
  "description": "Genesis Blank App Seed",
4
- "version": "3.22.0",
4
+ "version": "3.23.0",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"
@@ -1 +0,0 @@
1
- // WIP