Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Navigation and Dashboard: Add Home Link and Interactive Tiles #1406

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
23 changes: 21 additions & 2 deletions frontend/src/components/home/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,23 @@ const HomeDashBoard: React.FC<DashBoardProps> = () => {
}
};

const handleTileClick = (tile) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way this function is an exact duplicate of this existing function handleMaximizeClick.

Why not just use an existing function instead of duplicating it ??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mozzy11 I thought I should create two separate function to be called on an onClick event on different components... Anyways I will modify the code to use the existing function and push the changes... Thank You for you feedback.

if (
testSections?.length > 0 ||
hasRole(userSessionDetails, "Global Administrator")
) {
setSelectedTile(tile);
} else {
setNotificationVisible(true);
addNotification({
kind: NotificationKinds.warning,
title: intl.formatMessage({ id: "accessDenied.title" }),
message: intl.formatMessage({ id: "accessDenied.message" }),
});
}
};

const handleMaximizeClick = (tile) => {
console.log("Icon clicked!");
if (
testSections?.length > 0 ||
hasRole(userSessionDetails, "Global Administrator")
Expand Down Expand Up @@ -504,7 +519,11 @@ const HomeDashBoard: React.FC<DashBoardProps> = () => {
{selectedTile == null ? (
<div className="home-dashboard-container">
{tileList.map((tile, index) => (
<ClickableTile key={index} className="dashboard-tile">
<ClickableTile
key={index}
className="dashboard-tile"
onClick={() => handleTileClick(tile)}
>
<h3 className="tile-title">{tile.title}</h3>
<p className="tile-subtitle">{tile.subTitle}</p>
<p className="tile-value">{tile.value}</p>
Expand Down
Loading