-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…535) * Align API spec file * Update TPermission and fix issues related to the update * Get dashboard config using news APIs. Display widgets based on user permissions * Ensure new widgets are added to the user dashboard if his permissions change * Manage empty dashboard customization * Display empty layout is no stored config found
- Loading branch information
Showing
15 changed files
with
18,639 additions
and
9,212 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
55 changes: 40 additions & 15 deletions
55
src/components/accessories/dashboard/dashboardContent/DashboardContent.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,32 +1,57 @@ | ||
import React, { FunctionComponent } from "react"; | ||
import { DashboardFilter } from "./filter/DashboardFilter"; | ||
import { GridLayoutToolbox } from "../layouts/toolbox/GridLayoutToolBox"; | ||
import GridLayoutToolbox from "../layouts/toolbox/GridLayoutToolBox"; | ||
import GridLayoutContainer from "../layouts/container/GridLayoutContainer"; | ||
import { setDashboardPeriod } from "../../../../state/dashboard/actions"; | ||
import { useDispatch } from "react-redux"; | ||
import { useDispatch, useSelector } from "react-redux"; | ||
import "./styles.scss"; | ||
import { IState } from "../../../../types"; | ||
import { TAPIResponseStatus } from "../../../../state/types"; | ||
import { CircularProgress } from "@material-ui/core"; | ||
import { Navigate } from "react-router"; | ||
import { PATHS } from "../../../../consts"; | ||
|
||
export const DashboardContent: FunctionComponent = () => { | ||
const dispatch = useDispatch(); | ||
const handlePeriodChange = (value: string[]) => { | ||
dispatch(setDashboardPeriod(value)); | ||
}; | ||
|
||
const authUserStatus = useSelector<IState, TAPIResponseStatus>( | ||
(state) => state.main.authentication.status ?? "IDLE" | ||
); | ||
|
||
return ( | ||
<div className="dashboard__content"> | ||
<div className="dashboard__main"> | ||
<div className="dashboard__main-content"> | ||
<div className="dashboard__main-header"> | ||
<DashboardFilter onPeriodChange={handlePeriodChange} /> | ||
</div> | ||
<div className="dashboard__main-body"> | ||
<GridLayoutContainer /> | ||
<> | ||
{authUserStatus === "SUCCESS" && ( | ||
<div className="dashboard__content"> | ||
<div className="dashboard__main"> | ||
<div className="dashboard__main-content"> | ||
<div className="dashboard__main-header"> | ||
<DashboardFilter onPeriodChange={handlePeriodChange} /> | ||
</div> | ||
<div className="dashboard__main-body"> | ||
<GridLayoutContainer /> | ||
</div> | ||
</div> | ||
<div className="dashboard__main-side"> | ||
<GridLayoutToolbox /> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="dashboard__main-side"> | ||
<GridLayoutToolbox /> | ||
</div> | ||
</div> | ||
</div> | ||
)} | ||
|
||
{authUserStatus === "LOADING" && ( | ||
<CircularProgress | ||
style={{ | ||
marginLeft: "50%", | ||
marginTop: "200px", | ||
position: "relative", | ||
}} | ||
/> | ||
)} | ||
|
||
{authUserStatus === "FAIL" && <Navigate to={PATHS.login} />} | ||
</> | ||
); | ||
}; |
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.