From 10122fbf06f37afb649f3bd4b2567f2100b15f09 Mon Sep 17 00:00:00 2001 From: lcucuzzella Date: Fri, 6 Dec 2024 16:24:50 +0100 Subject: [PATCH] feat(U257): chg header e role picker 20241206 --- .../components/CardProfile/cardProfile.tsx | 21 ++++++++------- .../src/components/Header/header.scss | 2 +- .../components/Header/view/headerDesktop.tsx | 26 ++++++++++++++++--- .../switchProfileModal.scss | 8 +++--- 4 files changed, 39 insertions(+), 18 deletions(-) diff --git a/fe-piattaforma/src/components/CardProfile/cardProfile.tsx b/fe-piattaforma/src/components/CardProfile/cardProfile.tsx index 795836d86..403979d38 100644 --- a/fe-piattaforma/src/components/CardProfile/cardProfile.tsx +++ b/fe-piattaforma/src/components/CardProfile/cardProfile.tsx @@ -68,17 +68,15 @@ const CardProfile: React.FC = (props) => { !activeProfile && 'card-profile-container__opacity' )} > - + /> */} - ) : ( -
- )} + ) : null}
= (props) => { 'switch-profile-titles' )} > - {profile?.descrizioneRuolo} + {profile?.descrizioneRuolo} {device.mediaIsPhone &&
} {profile?.nomeEnte ? ( - - {` "${profile?.nomeEnte}" `} - +
+ {`Ente`} {`${profile?.nomeEnte} `} +
) : null}
- + + {/* QUI VA PROGETTO O PROGRAMMA */} + {profile?.nomeProgramma} {profile?.nomeProgettoBreve ? `, ${profile?.nomeProgettoBreve}` diff --git a/fe-piattaforma/src/components/Header/header.scss b/fe-piattaforma/src/components/Header/header.scss index f527ace97..3e9c47b70 100644 --- a/fe-piattaforma/src/components/Header/header.scss +++ b/fe-piattaforma/src/components/Header/header.scss @@ -80,7 +80,7 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - max-width: 185px; + max-width: 260px; @media screen and (max-width: 767px) { font-size: 14px !important; diff --git a/fe-piattaforma/src/components/Header/view/headerDesktop.tsx b/fe-piattaforma/src/components/Header/view/headerDesktop.tsx index e0c020afa..4cd1b08b9 100644 --- a/fe-piattaforma/src/components/Header/view/headerDesktop.tsx +++ b/fe-piattaforma/src/components/Header/view/headerDesktop.tsx @@ -1,4 +1,4 @@ -import React, { memo, useState } from 'react'; +import React, { memo, useEffect, useState } from 'react'; import clsx from 'clsx'; import { NavLink, useNavigate } from 'react-router-dom'; import { @@ -25,6 +25,7 @@ import { defaultRedirectUrl } from '../../../routes'; import { NotificationsPreview } from '../../index'; import UserAvatar from '../../Avatar/UserAvatar/UserAvatar'; import { LogoutRedirect } from '../../../redux/features/user/userThunk'; +import API from '../../../utils/apiHelper'; const HeaderDesktop: React.FC = ({ isHeaderFull = true, @@ -57,7 +58,24 @@ const HeaderDesktop: React.FC = ({ }, ]; + console.log('USER PROFILE: ', userProfile); + const [profile, setProfile] = useState(null); + + useEffect(() => { + const fetchProfile = async () => { + if (userProfile?.idEnte) { + const response = await API.get(`/ente/${userProfile?.idEnte}`); + setProfile(response); + console.log('PROFILE: ', response); + } + }; + fetchProfile(); + }, [userProfile]); + + + const userDropDown = () => ( + = ({ 'user-description' )} > - + {/* {user?.cognome} {user?.nome} - + */} {/*{getRoleLabel(userProfile?.codiceRuolo)}*/} - {`${userProfile?.descrizioneRuolo}${ + {`${userProfile?.descrizioneRuolo}`}{`${ userProfile?.nomeEnte ? ` ${userProfile.nomeEnte}` : '' }`} diff --git a/fe-piattaforma/src/components/Modals/SwitchProfileModal/switchProfileModal.scss b/fe-piattaforma/src/components/Modals/SwitchProfileModal/switchProfileModal.scss index 960419f2b..7ed1a64ed 100644 --- a/fe-piattaforma/src/components/Modals/SwitchProfileModal/switchProfileModal.scss +++ b/fe-piattaforma/src/components/Modals/SwitchProfileModal/switchProfileModal.scss @@ -9,9 +9,11 @@ } } -.spacing { - padding-left: 50px; -} +// .spacing { +// padding-left: 50px; +// } + + .switch-profile-titles { overflow: hidden; text-overflow: ellipsis;