Skip to content

Commit be031ee

Browse files
use @formswizard/config and @formswizard/api
1 parent 99cdb9b commit be031ee

16 files changed

Lines changed: 36 additions & 94 deletions

File tree

apps/dev/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
DEVELOPER_MODE=true
1+
NEXT_PUBLIC_DEVELOPER_MODE=true

apps/dev/next.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,4 @@ module.exports = {
22
reactStrictMode: true,
33
transpilePackages: [],
44
output: 'export',
5-
env: {
6-
developerMode: process.env.DEVELOPER_MODE
7-
}
85
};

apps/storybook/vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ import react from '@vitejs/plugin-react'
44
// https://vitejs.dev/config/
55
export default defineConfig({
66
plugins: [react()],
7+
define: {
8+
'process.env': process.env
9+
}
710
})

packages/config/features/config.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/config/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/config/package.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/config/tsconfig.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

packages/example/features/app/Tabs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import HubIcon from '@mui/icons-material/Hub';
1010
import BarChartIcon from '@mui/icons-material/BarChart';
1111
import LogoDevIcon from '@mui/icons-material/LogoDev';
1212

13-
import { config } from '@formswizard/processing-config';
13+
import { config } from '@formswizard/config';
1414

1515
const notYetImplemented = <p>Not Yet Implemented</p>;
1616

@@ -22,5 +22,5 @@ export const tabs = [
2222
{icon: <ViewTimelineIcon/>, label: "Gantt", content: notYetImplemented},
2323
{icon: <HubIcon/>, label: "Network", content: notYetImplemented},
2424
{icon: <BarChartIcon/>, label: "Chart", content: notYetImplemented},
25-
...(config.developerMode ? [{icon: <LogoDevIcon/>, label: "Dev", content: <Debug/>}] : [])
25+
...(config.feature.developerMode ? [{icon: <LogoDevIcon/>, label: "Dev", content: <Debug/>}] : [])
2626
].filter(t => t);

packages/example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"edit-form": "workspace:*",
1919
"edit-table": "workspace:*",
2020
"edit-timeline": "workspace:*",
21-
"@formswizard/processing-config": "workspace:*",
21+
"@formswizard/config": "^0.2.1",
2222
"import": "workspace:*",
2323
"layout": "workspace:*",
2424
"react": "^18.2.0",

packages/import/features/Import.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ import { useEffect } from 'react';
33
import { useAppSelector, useAppDispatch, setRowData } from 'state';
44
import { selectJsonSchema, selectCryptedData, setCryptedData, selectUiSchema, setJsonSchema, setUiSchema } from 'project-state';
55
import { PGPProvider, decryptUsingContext } from 'pgp-provider';
6-
import { DefaultService, OpenAPI } from '@formswizard/api';
7-
8-
OpenAPI.BASE = 'http://localhost:4000';
9-
const { getProjectStateCryptedData, getProjectStateSchema } = DefaultService;
6+
import { api } from '@formswizard/api';
107

118
function useFormId() {
129
const hash = typeof location != 'undefined' ? location.hash.slice(1) : '';
@@ -23,7 +20,7 @@ export function DecryptAndImportLastNewSubmission() {
2320
const cryptedData = useAppSelector(selectCryptedData);
2421
useEffect( () => {
2522
async function loadCryptedData() {
26-
const { cryptedData } = await getProjectStateCryptedData(formId);
23+
const { cryptedData } = await api.getProjectStateCryptedData(formId);
2724
const latestCryptedDatum = cryptedData?.length && cryptedData[cryptedData.length-1];
2825
latestCryptedDatum && dispatch(setCryptedData(latestCryptedDatum));
2926
}
@@ -53,7 +50,7 @@ export function useSchema() {
5350

5451
useEffect(() => {
5552
async function loadSchema() {
56-
const { schema } = await getProjectStateSchema(formId);
53+
const { schema } = await api.getProjectStateSchema(formId);
5754
const { jsonSchema, uiSchema } = schema || {};
5855
jsonSchema && dispatch(setJsonSchema(jsonSchema))
5956
jsonSchema && dispatch(setUiSchema(uiSchema))

0 commit comments

Comments
 (0)