[WMS-55] Create/Edit User

This commit is contained in:
m0n02hz
2022-03-02 00:41:24 +05:30
parent 315113630e
commit c2b632e33b
45 changed files with 41607 additions and 190 deletions

View File

@@ -0,0 +1,3 @@
.c-{{pascalCase name}} {
}

View File

@@ -0,0 +1,17 @@
import React from "react";
import PropTypes from "prop-types";
import "./{{pascalCase name}}.component.scss";
const {{pascalCase name}} = props => {
return (
<div className="c-{{pascalCase name}}">
In Component {{pascalCase name}}
</div>
);
};
{{pascalCase name}}.propTypes = {
};
export default {{pascalCase name}};

View File

@@ -0,0 +1,8 @@
import React from "react";
import {{pascalCase name}} from "./{{pascalCase name}}";
describe("{{pascalCase name}}", () => {
it("renders without error", () => {
});
});

View File

@@ -0,0 +1,3 @@
import {{pascalCase name}} from "./{{pascalCase name}}.jsx";
export default {{pascalCase name}};

View File

@@ -0,0 +1,17 @@
import React from "react";
import PropTypes from "prop-types";
import "./{{pascalCase name}}.module.scss";
const {{pascalCase name}} = props => {
return (
<div className="c-{{pascalCase name}}">
In Page {{pascalCase name}}
</div>
);
};
{{pascalCase name}}.propTypes = {
};
export default {{pascalCase name}};

View File

@@ -0,0 +1,3 @@
.c-{{pascalCase name}} {
}

View File

@@ -0,0 +1,8 @@
import React from "react";
import {{pascalCase name}} from "./{{pascalCase name}}";
describe("{{pascalCase name}}", () => {
it("renders without error", () => {
});
});

View File

@@ -0,0 +1,16 @@
export const UPDATE_FORM_VALUES = "UPDATE_{{constantCase name}}_FORM_VALUES"
export const UPDATE_FORM_ERRORS = "UPDATE_{{constantCase name}}_FORM_ERRORS"
export const updateFormValues = (formValues) => {
return {
type: UPDATE_FORM_VALUES,
payload: formValues
}
}
export const updateFormErrors = (formErrors) => {
return {
type: UPDATE_FORM_ERRORS,
payload: formErrors
}
}

View File

@@ -0,0 +1,3 @@
import {{pascalCase name}} from "./{{pascalCase name}}.jsx";
export default {{pascalCase name}};

View File

@@ -0,0 +1,16 @@
import Immutable from "immutable"
import {UPDATE_FORM_ERRORS, UPDATE_FORM_VALUES} from "./actions"
const initialState = Immutable.Map()
const reducer = (state = initialState, action) => {
switch (action.type) {
case UPDATE_FORM_ERRORS:
case UPDATE_FORM_VALUES:
return state.mergeDeep(action.payload)
default:
return state
}
}
export default reducer

View File

@@ -0,0 +1,14 @@
import {createSelector} from "reselect"
import {createGetSelector} from "reselect-immutable-helpers"
const getData = ({data}) => data
export const get{{pascalCase name}} = createSelector(
getData,
(dataState) => {
return dataState.pages.{{camelCase name}}
}
)
export const getFormErrors = createGetSelector(get{{pascalCase name}}, "formErrors")
export const getFormValues = createGetSelector(get{{pascalCase name}}, "formValues")

5
plop-templates/hook.js.hbs Executable file
View File

@@ -0,0 +1,5 @@
const {{camelCase name}} = () => {
};
export default {{camelCase name}};

View File

@@ -0,0 +1,5 @@
/* PLOP_INJECT_IMPORT */
export {
/* PLOP_INJECT_EXPORT */
}

17
plop-templates/service.js.hbs Executable file
View File

@@ -0,0 +1,17 @@
const create{{pascalCase name}} = () => {
let examplePrivateVariable = 0
return {
getExamplePrivateVariable: () => {
return examplePrivateVariable
},
setExamplePrivateVariable: (n) => {
examplePrivateVariable = n
}
}
};
const singleton = create{{pascalCase name}}();
Object.freeze(singleton);
export default singleton;