Skip to content

Commit

Permalink
refactor(frontend): rename form during project creation --> category
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Feb 1, 2024
1 parent 24c6e8a commit a52fd31
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const LayerSwitcherControl = ({ map, visible = 'osm' }) => {
if (
location.pathname.includes('project_details') ||
location.pathname.includes('upload-area') ||
location.pathname.includes('select-form') ||
location.pathname.includes('select-category') ||
location.pathname.includes('data-extract') ||
location.pathname.includes('split-tasks')
) {
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/components/createnewproject/DataExtract.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const DataExtract = ({ flag, customLineUpload, setCustomLineUpload, customPolygo
}, [formValues?.dataExtractWays, formValues?.dataExtractFeatureType]);

const toggleStep = (step, url) => {
if (url === '/select-form') {
if (url === '/select-category') {
dispatch(
CreateProjectActions.SetIndividualProjectDetailsData({
...formValues,
Expand Down Expand Up @@ -326,7 +326,7 @@ const DataExtract = ({ flag, customLineUpload, setCustomLineUpload, customPolygo
btnText="PREVIOUS"
btnType="secondary"
type="button"
onClick={() => toggleStep(3, '/select-form')}
onClick={() => toggleStep(3, '/select-category')}
className="fmtm-font-bold"
/>
<Button
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/src/components/createnewproject/SelectForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const SelectForm = ({ flag, geojsonFile, customFormFile, setCustomFormFile }) =>
return (
<div className="fmtm-flex fmtm-gap-7 fmtm-flex-col lg:fmtm-flex-row">
<div className="fmtm-bg-white lg:fmtm-w-[20%] xl:fmtm-w-[17%] fmtm-px-5 fmtm-py-6">
<h6 className="fmtm-text-xl fmtm-font-[600] fmtm-pb-2 lg:fmtm-pb-6">Select Form</h6>
<h6 className="fmtm-text-xl fmtm-font-[600] fmtm-pb-2 lg:fmtm-pb-6">Select Category</h6>
<p className="fmtm-text-gray-500 lg:fmtm-flex lg:fmtm-flex-col lg:fmtm-gap-3">
<span>You may choose an existing category or upload a custom XLS form.</span>
<span>
Expand All @@ -96,8 +96,8 @@ const SelectForm = ({ flag, geojsonFile, customFormFile, setCustomFormFile }) =>
<div className="fmtm-flex fmtm-flex-col fmtm-gap-6">
<div className="">
<CustomSelect
title="Select form category"
placeholder="Select form category"
title="Select category"
placeholder="Select category"
data={sortedFormCategoryList}
dataKey="id"
valueKey="title"
Expand Down
10 changes: 1 addition & 9 deletions src/frontend/src/components/createnewproject/UploadArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomLineUpload, se
}
dispatch(CreateProjectActions.SetIndividualProjectDetailsData(formValues));
dispatch(CommonActions.SetCurrentStepFormStep({ flag: flag, step: 3 }));
navigate('/select-form');
navigate('/select-category');
};
const {
handleSubmit,
Expand All @@ -74,14 +74,6 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomLineUpload, se
navigate(url);
};

// const onCreateProjectSubmission = () => {
// if (!drawnGeojson && !geojsonFile) {
// return;
// } else {
// toggleStep(3, '/new-select-form');
// }
// };

const convertFileToGeojson = async (file) => {
if (!file) return;
const fileReader = new FileReader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const OrganisationAddForm = () => {
// eslint-disable-next-line no-use-before-define
// submitForm();
dispatch(OrganisationService(`${import.meta.env.VITE_API_URL}/organisation/`, values));
// navigate("/select-form", { replace: true, state: { values: values } });
};
const { handleSubmit, handleCustomChange, values, errors }: any = useForm(
formData,
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/constants/StepFormConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export const createProjectSteps: ICreateProjectSteps[] = [
name: 'Upload Area',
},
{
url: '/select-form',
url: '/select-category',
step: 3,
label: '03',
name: 'Select Form',
name: 'Select Category',
},
{
url: '/data-extract',
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/constants/blockerUrl.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const pathNotToBlock = ['/select-form', '/data-extract', '/split-tasks', '/upload-area', '/create-project'];
const pathNotToBlock = ['/select-category', '/data-extract', '/split-tasks', '/upload-area', '/create-project'];
export default pathNotToBlock;
16 changes: 14 additions & 2 deletions src/frontend/src/routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ const routes = createBrowserRouter([
</ProtectedRoute>
),
},
{
path: '/basemap-selection',
element: (
<ProtectedRoute>
<Suspense fallback={<div>Loading...</div>}>
<ErrorBoundary>
<CreateProject />
</ErrorBoundary>
</Suspense>
</ProtectedRoute>
),
},
{
path: '/create-project',
element: (
Expand Down Expand Up @@ -220,7 +232,7 @@ const routes = createBrowserRouter([
),
},
{
path: '/select-form',
path: '/select-category',
element: (
<ProtectedRoute>
<Suspense fallback={<div>Loading...</div>}>
Expand Down Expand Up @@ -292,7 +304,7 @@ const routes = createBrowserRouter([
),
},
{
path: 'edit-project/select-form/:projectId',
path: 'edit-project/select-category/:projectId',
element: (
<ProtectedRoute>
<Suspense fallback={<div>Loading...</div>}>
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/views/CreateNewProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const CreateNewProject = () => {
case '/upload-area':
dispatch(CommonActions.SetCurrentStepFormStep({ flag: 'create_project', step: 2 }));
break;
case '/select-form':
case '/select-category':
dispatch(CommonActions.SetCurrentStepFormStep({ flag: 'create_project', step: 3 }));
break;
case '/data-extract':
Expand Down Expand Up @@ -70,7 +70,7 @@ const CreateNewProject = () => {
setCustomPolygonUpload={setCustomPolygonUpload}
/>
);
case '/select-form':
case '/select-category':
return (
<SelectForm
flag="create_project"
Expand Down
12 changes: 6 additions & 6 deletions src/frontend/src/views/CreateProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ const CreateProject: React.FC = () => {
></CoreModules.Box>
<CoreModules.Box
sx={{
height: location.pathname !== '/select-form' ? '8px' : '12px',
height: location.pathname !== '/select-category' ? '8px' : '12px',
width: '64px',
background: location.pathname !== '/select-form' ? '#68707F' : '#D73F3F',
background: location.pathname !== '/select-category' ? '#68707F' : '#D73F3F',
mx: '16px',
borderRadius: '10px',
}}
Expand Down Expand Up @@ -175,14 +175,14 @@ const CreateProject: React.FC = () => {
</Link>
{/* END */}
{/* Upload Area SideBar Button for uploading Area page */}
<Link to="/select-form">
<Link to="/select-category">
<CoreModules.Button
sx={boxSX}
variant="contained"
color="error"
disabled={location.pathname !== '/select-form'}
disabled={location.pathname !== '/select-category'}
>
Select Form
Select Category
</CoreModules.Button>
</Link>
{/* END */}
Expand Down Expand Up @@ -228,7 +228,7 @@ const CreateProject: React.FC = () => {
setLineExtractFileValue={setLineExtractFileValue}
/>
) : null}
{location.pathname === '/select-form' ? (
{location.pathname === '/select-category' ? (
<FormSelection
geojsonFile={geojsonFile}
customFormFile={customFormFile}
Expand Down

0 comments on commit a52fd31

Please sign in to comment.