diff --git a/src/pages/DashboardPage/DashboardPage.module.css b/src/pages/DashboardPage/DashboardPage.module.css index ce41de1..9d460b7 100644 --- a/src/pages/DashboardPage/DashboardPage.module.css +++ b/src/pages/DashboardPage/DashboardPage.module.css @@ -1,13 +1,26 @@ -.welcomeMessage { +.dashboardContainer { display: flex; - gap: 1rem; + flex-direction: column; +} + +.CardsContainer { + display: flex; + flex-direction: row; + width: 100%; + justify-content: space-between; + margin-bottom: 3rem; } + +.dashboardTitle { + font-size: 2rem; + font-weight: 600; + margin-bottom: 1rem; +} + /* make purple border around flightsToday */ .cardStyle { - flex-basis: 33.3333%; display: flex; - justify-content: flex-end; - align-items: flex-start; + width: 15rem; height: 100px; background: transparent; border-radius: 5px; @@ -28,7 +41,6 @@ .flightNumber { font-size: 4rem; - font-family: Arial, Helvetica, sans-serif; padding: 1rem 0; color: var(--miracle-color-blue); } diff --git a/src/pages/DashboardPage/DashboardPage.tsx b/src/pages/DashboardPage/DashboardPage.tsx index 0f6f533..5976af6 100644 --- a/src/pages/DashboardPage/DashboardPage.tsx +++ b/src/pages/DashboardPage/DashboardPage.tsx @@ -1,4 +1,5 @@ import styles from "./DashboardPage.module.css"; +import Rotunda from "./components/Rotunda/Rotunda"; import { useNavigationContext } from "../../context/Navigation.context"; import { Tabs } from "../../layout/SideBar/SideBar.definitions"; import { getDashboardData } from "../../api/queries"; @@ -11,6 +12,13 @@ const DashboardPage = () => { const { setCurrentTab } = useNavigationContext(); const { getToken } = useAuth(); + const images = [ + "src/pages/DashboardPage/components/DJI_0632.jpeg", + "src/pages/DashboardPage/components/DJI_20230609100419_0001_V.jpeg", + "src/pages/DashboardPage/components/Campus_aerial_fall.jpg", + "src/pages/DashboardPage/components/Image 4-5-22 at 1.45 PM.jpg", + ]; + const { data: dashboardData, isLoading: dashboardLoading } = useQuery({ queryKey: ["dashboard"], @@ -28,26 +36,33 @@ const DashboardPage = () => { return ( <> -
-
-
- {dashboardData?.["Flights Today"]} -
-
FLIGHTS TODAY
+
+
+ Welcome back to Miracle Flights
-
-
- {(Number(dashboardData?.["Flights This Week"]) || 0) + - (Number(dashboardData?.["Flights Today"]) || 0)} +
+
+
+ {dashboardData?.["Flights Today"]} +
+
FLIGHTS TODAY
-
FLIGHTS THIS WEEK
-
-
-
- {dashboardData?.["All Total Flights"]} +
+
+ {(Number(dashboardData?.["Flights This Week"]) || 0) + + (Number(dashboardData?.["Flights Today"]) || 0)} +
+
FLIGHTS THIS WEEK
+
+
+
+ {dashboardData?.["All Total Flights"]} +
+
FLIGHTS TOTAL
-
FLIGHTS EVER
+
Miracle Flights Pictures
+
); diff --git a/src/pages/DashboardPage/components/Campus_aerial_fall.jpg b/src/pages/DashboardPage/components/Campus_aerial_fall.jpg new file mode 100644 index 0000000..af1012e Binary files /dev/null and b/src/pages/DashboardPage/components/Campus_aerial_fall.jpg differ diff --git a/src/pages/DashboardPage/components/DJI_0632.jpeg b/src/pages/DashboardPage/components/DJI_0632.jpeg new file mode 100644 index 0000000..d8299f6 Binary files /dev/null and b/src/pages/DashboardPage/components/DJI_0632.jpeg differ diff --git a/src/pages/DashboardPage/components/DJI_20230609100419_0001_V.jpeg b/src/pages/DashboardPage/components/DJI_20230609100419_0001_V.jpeg new file mode 100644 index 0000000..d2278bf Binary files /dev/null and b/src/pages/DashboardPage/components/DJI_20230609100419_0001_V.jpeg differ diff --git a/src/pages/DashboardPage/components/Image 4-5-22 at 1.45 PM.jpg b/src/pages/DashboardPage/components/Image 4-5-22 at 1.45 PM.jpg new file mode 100644 index 0000000..b7b3f31 Binary files /dev/null and b/src/pages/DashboardPage/components/Image 4-5-22 at 1.45 PM.jpg differ diff --git a/src/pages/DashboardPage/components/Rotunda/Rotunda.module.css b/src/pages/DashboardPage/components/Rotunda/Rotunda.module.css new file mode 100644 index 0000000..a03ef10 --- /dev/null +++ b/src/pages/DashboardPage/components/Rotunda/Rotunda.module.css @@ -0,0 +1,63 @@ +.rotundaContainer { + position: relative; + width: 100%; + overflow: hidden; + display: flex; + align-items: center; +} + +.imageContainer { + display: flex; + overflow-x: hidden; + white-space: nowrap; + transition: scroll-left 1s ease-in-out; /* Smoother transition for scrolling */ +} + +.rotundaImage { + width: 320px; + height: 180px; + flex-shrink: 0; + margin-right: 10px; + transition: transform 0.3s ease; +} + +.rotundaImage:hover { + transform: scale(1.05); +} + +.arrow { + position: absolute; + height: 100%; + display: flex; /* Enable flexbox */ + align-items: center; /* Center content vertically */ + justify-content: center; /* Center content horizontally */ + background-color: #fff; + border: none; + color: var(--miracle-color-blue); + cursor: pointer; + font-size: 24px; + padding: 10px; + z-index: 100; + opacity: 0; + transition: opacity 0.3s ease; +} + +.arrow:hover { + opacity: 1; +} + +.Icon { + font-size: 24px; + top: 50%; +} + +.arrow.left { + background: linear-gradient(to left, rgba(255, 255, 255, 0), #fff); + padding-right: 50px; +} + +.arrow.right { + right: 0px; + background: linear-gradient(to right, rgba(255, 255, 255, 0), #fff); + padding-left: 50px; +} diff --git a/src/pages/DashboardPage/components/Rotunda/Rotunda.tsx b/src/pages/DashboardPage/components/Rotunda/Rotunda.tsx new file mode 100644 index 0000000..ec197b4 --- /dev/null +++ b/src/pages/DashboardPage/components/Rotunda/Rotunda.tsx @@ -0,0 +1,112 @@ +import styles from "./Rotunda.module.css"; +import Icon from "../../../../components/CustomIcon/Icon"; +import React, { useEffect, useRef, useState } from "react"; + +type RotundaProps = { + images: string[]; +}; + +const Rotunda: React.FC = ({ images }) => { + const scrollRef = useRef(null); + const [intervalId, setIntervalId] = useState(null); + const [scrollPosition, setScrollPosition] = useState(0); // State to track scroll position + + const scrollAmount = 330; // Image width + margin + const totalWidth = scrollAmount * images.length; // Total width of one full set of images + + const scroll = () => { + if (scrollRef.current) { + const scrollElement = scrollRef.current; + scrollElement.scrollLeft += scrollAmount; + updateScrollPosition(scrollElement.scrollLeft); + if (scrollElement.scrollLeft >= totalWidth) { + scrollElement.scrollLeft -= totalWidth; + updateScrollPosition(scrollElement.scrollLeft); + } + } + }; + + useEffect(() => { + const id = setInterval(scroll, 15000) as unknown as number; + setIntervalId(id); + return () => { + clearInterval(id); + if (scrollRef.current) { + updateScrollPosition(scrollRef.current.scrollLeft); + } + }; + }, []); + + const handleArrowClick = (direction: "left" | "right") => { + if (scrollRef.current) { + const scrollElement = scrollRef.current; + if (direction === "right") { + scrollElement.scrollLeft += scrollAmount; + } else { + scrollElement.scrollLeft -= scrollAmount; + } + updateScrollPosition(scrollElement.scrollLeft); + if (scrollElement.scrollLeft >= totalWidth) { + scrollElement.scrollLeft -= totalWidth; + } else if (scrollElement.scrollLeft < 0) { + scrollElement.scrollLeft += totalWidth; + } + updateScrollPosition(scrollElement.scrollLeft); + } + }; + + const updateScrollPosition = (position: number) => { + setScrollPosition(position); + }; + + const handleMouseEnter = () => { + if (intervalId !== null) { + clearInterval(intervalId); + } + }; + const handleMouseLeave = () => { + const id = setInterval(scroll, 15000) as unknown as number; + setIntervalId(id); + }; + + return ( +
+ {scrollPosition > 0 && ( +
handleArrowClick("left")} + > + +
+ )} +
+ {images.concat(images).map( + ( + image, + index, // Duplicate images for looping + ) => ( + {`Slide + ), + )} +
+
handleArrowClick("right")} + > + +
+
+ ); +}; + +export default Rotunda;