Skip to content

Commit

Permalink
Full development of a mroe developed front eny start screen
Browse files Browse the repository at this point in the history
  • Loading branch information
JackCrawfordRobertson committed Apr 9, 2024
1 parent 4469750 commit b70718e
Show file tree
Hide file tree
Showing 14 changed files with 417 additions and 25 deletions.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@lordicon/react": "^1.6.0",
"@mdx-js/react": "^2.3.0",
"@mui/icons-material": "^5.14.14",
"@mui/material": "^5.14.17",
Expand All @@ -52,15 +53,19 @@
"gatsby-source-filesystem": "^5.12.0",
"gatsby-transformer-remark": "^6.12.1",
"gatsby-transformer-sharp": "^5.12.1",
"keen-slider": "^6.8.6",
"lottie-web": "^5.12.2",
"mapbox-gl": "^2.15.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-helmet": "^6.1.0",
"react-icons": "^5.0.1",
"react-joyride": "^2.7.0",
"react-sidebar": "^3.0.2",
"react-slick": "^0.30.2",
"slick-carousel": "^1.8.1",
"snapsvg": "^0.5.1",
"snapsvg-cjs": "^0.0.6"
"snapsvg-cjs": "^0.0.6",
"swiper": "^11.1.0"
}
}
2 changes: 1 addition & 1 deletion src/pages/Localities/InteractivePoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ const InteractivePoints = ({map, isZoomCompleted}) => {
elevation={4}
sx={{
padding: "10px",
height: isMobile ? "90vh" : "80vh", // Dynamic width based on device
height: isMobile ? "90vh" : "90vh", // Dynamic width based on device
display: "flex",
flexDirection: "column",
zIndex: 1,
Expand Down
18 changes: 10 additions & 8 deletions src/pages/MainConsolidation/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ import BaseMap from "../Maps/BaseMap";
import SVGHeatmapOverlay from "../SVGHeatmapOverlay/SVGHeatmapOverlay";
import SVGControls from "../SVGHeatmapOverlay/SVGControls";
import TownBorderMap from "../Maps/TownBorderMap";
import ZoomButton from "../StartingZoom/ZoomButton";
import DevZoom from "../StartingZoom/DevZoom";
import ZoomFrontLoadScreen from "../StartingZoom/index";
// import TutorialJoyride from "../Tutorial/TutorialJoyride"; // Adjust the path as necessary

const App = () => {
const [ center, setCenter ] = useState([ 0, 0 ]);
const [ zoom, setZoom ] = useState(2);
const [ zoom, setZoom ] = useState(3);
const [ visibleSVG, setVisibleSVG ] = useState(0);
const [ map, setMap ] = useState(null);
const [ buttonsDisabled, setButtonsDisabled ] = useState(true);
const [ isZoomCompleted, setIsZoomCompleted ] = useState(false);
const [ showZoomFrontLoad, setShowZoomFrontLoad ] = useState(true); // Add this line

const cycleSVG = () => {
setVisibleSVG((prevSVG) => (prevSVG + 1) % 3);
Expand Down Expand Up @@ -49,8 +51,7 @@ const App = () => {
};

return (
<div className="app" style={{ position: "relative" }}>

<div className="app" style={{position: "relative"}}>
{/* <TutorialJoyride /> */}

<div style={{pointerEvents: isZoomCompleted ? "all" : "none"}}>
Expand All @@ -69,13 +70,14 @@ const App = () => {
{isZoomCompleted && <SVGControls cycleSVG={cycleSVG} disabled={buttonsDisabled} />}
</div>

<ZoomButton onZoom={zoomToFocus} disabled={buttonsDisabled} />
{/* DevZoom component */}


<DevZoom onZoom={zoomToFocus} disabled={buttonsDisabled} />

</div>
{/* Production component */}


{/* {showZoomFrontLoad && <ZoomFrontLoadScreen onZoom={zoomToFocus} onOtherAction={() => setShowZoomFrontLoad(false)} />} */}
</div>
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/pages/Maps/BaseMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const BaseMap = ({ center, zoom, onMove, setMap }) => { // Added setMap prop
useEffect(() => {
const mapInstance = new mapboxgl.Map({
container: mapContainer.current,
style: "mapbox://styles/jackrob/club2ecez002m01nt1mt4caez",
style: "mapbox://styles/jackrob/clur4fl8s01df01pi7bfy5vll",
center: center,
zoom: zoom,
interactive: true,
Expand Down
54 changes: 54 additions & 0 deletions src/pages/StartingZoom/ComponentSections/AboutSection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React from "react";
import "../../StartingZoom/styles/animations.css";
import { BsArrowRightSquareFill } from "react-icons/bs";

const AboutSection = ({ onNext, onButtonClick }) => {
const handleButtonClick = () => {
if (onButtonClick) {
onButtonClick(); // Call the function passed from the parent component
}
};

return (
<div className="Main__container">
<div className="Main">
<h1 className="heading">About Maya</h1>
<p className="body_coppy">
Maya emerged as an innovative response to the global challenge of water scarcity, exacerbated by
climate change. This web-based platform is at the forefront of translating complex environmental
data into actionable insights, designed to foster a comprehensive understanding among local
stakeholders, international donors, and the broader community.
</p>
<p>
By transforming dense water case studies from the Levant into accessible, design-driven narratives,
Maya sets a new standard for environmental communication. With its proven success and positive
feedback from initial tests, Maya is poised for expansion. Our vision is to empower specialists and
stakeholders across regions, turning critical data into meaningful action. Join us on this journey
to illuminate paths toward resilience and sustainability, one insight at a time.
</p>
<button
onClick={() => {
if (onNext) {
onNext(); // Call the function passed from the parent component
}
handleButtonClick(); // Call the handleButtonClick function
}}
className="jump-animation"
style={{
background: "transparent",
padding: "0",
border: "none",
cursor: "pointer", // To visually indicate the element is clickable
display: "inline-flex", // Use 'flex' to align the icon center if needed
alignItems: "center", // Vertically center the icon in the button
justifyContent: "right", // Horizontally center the icon in the button
}}
>
<BsArrowRightSquareFill style={{ fontSize: "3rem", color: "white" }} />
</button>
</div>
</div>
);
};

export default AboutSection;
71 changes: 71 additions & 0 deletions src/pages/StartingZoom/ComponentSections/ActionSection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import React from "react";
import Button from "@mui/material/Button";

const ActionSection = ({ onZoom, onOtherAction }) => {
const handleLaunch = () => {
onZoom(); // Trigger the zoom functionality.
onOtherAction(); // Hide the ZoomFrontLoadScreen component.
};


return (
<div className="Main__container">
<div className="Main">
<div style={{ marginBottom: "40px" }}>
<h1>Launch Maya</h1>
<p>Explore, compare and enhance your understanding of water scarcity and the impacts of climate change across the Levant.</p>
</div>
<div className="widget">
<h2 style={{ marginBottom: "0" }}>Baalbek-Hermel Governorate, Lebanon</h2>
<h5 style={{ marginTop: "0", fontWeight: "500" }}>Last updated on - 09/04/24</h5>
<p>A comprehensive investigation into River Basin Management within the Baalbek-Hermel Governorate, specifically targeting water usage across localities most at risk throughout the region.</p>
<Button
onClick={handleLaunch}
style={{
backgroundColor: "#ffffff",
color: "333333", /* Set the text color */
padding: "15px",
marginBottom: "20px",
border: "none",
borderRadius: "5px",
cursor: "pointer",
fontSize: "16px",
fontWeight: "bold",
width: "100%",
}}
>
Launch Baalbek-Hermel
</Button>
</div>

{/* Explore More Section */}
<div className="widget">
<h2 style={{marginBottom: "0"}}>Al-Qādisiyyah Governorate, Iraq</h2>
<h5 style={{marginTop: "0", fontWeight: "500"}}>Last updated on - To Be confirmed</h5>
<p>An ongoing, in-depth examination of River Basin Management within the Al-Qādisiyyah Governorate, Iraq, is currently underway.</p>
<Button
onClick={onOtherAction}
disabled={true} // Disable the button functionality
style={{
backgroundColor: "#ededed", // Change background color to a light gray
color: "#c0c0c0", // Change text color to a lighter shade of gray
padding: "15px 30px",
marginBottom: "20px",
border: "none",
borderRadius: "5px",
cursor: "not-allowed", // Change cursor to indicate not clickable
fontSize: "16px",
fontWeight: "bold",
width: "100%",
}}
>
Launch Al-Qādisiyyah
</Button>

</div>
</div>
</div>
);
};

export default ActionSection;
82 changes: 82 additions & 0 deletions src/pages/StartingZoom/ComponentSections/MayaIntro.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import React from "react";
import { motion } from "framer-motion";
import Button from "@mui/material/Button";
import { BsArrowRightSquareFill } from "react-icons/bs";

const MayaIntro = ({ onNext }) => {
// Animation variants for Framer Motion
const containerVariants = {
hidden: { opacity: 0, y: 20 },
visible: {
opacity: 1,
y: 0,
transition: {
when: "beforeChildren",
staggerChildren: 0.3,
},
},
};

const childVariants = {
hidden: { opacity: 0, y: 20 },
visible: {
opacity: 1,
y: 0,
transition: {
duration: 0.5,
},
},
};

// Adding button variants for animation
const buttonVariants = {
hidden: { opacity: 0, y: 20 },
visible: {
opacity: 1,
y: 0,
transition: {
delay: 2,
duration: 0.5,
},
},
};

return (
<motion.div
initial="hidden"
animate="visible"
variants={containerVariants}
style={{
textAlign: "center",
color: "#ffffff",
alignItems: "center",
zIndex: 10000,
}}
>
<motion.h1 variants={childVariants} style={{ fontSize: "5em", marginBottom: "0" }}>Maya</motion.h1>
<motion.h2 variants={childVariants}>Your Gateway to Understanding</motion.h2>
<motion.p variants={childVariants}>Visualising the complex connection between Water Scarcity and Climate Change</motion.p>
<motion.div variants={buttonVariants}>
<Button
variant="contained"
onClick={onNext}
className="jump-animation"
style={{
backgroundColor: "transparent",
padding: "0",
display: "inline-block",
justifyContent: "center",
alignItems: "center",
border: "none",
boxShadow: "none",
marginTop: "2rem",
}}
>
<BsArrowRightSquareFill style={{ fontSize: "3rem" }} />
</Button>
</motion.div>
</motion.div>
);
};

export default MayaIntro;
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, {useState, useEffect} from "react";
import {motion} from "framer-motion";

const ZoomButton = ({onZoom}) => {
const DevZoom = ({onZoom}) => {
const [ visible, setVisible ] = useState(true);
const [ loadingProgress, setLoadingProgress ] = useState(0);
const [ isButtonDisabled, setIsButtonDisabled ] = useState(true); // State to manage button disabled/enabled
const textColor = "#ffffff"; // Replace with your preferred color

useEffect(() => {
// Set an interval to update the loading progress
const increment = 100 / (5000 / 50); // This should be 1 if we are incrementing every 50ms.
const increment = 100 / (100 / 50); // This should be 1 if we are incrementing every 50ms.

const intervalId = setInterval(() => {
setLoadingProgress((prevProgress) => {
Expand Down Expand Up @@ -39,8 +39,8 @@ const ZoomButton = ({onZoom}) => {
return visible ? (
<motion.div
initial={{opacity: 1}}
animate={{opacity: 0.8}}
transition={{delay: 3, duration: 2}}
animate={{opacity: 1}}
transition={{delay: 0, duration: 0}}
style={{
position: "absolute",
top: 0,
Expand All @@ -62,7 +62,7 @@ const ZoomButton = ({onZoom}) => {
transition={{duration: 0.5, ease: "easeInOut", delay: 0.25}}
style={{textAlign: "center", marginBottom: "0px"}}
>
<h1 style={{fontSize: "5em", color: textColor, marginBottom: "0px"}}>Maya</h1>
<h1 style={{fontSize: "5em", color: textColor, marginBottom: "0px"}}></h1>
</motion.div>

<motion.div
Expand All @@ -71,7 +71,7 @@ const ZoomButton = ({onZoom}) => {
transition={{duration: 0.5, ease: "easeInOut", delay: 0.5}}
style={{textAlign: "center", width: "70%", }}
>
<p style={{color: textColor}}> Visualising the Climate-Water Connection for Specialists</p>
<p style={{color: textColor}}> </p>
</motion.div>

<motion.button
Expand Down Expand Up @@ -122,11 +122,11 @@ const ZoomButton = ({onZoom}) => {
pointerEvents: "none", // Make the text non-interactive
}}
>
Zoom to Focus
Go
</span>
</motion.button>
</motion.div>
) : null;
};

export default ZoomButton;
export default DevZoom;
4 changes: 0 additions & 4 deletions src/pages/StartingZoom/animations.css

This file was deleted.

Loading

0 comments on commit b70718e

Please sign in to comment.