Skip to content

Commit

Permalink
fix(cr): updates 20240202 cr
Browse files Browse the repository at this point in the history
  • Loading branch information
a-buono committed Feb 2, 2024
1 parent b6c57e4 commit 31a11d5
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 148 deletions.
49 changes: 0 additions & 49 deletions fe-piattaforma/src/components/SectionTitle/sectionTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,55 +98,6 @@ const SectionTitle: React.FC<SectionTitleI> = (props) => {
device.mediaIsPhone && !isForumLayout && 'flex-column'
)}
>
{iconAvatar ? (
<div className={clsx('position-relative')}>
<UserAvatar
avatarImage={profilePicture || immagineProfilo}
user={{ uSurname: surname, uName: name }}
size={AvatarSizes.Big}
font={AvatarTextSizes.Big}
lightColor={device.mediaIsPhone}
isUserProfile={isUserProfile}
/>

{isUserProfile && (
<Button
onClick={() =>
dispatch(
openModal({
id: 'update-profile-pic-modal',
payload: { title: 'Aggiorna immagine profilo' },
})
)
}
className={clsx(
'camera-icon',
'primary-bg',
'position-absolute',
'rounded-circle',
'section-title__icon-container',
'profile-picture-btn'
)}
style={{
bottom: '-10px',
left: '-10px',
}}
>
<Icon
size='xs'
icon='it-camera'
color='white'
aria-label='Foto'
className='position-absolute'
style={{
top: '7px',
left: '7px',
}}
/>
</Button>
)}
</div>
) : null}
<div
style={{
//minWidth: '150px',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@
top: 6px;
}
}


.container {
padding-left: 0px;
margin-top: 10px;
}
145 changes: 46 additions & 99 deletions fe-piattaforma/src/pages/facilitator/Onboarding/onboarding.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import clsx from 'clsx';
import { useDispatch } from 'react-redux';
import { Navigate, useNavigate } from 'react-router-dom';
Expand All @@ -17,8 +17,7 @@ import {
import withFormHandler, {
withFormHandlerProps,
} from '../../../hoc/withFormHandler';
import { Form, Input } from '../../../components';
import { Button, FormGroup, Icon, Label } from 'design-react-kit';
import { Button } from 'design-react-kit';
import {
login,
logout,
Expand Down Expand Up @@ -47,9 +46,9 @@ const Onboarding: React.FC<OnboardingI> = (props) => {
const device = useAppSelector(selectDevice);
const user = useAppSelector(selectUser);
const image = user?.immagineProfilo || Profile;
const [isValidForm, setIsValidForm] = useState<boolean>(false);
const {
form,
//isValidForm,
getFormValues = () => ({}),
onInputChange = () => ({}),
updateForm = () => ({}),
Expand Down Expand Up @@ -95,18 +94,18 @@ const Onboarding: React.FC<OnboardingI> = (props) => {
const onSubmitForm = async () => {
try {
//if (isValidForm) {
const res = await dispatch(EditUser(getFormValues()));
const res = await dispatch(EditUser(getFormValues()));
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if (res) {
const res2 = await dispatch(CreateUserContext());
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if (res) {
const res2 = await dispatch(CreateUserContext());
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if (res2) {
selectUserRole(res2);
}
if (res2) {
selectUserRole(res2);
}
// }
}
// }
} catch {
dispatch(LogoutRedirect());
}
Expand All @@ -131,109 +130,57 @@ const Onboarding: React.FC<OnboardingI> = (props) => {
Per completare il tuo profilo da facilitatore abbiamo bisogno di
alcuni tuoi dati. <br /> Completa i campi obbligatori per procedere.
</p>
{!device.mediaIsPhone ? (
<div
<FormOnboarding
sendNewForm={updateForm}
setIsFormValid={(isValid: boolean) => setIsValidForm(isValid)}
/>
<div
className={clsx(
'd-flex mb-3 mt-5',
'justify-content-between',
'align-items-center',
device.mediaIsPhone && 'flex-column align-items-center '
)}
>
<a href='/'>
Leggi l&nbsp;informativa sul trattamento dei dati personali
</a>
<Button
disabled={!isValidForm}
color='primary'
onClick={onSubmitForm}
className={clsx(
'd-flex',
'flex-row',
'mt-5',
'pb-4',
'align-items-center',
'pt-3'
device.mediaIsPhone && 'w-100 mt-3 justify-content-center'
)}
>
<div role='button' tabIndex={0} className=' position-relative'>
<div className='rounded-circle onboarding__img-profile position-relative mr-3'>
<img
src={image}
alt='profile'
className='rounded-circle w-100 h-100'
/>

<Button
onClick={() =>
dispatch(
openModal({
id: 'update-profile-pic-modal',
payload: { title: 'Aggiorna immagine profilo' },
})
)
}
className={clsx(
'onboarding__icon-container',
'primary-bg',
'position-absolute',
'rounded-circle',
'profile-picture-btn'
)}
>
<Icon
size=''
icon='it-camera'
color='white'
aria-label='Foto'
className='position-absolute onboarding__icon'
/>
</Button>
</div>
</div>
<div>
<p className='complementary-1-color-b8 mb-0'>
<strong>Foto profilo</strong>
</p>
<p className='complementary-1-color-b8' style={{ fontSize: 14 }}>
Carica una foto per personalizzare il tuo profilo.
</p>
</div>
</div>
) : null}
<FormOnboarding sendNewForm={updateForm} />
<Form
Completa Registrazione
</Button>
</div>
{/* <Form
id='form-onboarding'
className={clsx('mt-5', 'mb-5', 'pt-5', 'onboarding__form-container')}
className={clsx('mt-5', 'mb-5', 'onboarding__form-container')}
showMandatory={false}
>
<div
className={clsx(
'd-flex flex-row justify-content-start',
device.mediaIsPhone && 'mt-5',
'mt-3'
)}
>
<FormGroup check>
<Input
aria-label='checkbox-consenso'
id='checkbox-consenso'
field='consenso'
type='checkbox'
checked={Boolean(form?.consenso?.value)}
onInputChange={(v) => onInputChange(v, form?.consenso?.field)}
withLabel={false}
/>
<Label check for='checkbox-consenso'>
Consenso al&nbsp;<a href='/'>Trattamento dei dati personali</a>
</Label>
</FormGroup>
</div>
<div
className={clsx(
'd-flex mb-3 mt-5',
device.mediaIsPhone && 'justify-content-center',
'justify-content-end'
)}
>
<div>
<a href='/'>Leggi l&nbsp;informativa sul trattamento dei dati personali</a>
<Button
//disabled={!isValidForm}
disabled={!isValidForm}
color='primary'
onClick={onSubmitForm}
className={clsx(
'd-flex mb-3 mt-5',
device.mediaIsPhone && 'justify-content-center',
'justify-content-end'
)}
>
Completa Registrazione
</Button>
</div>
{/* <p className={clsx('primary-color-a12', 'mt-5', 'mb-1', 'pb-2')}>
*Campo obbligatorio
</p> */}
</Form>
{/*</Form>*/}
</div>
</div>
);
Expand Down

0 comments on commit 31a11d5

Please sign in to comment.