From de02ed7b73b217e8371301f59a0a145d32b9ce56 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Wed, 31 Jan 2024 15:44:28 +0000 Subject: [PATCH] refactor(frontend): remove code to add #FMTM tag automatically --- .../createnewproject/ProjectDetailsForm.tsx | 18 ------------------ .../src/store/slices/CreateProjectSlice.ts | 4 ++-- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/frontend/src/components/createnewproject/ProjectDetailsForm.tsx b/src/frontend/src/components/createnewproject/ProjectDetailsForm.tsx index 42ce617fe7..e7ed14b573 100644 --- a/src/frontend/src/components/createnewproject/ProjectDetailsForm.tsx +++ b/src/frontend/src/components/createnewproject/ProjectDetailsForm.tsx @@ -51,27 +51,12 @@ const ProjectDetailsForm = ({ flag }) => { }; }, []); - const hashtagPrefix = '#FMTM '; - // Checks if hashtag value starts with hotosm-fmtm' const handleHashtagOnChange = (e) => { let enteredText = e.target.value; - if (!enteredText.startsWith(hashtagPrefix)) { - handleCustomChange('hashtags', hashtagPrefix); - return; - } handleCustomChange('hashtags', enteredText); }; - // Doesn't let the user to press 'Backspace' or 'Delete' if input value is 'hotosm-fmtm ' - const handleHashtagKeyPress = (e) => { - if ( - ((e.key === 'Backspace' || e.key === 'Delete') && values.hashtags === hashtagPrefix) || - (e.ctrlKey && e.key === 'Backspace') - ) { - e.preventDefault(); - } - }; const handleInputChanges = (e) => { handleChange(e); dispatch(CreateProjectActions.SetIsUnsavedChanges(true)); @@ -165,9 +150,6 @@ const ProjectDetailsForm = ({ flag }) => { onChange={(e) => { handleHashtagOnChange(e); }} - onKeyDown={(e) => { - handleHashtagKeyPress(e); - }} fieldType="text" required errorMsg={errors.hashtag} diff --git a/src/frontend/src/store/slices/CreateProjectSlice.ts b/src/frontend/src/store/slices/CreateProjectSlice.ts index af1a2c5790..9f437cc080 100755 --- a/src/frontend/src/store/slices/CreateProjectSlice.ts +++ b/src/frontend/src/store/slices/CreateProjectSlice.ts @@ -7,7 +7,7 @@ export const initialState: CreateProjectStateTypes = { projectDetails: { dimension: 10, no_of_buildings: 5, - hashtags: '#FMTM ', + hashtags: '', name: '', short_description: '', odk_central_url: '', @@ -70,7 +70,7 @@ const CreateProject = createSlice({ state.projectDetails = { dimension: 10, no_of_buildings: 5, - hashtags: '#FMTM ', + hashtags: '', name: '', short_description: '', odk_central_url: '',