Skip to content

Commit

Permalink
Merge pull request #6 from osg-htc/map-start
Browse files Browse the repository at this point in the history
Added transition animation to the sidebar, tooltip and zoom on hover …
  • Loading branch information
Rhymlore authored Nov 3, 2023
2 parents 83cc74e + 01c06c5 commit 116a250
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
17 changes: 12 additions & 5 deletions src/app/components/Markers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { School } from "@mui/icons-material";
import { Feature, TypedFeatures } from "../../../types/mapTypes";
import Features from "../../../public/features.json";
import { getFacilityEsData } from "@/app/institutions/elasticQuery.js";
import { Tooltip } from "@mui/material";

type MarkersProps = {
onMarkerClick: (feature: Feature) => void;
Expand Down Expand Up @@ -31,9 +32,11 @@ const Markers: React.FC<MarkersProps> = ({ onMarkerClick }) => {
if (!esInfo) {
// Handle cases where there's no matching institution in the ElasticSearch data.
return null;
} if(esInfo.gpuProvided > 0) {
console.log({esInfo});
}

const typedFeature: TypedFeatures = {
const filteredFeature: TypedFeatures = {
type: feature.type,
properties: {
"Institution Name": institutionName,
Expand All @@ -52,11 +55,15 @@ const Markers: React.FC<MarkersProps> = ({ onMarkerClick }) => {

return (
<Marker
key={typedFeature.id}
longitude={typedFeature.geometry.coordinates[0]}
latitude={typedFeature.geometry.coordinates[1]}
key={filteredFeature.id}
longitude={filteredFeature.geometry.coordinates[0]}
latitude={filteredFeature.geometry.coordinates[1]}
>
<School fontSize="small" onClick={() => onMarkerClick(typedFeature)} />
<Tooltip title={filteredFeature.properties["Institution Name"]} placement="top">
<School
className="hover:scale-150 transition duration-300 ease-in-out cursor-pointer"
fontSize="small" onClick={() => onMarkerClick(filteredFeature)} />
</Tooltip>
</Marker>
);
});
Expand Down
11 changes: 7 additions & 4 deletions src/app/components/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import { Box, IconButton, Typography, useMediaQuery } from '@mui/material';
import { Box, IconButton, Typography, useMediaQuery, Slide } from '@mui/material';
import { Close as CloseIcon } from '@mui/icons-material';
import useTheme from '@mui/material/styles/useTheme';
import { sub } from 'date-fns';
import { motion } from 'framer-motion';

type SidebarProps = {
onClose: () => void;
Expand Down Expand Up @@ -54,6 +55,7 @@ const Sidebar: React.FC<SidebarProps> = ({ onClose, header, facultyName, dataSta
orgId: 1
}
return (
<Slide direction="right" in={true} mountOnEnter unmountOnExit>
<Box
component="aside"
sx={{
Expand All @@ -74,7 +76,7 @@ const Sidebar: React.FC<SidebarProps> = ({ onClose, header, facultyName, dataSta
<CloseIcon />
</IconButton>
</Box>
<Box className="flex gap-2 ">
<Box className="flex gap-2 flex-col sm:flex-row my-2">
<GrafanaPanel
panelId={12}
panelUrl={data.panelUrl}
Expand All @@ -92,7 +94,7 @@ const Sidebar: React.FC<SidebarProps> = ({ onClose, header, facultyName, dataSta
facultyName={facultyName}
/>
</Box>
<Box className="flex gap-2 ">
<Box className="flex gap-2 flex-col sm:flex-row my-2">
<GrafanaPanel
panelId={6}
panelUrl={data.panelUrl}
Expand All @@ -110,7 +112,7 @@ const Sidebar: React.FC<SidebarProps> = ({ onClose, header, facultyName, dataSta
facultyName={facultyName}
/>
</Box>
<Box className="flex gap-2 ">
<Box className="flex flex-col sm:flex-row my-2 ">
{ dataState ?
<GrafanaPanel
panelId={8}
Expand All @@ -123,6 +125,7 @@ const Sidebar: React.FC<SidebarProps> = ({ onClose, header, facultyName, dataSta
}
</Box>
</Box>
</Slide>
);
};

Expand Down

0 comments on commit 116a250

Please sign in to comment.