-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: resolve type error(s) causing build failure * refactor: move types and interfaces to a different folder * refactor: move types and interfaces to a different folder * feat: add service to complete user profile * feat: add a global state `isCertifiedUser` * feat: add not clickable prop to custom tabs component * feat: add keys for project creator and drone operator in constants * feat: add country name with country codes in constants * feat: add util removeKeysFromObject * refactor: change the color of error and input components * fix: change token stored in local storage due to change in api * refactor: move signedInAs flag from global state to localstorage * fix: change the services method to incorporate `Access-Token` in header * feat: complete api integration of user profile completion part * feat: add proper texts to required fields * fix: change certain payload type from string to number * feat: add neccessary comments * fix: change payload to handle changes in backend
- Loading branch information
1 parent
3e21b1c
commit fb85635
Showing
21 changed files
with
436 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
src/frontend/src/components/UserProfile/FormContents/OtherDetails/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { useTypedDispatch, useTypedSelector } from '@Store/hooks'; | ||
import { FormControl, Input, Label } from '@Components/common/FormUI'; | ||
import { Flex, FlexColumn } from '@Components/common/Layouts'; | ||
import RadioButton from '@Components/common/RadioButton'; | ||
import { droneOperatorOptions } from '@Constants/index'; | ||
import FileUpload from '@Components/common/UploadArea'; | ||
import ErrorMessage from '@Components/common/FormUI/ErrorMessage'; | ||
import { setCommonState } from '@Store/actions/common'; | ||
|
||
export default function OtherDetails({ formProps }: { formProps: any }) { | ||
const dispatch = useTypedDispatch(); | ||
const isCertifiedDroneOperator = useTypedSelector( | ||
state => state.common.isCertifiedDroneUser, | ||
); | ||
|
||
const { register, setValue } = formProps; | ||
|
||
return ( | ||
<section className="naxatw-px-14"> | ||
<Flex> | ||
<p className="naxatw-mb-2 naxatw-text-lg naxatw-font-bold"> | ||
Other Details | ||
</p> | ||
</Flex> | ||
<FlexColumn gap={5}> | ||
<FormControl> | ||
<Label required>Notify for projects withing Distance (in km)</Label> | ||
<Input | ||
placeholder="Enter" | ||
className="naxatw-mt-1" | ||
type="number" | ||
{...register('notify_for_projects_within_km', { | ||
required: 'Required', | ||
valueAsNumber: true, | ||
})} | ||
/> | ||
<ErrorMessage | ||
message={ | ||
formProps.formState.errors?.notify_for_projects_within_km?.message | ||
} | ||
/> | ||
</FormControl> | ||
<FormControl> | ||
<Label required>Experience </Label> | ||
<Input | ||
placeholder="Enter years of experience" | ||
className="naxatw-mt-1" | ||
type="number" | ||
{...register('experience_years', { | ||
required: 'Required', | ||
valueAsNumber: true, | ||
})} | ||
/> | ||
<ErrorMessage | ||
message={formProps.formState.errors?.experience_years?.message} | ||
/> | ||
</FormControl> | ||
<FormControl> | ||
<Label required>Drone you own</Label> | ||
<Input | ||
placeholder="Enter the type of drone you own" | ||
className="naxatw-mt-1" | ||
{...register('drone_you_own', { | ||
required: 'Required', | ||
})} | ||
/> | ||
<ErrorMessage | ||
message={formProps.formState.errors?.drone_you_own?.message} | ||
/> | ||
</FormControl> | ||
<FormControl> | ||
<RadioButton | ||
topic="Certified Drone Operator?" | ||
options={droneOperatorOptions} | ||
direction="column" | ||
onChangeData={val => { | ||
dispatch(setCommonState({ isCertifiedDroneUser: val })); | ||
setValue('certified_drone_operator', val === 'yes'); | ||
}} | ||
value={isCertifiedDroneOperator} | ||
/> | ||
<ErrorMessage | ||
message={ | ||
formProps.formState.errors?.certified_drone_operator?.message | ||
} | ||
/> | ||
</FormControl> | ||
<FileUpload | ||
// @ts-ignore | ||
register={() => {}} | ||
onChange={() => {}} | ||
setValue={() => {}} | ||
placeholder="*The supported file formats are pdf, .jpeg, .png" | ||
/> | ||
</FlexColumn> | ||
</section> | ||
); | ||
} |
27 changes: 16 additions & 11 deletions
27
src/frontend/src/components/UserProfile/FormContents/Password/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/frontend/src/components/UserProfile/FormContents/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import BasicDetails from './BasicDetails'; | ||
import OrganizationDetails from './OrganizationDetails'; | ||
import OtherDetails from './OtherDetails'; | ||
import PasswordSection from './Password'; | ||
|
||
export { BasicDetails, OrganizationDetails, PasswordSection }; | ||
export { BasicDetails, OrganizationDetails, OtherDetails, PasswordSection }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.