Skip to content

Commit

Permalink
feat(monitoraggio-caricamenti): WIP page monitoraggio caricamenti 202…
Browse files Browse the repository at this point in the history
…41001
  • Loading branch information
federico-tocci-dxc committed Oct 1, 2024
1 parent 3095f5b commit 44f526d
Show file tree
Hide file tree
Showing 10 changed files with 834 additions and 32 deletions.
24 changes: 10 additions & 14 deletions fe-piattaforma/src/components/HamburgerMenu/hamburgerMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/* TODO fix this file!! */
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/anchor-is-valid */

import React, { useEffect, useState } from 'react';
import clsx from 'clsx';
import { Button, Collapse, Icon, LinkList } from 'design-react-kit';
Expand All @@ -22,10 +18,10 @@ const HamburgerMenu: React.FC<HBMenuProps> = (props) => {
const { open, setOpen, menuRoutes = [] } = props;
const { hasUserPermission } = useGuard();

const [collapseOpen, setCollapseOpen] = useState(false);
const [collapseOpen, setCollapseOpen] = useState<string | null>(null);

const expanded = {
'aria-expanded': true,
const toggleCollapse = (menuId: string) => {
setCollapseOpen((prev) => (prev === menuId ? null : menuId));
};

useEffect(() => {
Expand Down Expand Up @@ -60,7 +56,7 @@ const HamburgerMenu: React.FC<HBMenuProps> = (props) => {
'pr-3',
'flex-column'
)}
{...(collapseOpen ? expanded : {})}
aria-expanded={collapseOpen === link.id}
id={link.id}
>
<Button
Expand All @@ -71,7 +67,7 @@ const HamburgerMenu: React.FC<HBMenuProps> = (props) => {
'align-items-center',
'anchor-button'
)}
onClick={() => setCollapseOpen(!collapseOpen)}
onClick={() => toggleCollapse(link.id ?? '')}
>
{link.label}
<Icon
Expand All @@ -85,11 +81,11 @@ const HamburgerMenu: React.FC<HBMenuProps> = (props) => {
</li>
<li
className={clsx(
!collapseOpen && 'd-none',
collapseOpen !== link.id && 'd-none',
'sublist-container'
)}
>
<Collapse isOpen={collapseOpen}>
<Collapse isOpen={collapseOpen === link.id}>
<LinkList sublist>
{link.subRoutes
.filter(({ visible = ['hidden'] }) =>
Expand All @@ -102,7 +98,7 @@ const HamburgerMenu: React.FC<HBMenuProps> = (props) => {
to={sub.path}
onClick={() => {
setOpen(false);
setCollapseOpen(false);
setCollapseOpen(null);
}}
>
{sub.label}
Expand All @@ -119,7 +115,7 @@ const HamburgerMenu: React.FC<HBMenuProps> = (props) => {
to={link.path}
onClick={() => {
setOpen(false);
setCollapseOpen(false);
setCollapseOpen(null);
}}
>
{link.label}
Expand Down Expand Up @@ -206,4 +202,4 @@ const HamburgerMenu: React.FC<HBMenuProps> = (props) => {
);
};

export default HamburgerMenu;
export default HamburgerMenu;
2 changes: 2 additions & 0 deletions fe-piattaforma/src/components/HeaderMenu/headerMenu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
.dropdown-menu.show {
height: auto;
margin-top: 6px;
width: auto;
min-width: 215px;
}

@media screen and (max-width: 1000px) {
Expand Down
22 changes: 6 additions & 16 deletions fe-piattaforma/src/components/HeaderMenu/headerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ const HeaderMenu: React.FC<HeaderMenuI> = (props) => {

const [activeTab, setActiveTab] = useState(updateActiveTab());
const { t } = useTranslation();
const [dropdownOpen, setDropdownOpen] = useState(false);
const [dropdownEventsOpen, setDropdownEventsOpen] = useState(false);
const [activeDropdown, setActiveDropdown] = useState<string | null>(null);
const navigate = useNavigate();

useEffect(() => {
Expand All @@ -48,10 +47,9 @@ const HeaderMenu: React.FC<HeaderMenuI> = (props) => {

const navDropDown: React.FC<MenuItem> = (li) => {
const toggle = (dropdown: string) => {
dropdown.toLowerCase() !== 'area cittadini'
? setDropdownOpen((prevState) => !prevState)
: setDropdownEventsOpen((prevState) => !prevState);
setActiveDropdown((prev) => (prev === dropdown ? null : dropdown));
};

const onLinkClick = () => {
setActiveTab(li.id || li.label);
toggle(li.label);
Expand All @@ -61,11 +59,7 @@ const HeaderMenu: React.FC<HeaderMenuI> = (props) => {
<>
<UncontrolledDropdown
inNavbar
isOpen={
li.label.toLowerCase() === 'area cittadini'
? dropdownEventsOpen
: dropdownOpen
}
isOpen={activeDropdown === li.label}
toggle={() => toggle(li.label)}
>
<DropdownToggle
Expand All @@ -77,11 +71,7 @@ const HeaderMenu: React.FC<HeaderMenuI> = (props) => {
'pb-0',
'mb-1'
)}
aria-expanded={
li.label.toLowerCase() === 'area cittadini'
? dropdownEventsOpen
: dropdownOpen
}
aria-expanded={activeDropdown === li.label}
>
{li.label}
<Icon
Expand Down Expand Up @@ -201,4 +191,4 @@ const HeaderMenu: React.FC<HeaderMenuI> = (props) => {
);
};

export default memo(HeaderMenu);
export default memo(HeaderMenu);
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import React, { lazy, useEffect } from 'react';
import { Container } from 'design-react-kit';
import {
Route,
Routes,
useLocation,
useNavigate,
useParams,
} from 'react-router-dom';
import PageTitle from '../../../components/PageTitle/pageTitle';
import { useAppSelector } from '../../../redux/hooks';
import { selectDevice } from '../../../redux/features/app/appSlice';
import { LocationIndex } from '../../../components';
import { MenuRoutes } from '../../../utils/common';
const Monitoring = lazy(() => import('./monitoring'));
// const Users = lazy(() => import('./Entities/Users/users'));
// const Authorities = lazy(() => import('./Entities/Authorities/authorities'));
import ProtectedComponent from '../../../hoc/AuthGuard/ProtectedComponent/ProtectedComponent';

interface PageTitleMockI {
[key: string]: {
title: string;
textCta?: string;
iconCta?: string;
};
}

export const PageTitleMock: PageTitleMockI = {
'/report-dati/monitoraggio-caricamenti-massivi': {
title: 'Monitoraggio dei caricamenti massivi',
textCta: 'Monitoraggio dei caricamenti massivi',
iconCta: 'it-plus',
}
};

const tabs = [
{
label: 'Programmi',
path: '/report-dati/monitoraggio-caricamenti-massivi',
id: 'tab-dashboard',
}
];

const DataReports = () => {
//const [activeTab, setActiveTab] = useState(tabs.at(0));
const location = useLocation();
const navigate = useNavigate();
const { entityId } = useParams();

const updateActiveTab = () => {
if (location.pathname.split('/').length <= 2 && tabs.at(0)?.path) {
navigate(tabs.at(0)?.path ?? '', {
replace: false,
});
}
/* setActiveTab(
tabs.at(tabs.findIndex((tab) => tab.path === location.pathname) || 0)
); */
};

useEffect(() => {
updateActiveTab();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [location]);

const device = useAppSelector(selectDevice);

const noDetailRoute = MenuRoutes.find(
(x) => x.id === 'tab-dashboard'
)?.subRoutes?.some((y) => y.path === location.pathname);

return (
<>
{/*
<div className='mb-5 mt-3'>
<TabGroup arrayTabs={tabs} activeTab={activeTab?.id} />
</div>
*/}
{device.mediaIsPhone && noDetailRoute && (
<div className='mt-2 px-3'>
<LocationIndex
title='Area amministrativa'
routes={
MenuRoutes.find((x) => x.id === 'tab-dashboard')?.subRoutes || []
}
/>
</div>
)}

{location?.pathname &&
location?.pathname !== '/report-dati/questionari' &&
!entityId ? (
<PageTitle {...PageTitleMock[location?.pathname]} />
) : null}

<Container>
<Routes>{DataReportsRoutes}</Routes>
</Container>
{/* <ManageUsers /> */}
</>
);
};

export default DataReports;

const DataReportsRoutes = [
<Route
key='monitoring'
path='monitoraggio-caricamenti-massivi'
element={
<ProtectedComponent visibleTo={['tab.dshb']}>
<Monitoring />
</ProtectedComponent>
}
/>
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
.custom-accordion {
span {
color: #5C6F82;
}
}

.results {
font-family: Titillium Web;
font-size: 24px;
font-weight: 400;
line-height: 36px;
text-align: left;
color: #0066CC;
}

.statisticheValue {
font-size: 28px;
font-weight: 600;
line-height: 40px;
text-align: left;
color: white;
width: 32px;
height: 40px;
gap: 0px;
opacity: 0px;
padding-left: 15px;
position: relative;
top: -2px; // Adjust this value as needed to move it upwards
}

.statisticheDescrizione {
color: white;
font-size: 22px;
font-weight: 300;
line-height: 24px;
text-align: left;
padding-left: 10px;
position: relative;
top: -2px; // Adjust this value as needed to move it upwards
}

.square {
width: 275px;
height: 80px;
padding: 20px 0px 0px 0px;
gap: 10px;
border-radius: 10px; // All four corners rounded
opacity: 0px;
background: #435A70;
}

.square-container {
display: flex;
justify-content: space-between;
width: Fixed (1,184px)px;
height: Hug (80px)px;
top: 1167px;
left: 50px;
gap: 30px;
opacity: 0px;
margin-bottom: 50px;
margin-top: 20px;
}

Loading

0 comments on commit 44f526d

Please sign in to comment.