diff --git a/src/components/Tutorials/subComps/AddNewStep.jsx b/src/components/Tutorials/subComps/AddNewStep.jsx
index aa4356c6..808f7687 100644
--- a/src/components/Tutorials/subComps/AddNewStep.jsx
+++ b/src/components/Tutorials/subComps/AddNewStep.jsx
@@ -9,153 +9,161 @@ import { useFirebase, useFirestore } from "react-redux-firebase";
import { useDispatch, useSelector } from "react-redux";
import { AppstoreAddOutlined } from "@ant-design/icons";
import {
- addNewTutorialStep,
- clearCreateTutorials,
+ addNewTutorialStep,
+ clearCreateTutorials
} from "../../../store/actions";
+import { min } from "lodash";
const AddNewStepModal = ({
- viewModal,
- viewCallback,
- tutorial_id,
- steps_length,
- owner,
+ viewModal,
+ viewCallback,
+ tutorial_id,
+ steps_length,
+ owner
}) => {
- const firebase = useFirebase();
- const firestore = useFirestore();
- const dispatch = useDispatch();
- const [visible, setVisible] = useState(false);
- const [loading, setLoading] = useState(false);
- const [error, setError] = useState(false);
- const [title, setTitle] = useState("");
- const [time, setTime] = useState(0);
+ const firebase = useFirebase();
+ const firestore = useFirestore();
+ const dispatch = useDispatch();
+ const [visible, setVisible] = useState(false);
+ const [loading, setLoading] = useState(false);
+ const [error, setError] = useState(false);
+ const [title, setTitle] = useState("");
+ const [time, setTime] = useState(0);
- useEffect(() => {
- clearCreateTutorials()(dispatch);
- return () => {
- clearCreateTutorials()(dispatch);
- };
- }, [dispatch]);
+ useEffect(() => {
+ clearCreateTutorials()(dispatch);
+ return () => {
+ clearCreateTutorials()(dispatch);
+ };
+ }, [dispatch]);
- const loadingProp = useSelector(
- ({
- tutorials: {
- create: { loading },
- },
- }) => loading
- );
- const errorProp = useSelector(
- ({
- tutorials: {
- create: { error },
- },
- }) => error
- );
+ const loadingProp = useSelector(
+ ({
+ tutorials: {
+ create: { loading }
+ }
+ }) => loading
+ );
+ const errorProp = useSelector(
+ ({
+ tutorials: {
+ create: { error }
+ }
+ }) => error
+ );
- useEffect(() => {
- setLoading(loadingProp);
- }, [loadingProp]);
+ useEffect(() => {
+ setLoading(loadingProp);
+ }, [loadingProp]);
- useEffect(() => {
- setError(errorProp);
- }, [errorProp]);
+ useEffect(() => {
+ setError(errorProp);
+ }, [errorProp]);
- useEffect(() => {
- setVisible(viewModal);
- }, [viewModal]);
+ useEffect(() => {
+ setVisible(viewModal);
+ }, [viewModal]);
- useEffect(() => {
- if (loading === false && error === false) {
- setVisible(false);
- clearCreateTutorials()(dispatch);
- }
- }, [loading, error, dispatch]);
+ useEffect(() => {
+ if (loading === false && error === false) {
+ setVisible(false);
+ clearCreateTutorials()(dispatch);
+ }
+ }, [loading, error, dispatch]);
- const onSubmit = (e) => {
- e.preventDefault();
+ const onSubmit = e => {
+ e.preventDefault();
- const formData = {
- title,
- time,
- };
- const set_data = {
- ...formData,
- id: `${tutorial_id}_${new Date().getTime()}`,
- tutorial_id,
- owner,
- };
- addNewTutorialStep(set_data)(firebase, firestore, dispatch);
- };
+ const formData = {
+ title,
+ time
+ };
+ const set_data = {
+ ...formData,
+ id: `${tutorial_id}_${new Date().getTime()}`,
+ tutorial_id,
+ owner
+ };
+ addNewTutorialStep(set_data)(firebase, firestore, dispatch);
+ };
- const handleCancel = () => {
- setVisible(false);
- };
+ const handleCancel = () => {
+ setVisible(false);
+ };
- return (
- viewCallback()}
- onOk={() => viewCallback()}
- footer={false}
- destroyOnClose={true}
- maskClosable={false}
- style={{
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- }}>
-
- {error && (
-
- )}
-
-
-
- );
+ return (
+ viewCallback()}
+ onOk={() => viewCallback()}
+ footer={false}
+ destroyOnClose={true}
+ maskClosable={false}
+ style={{
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center"
+ }}
+ >
+
+ {error && (
+
+ )}
+
+
+
+ );
};
export default AddNewStepModal;