Skip to content

Commit

Permalink
feat(fe-piattaforma): fe updates 08112022
Browse files Browse the repository at this point in the history
  • Loading branch information
niccolo.valente committed Aug 11, 2022
1 parent e8b1766 commit d9e1f6e
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 6 deletions.
6 changes: 4 additions & 2 deletions fe-piattaforma/src/components/Breadcrumb/breadCrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ const Breadcrumb = () => {
label: getLabelBreadcrumb(elem),
url: createUrl(index),
link:
(userProfile?.codiceRuolo === userRoles.REGP &&
((userProfile?.codiceRuolo === userRoles.REGP ||
userProfile?.codiceRuolo === userRoles.FAC) &&
getLabelBreadcrumb(elem) === 'Progetti') ||
((userProfile?.codiceRuolo === userRoles.REG ||
userProfile?.codiceRuolo === userRoles.REGP) &&
userProfile?.codiceRuolo === userRoles.REGP ||
userProfile?.codiceRuolo === userRoles.FAC) &&
getLabelBreadcrumb(elem) === 'Programmi')
? false
: index !== 0 && index !== currentLocation?.length - 2,
Expand Down
3 changes: 2 additions & 1 deletion fe-piattaforma/src/components/Header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ const parseMenuRoute = (menuRoute: MenuItem, userProfile: UserProfileI) => {
}
return menuRoute;
}
case userRoles.REGP: {
case userRoles.REGP:
case userRoles.FAC: {
if (userProfile?.idProgetto && menuRoute.path === '/area-amministrativa/progetti') {
return {
...menuRoute,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ const ProgramsDetails: React.FC = () => {
buttonsPosition={buttonsPosition}
goBackTitle='Elenco programmi'
goBackPath='/area-amministrativa/programmi'
showGoBack={userRole !== userRoles.REG && userRole !== userRoles.REGP}
showGoBack={userRole !== userRoles.REG && userRole !== userRoles.REGP && userRole !== userRoles.FAC}
surveyDefault={surveyDefault}
isRadioButtonItem={radioButtonsSurveys}
onRadioChange={(surveyCheckedId: string) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ const ProjectsDetails = () => {
? 'Elenco progetti'
: 'Torna indietro'
}
showGoBack={userRole !== userRoles.REGP}
showGoBack={userRole !== userRoles.REGP && userRole !== userRoles.FAC}
>
<>
{currentForm}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,5 @@ export const userRoles = {
REG: 'REG',
REGP: 'REGP',
VOL: 'VOL',
FAC: 'FAC',
}
3 changes: 3 additions & 0 deletions fe-piattaforma/src/pages/common/Auth/authRedirect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const AuthRedirect = () => {
const profile = useAppSelector(selectProfile);
const navigate = useNavigate();

console.log('passa')

const redirectTo = (to: string, replace = true) => {
navigate(to, { replace });
};
Expand All @@ -23,6 +25,7 @@ const AuthRedirect = () => {
if (profile?.codiceRuolo) {
const { codiceRuolo, idProgramma, idProgetto } = profile;
switch (codiceRuolo) {
case userRoles.FAC:
case userRoles.VOL:
case userRoles.REG:
case userRoles.REGP: {
Expand Down
10 changes: 9 additions & 1 deletion fe-piattaforma/src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,24 @@ const AppRoutes: React.FC = () => {
</>
) : (
<>
<Route path='/auth' element={<Auth />} />
<Route path='/' element={<FullLayout />}>
<Route path='/onboarding' element={<Onboarding />} />
<Route
path='/'
element={<Navigate replace to={defaultRedirectUrl} />}
/>
</Route>
<Route path='/auth' element={<Auth />} />
</>
)}
<Route path='/' element={<FullLayout />}>
{/* Public Paths */}
<Route path='/open-data' element={<OpenData />} />
</Route>
<Route
path='/'
element={<Navigate replace to={defaultRedirectUrl} />}
/>
<Route
path='*'
element={<Navigate replace to={defaultRedirectUrl} />}
Expand Down

0 comments on commit d9e1f6e

Please sign in to comment.