diff --git a/src/components/HomePage.tsx b/src/components/HomePage.tsx index 1d14e42..46309f2 100644 --- a/src/components/HomePage.tsx +++ b/src/components/HomePage.tsx @@ -1,17 +1,49 @@ +import { useEffect, useState } from "react"; import { useNavigate } from "react-router-dom"; import Dialog from "@mui/material/Dialog"; import CloseIcon from "@mui/icons-material/Close"; +import ArrowOutwardIcon from "@mui/icons-material/ArrowOutward"; +import PlaceOutlinedIcon from "@mui/icons-material/PlaceOutlined"; +import logo from "../assets/logo2.jpg"; +import Map, { Marker, Popup } from "react-map-gl/mapbox"; +import "mapbox-gl/dist/mapbox-gl.css"; import "../styles/HomePage.css"; import { useAuth } from "../context/AuthContext"; -import logo from "../assets/logo2.jpg"; -import { useState } from "react"; import { GoogleLogin, type CredentialResponse } from "@react-oauth/google"; +type PreviewPost = { + id: number; + latitude: number; + longitude: number; + description: string; + imageUrl: string | null; +}; + const HomePage = () => { const { user, signInWithGoogle } = useAuth(); const navigate = useNavigate(); const [loginOpen, setLoginOpen] = useState(false); const [loginError, setLoginError] = useState(""); + const [posts, setPosts] = useState([]); + const [selectedPost, setSelectedPost] = useState(null); + + useEffect(() => { + const controller = new AbortController(); + const loadPosts = async () => { + try { + const response = await fetch(`${import.meta.env.VITE_API_URL}/api/posts/`, { + signal: controller.signal, + }); + if (!response.ok) return; + const data: PreviewPost[] = await response.json(); + setPosts(data.filter((post) => Number.isFinite(post.latitude) && Number.isFinite(post.longitude))); + } catch (error) { + if (!controller.signal.aborted) console.error("Unable to load map preview pins:", error); + } + }; + if (import.meta.env.VITE_API_URL) loadPosts(); + return () => controller.abort(); + }, []); const closeLogin = () => { setLoginOpen(false); @@ -23,7 +55,6 @@ const HomePage = () => { setLoginError("Google did not return a login credential."); return; } - try { setLoginError(""); await signInWithGoogle(response.credential); @@ -37,96 +68,89 @@ const HomePage = () => { return (
- - -
+
-

Photo memories, mapped by place

-

GeoGallery

- -

- Build a personal travel map from the photos and places you want to - remember. -

- -

- Upload a photo, pin it to the world, and revisit your saved moments - through an interactive map designed around places, not folders. -

- +

A home for the places you remember

+

Every photo
has a place.

+

Pin your favorite moments to a map and see your story unfold, one place at a time.

- {user ? ( - - ) : ( - - )} + + {!user && } +
+
+ +

More than a photo album.
A way back to anywhere.

+
+
+ +
+
THE WORLD, THROUGH YOUR LENS01 / EXPLORE
+
+
+ {import.meta.env.VITE_MAPBOX_TOKEN ? ( + setSelectedPost(null)} + > + {posts.map((post) => ( + { event.originalEvent.stopPropagation(); setSelectedPost(post); }}> + + + ))} + {selectedPost && ( + setSelectedPost(null)} maxWidth="230px"> +
+ {selectedPost.imageUrl && } +

{selectedPost.description || "A place worth remembering"}

+
+
+ )} +
+ ) :
Map preview is unavailable.
} +
+
INTERACTIVE MAP PREVIEW
+
+ Drag to explore the world + +
+

Places hold the details. Put your memories back on the map.

- - +
+ 01   FIND A PLACE + 02   PIN A PHOTO + 03   REVISIT THE MOMENT + GeoGallery © {new Date().getFullYear()} +
+ + +

Sign in to GeoGallery

-

- Welcome back! Please sign in to continue. -

-
- - setLoginError("Google sign-in failed. Please try again.") - } - shape="pill" - size="large" - text="continue_with" - theme="outline" - width="260" - /> -
- {loginError && ( -

- {loginError} -

- )} +

Save your photos and revisit the places that matter.

+
setLoginError("Google sign-in failed. Please try again.")} shape="pill" size="large" text="continue_with" theme="outline" width="260" />
+ {loginError &&

{loginError}

}
); diff --git a/src/styles/HomePage.css b/src/styles/HomePage.css index 2d3cca4..3367a4c 100644 --- a/src/styles/HomePage.css +++ b/src/styles/HomePage.css @@ -1,175 +1,371 @@ .landing-container { - position: relative; - width: 100vw; - min-height: 100vh; - overflow: hidden; - background: - radial-gradient(circle at 50% 16%, rgba(76, 202, 237, 0.22), transparent 34%), - linear-gradient(120deg, rgba(10, 25, 48, 0.98), rgba(10, 25, 48, 0.94)), - url("data:image/svg+xml,%3Csvg width='160' height='160' viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%2387b8c6' stroke-width='1' stroke-opacity='0.12'%3E%3Cpath d='M0 40h160M0 80h160M0 120h160M40 0v160M80 0v160M120 0v160'/%3E%3C/g%3E%3C/svg%3E"); - color: #f6fbff; -} - -.landing-container::before { - content: ""; - position: absolute; - inset: 12% auto auto 50%; - width: min(620px, 72vw); - height: min(620px, 72vw); - border: 1px solid rgba(246, 251, 255, 0.08); - border-radius: 50%; - transform: translateX(-50%); - pointer-events: none; + width: 100%; + height: 100vh; + overflow-y: auto; + background: #f7f7f3; + color: #1f2929; + font-family: + Inter, + ui-sans-serif, + -apple-system, + BlinkMacSystemFont, + "Segoe UI", + sans-serif; } - -.landing-container::after { - content: ""; - position: absolute; - inset: auto -10% -28% -10%; - height: 42%; - background: linear-gradient(135deg, rgba(76, 202, 237, 0.16), rgba(10, 25, 48, 0)); - transform: rotate(-4deg); - pointer-events: none; +.landing-container button { + font: inherit; + cursor: pointer; +} +.landing-container button:focus-visible, +.landing-brand:focus-visible { + outline: 2px solid #aa513e; + outline-offset: 4px; } - .landing-nav { - position: relative; - z-index: 2; + width: min(1376px, calc(100% - 96px)); + min-height: 98px; + margin: auto; display: flex; align-items: center; justify-content: space-between; - width: min(1180px, calc(100% - 40px)); - margin: 0 auto; - padding: 24px 0; + border-bottom: 1px solid #dedfd8; } - .landing-brand { + display: inline-flex; + align-items: center; + gap: 11px; + color: #202b2b; + text-decoration: none; + font-size: 19px; + font-weight: 750; + letter-spacing: -0.045em; +} +.landing-brand-logo { + display: block; + width: 38px; + height: 38px; + object-fit: contain; +} +.landing-nav-actions { display: flex; align-items: center; - gap: 10px; - color: #f6fbff; - font-family: var(--calistoga); - font-size: 20px; -} - -.landing-brand img { - width: 42px; - height: 42px; - border-radius: 50%; - object-fit: cover; - box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22); + gap: 32px; +} +.landing-nav-link { + border: 0; + background: none; + color: #53605e; + font-size: 13px !important; + font-weight: 600 !important; +} +.landing-nav-link:hover, +.guest-link:hover { + color: #9c4939; +} +.nav-signin-button { + display: inline-flex; + align-items: center; + gap: 14px; + min-height: 43px; + padding: 0 16px; + border: 1px solid #263231; + border-radius: 3px; + background: transparent; + color: #263231; + font-size: 13px !important; + font-weight: 700 !important; + transition: + background 0.18s, + color 0.18s; +} +.nav-signin-button:hover { + background: #263231; + color: #fff; +} +.nav-signin-button svg { + font-size: 17px; } - .landing-shell { - position: relative; - z-index: 1; - display: flex; + width: min(1376px, calc(100% - 96px)); + min-height: min(780px, calc(100vh - 171px)); + margin: auto; + padding: 48px 0 56px; + display: grid; + grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: center; - justify-content: center; - width: min(900px, calc(100% - 40px)); - min-height: calc(100vh - 90px); - margin: 0 auto; - padding: 28px 0 56px; - text-align: center; + gap: clamp(48px, 6vw, 112px); } - .landing-content { - max-width: 780px; - margin: 0 auto; + padding-bottom: 20px; } - .landing-kicker { - margin: 0 0 18px; - color: #8bd9ef; - font-family: var(--calistoga); - font-size: 15px; + display: flex; + align-items: center; + gap: 12px; + margin: 0 0 26px; + color: #9d4c3b; + font-size: 11px; + font-weight: 800; + letter-spacing: 0.14em; + text-transform: uppercase; +} +.landing-kicker-line { + width: 25px; + height: 1px; + background: #9d4c3b; } - .landing-title { margin: 0; - color: #f6fbff; - font-family: var(--calistoga); - font-size: clamp(68px, 10vw, 128px); + color: #202b2b; + font-family: Georgia, "Times New Roman", serif; + font-size: clamp(60px, 6.35vw, 102px); font-weight: 400; - line-height: 0.9; + letter-spacing: -0.07em; + line-height: 0.99; } - .landing-subtitle { - max-width: 760px; - margin: 24px auto 0; - color: #dbeaf0; - font-size: clamp(24px, 3vw, 38px); - font-weight: 600; - line-height: 1.14; -} - -.landing-description { - max-width: 600px; - margin: 22px auto 0; - color: #9fb8c3; - font-size: 17px; - line-height: 1.7; + max-width: 495px; + margin: 30px 0 0; + color: #566360; + font-size: clamp(17px, 1.45vw, 20px); + line-height: 1.62; + letter-spacing: -0.012em; } - .landing-actions { display: flex; + flex-wrap: wrap; align-items: center; - justify-content: center; - gap: 16px; - margin-top: 34px; + gap: 24px; + margin-top: 39px; } - -.explore-button, -.nav-signin-button, -.guest-link { - font-family: var(--calistoga); - cursor: pointer; - transition: - transform 0.2s ease, - box-shadow 0.2s ease, - background 0.2s ease; -} - .explore-button { - padding: 15px 28px; - border: none; - border-radius: 8px; - background: #4ccaed; - color: #06111f; - box-shadow: 0 14px 28px rgba(76, 202, 237, 0.18); - font-size: 17px; + display: inline-flex; + align-items: center; + justify-content: space-between; + gap: 24px; + min-height: 54px; + padding: 0 19px; + border: 1px solid #253432; + border-radius: 3px; + background: #253432; + color: white; + font-size: 14px !important; + font-weight: 700 !important; + transition: + background 0.18s, + transform 0.18s; } - .explore-button:hover { + background: #3b514c; transform: translateY(-2px); - box-shadow: 0 18px 34px rgba(76, 202, 237, 0.26); } - -.nav-signin-button { - padding: 11px 20px; - border: 1px solid rgba(246, 251, 255, 0.3); - border-radius: 8px; - background: rgba(255, 255, 255, 0.08); - color: #f6fbff; +.explore-button svg { + font-size: 18px; +} +.guest-link { + padding: 7px 0; + border: 0; + border-bottom: 1px solid #aab1aa; + background: none; + color: #263432; + font-size: 13px !important; + font-weight: 700 !important; + transition: color 0.18s; +} +.landing-note { + display: flex; + gap: 17px; + align-items: stretch; + margin-top: clamp(50px, 8vh, 100px); +} +.landing-note-rule { + width: 2px; + background: #b85c46; +} +.landing-note p { + margin: 0; + color: #7c8983; + font-family: Georgia, "Times New Roman", serif; + font-size: 17px; + font-style: italic; + line-height: 1.45; +} +.landing-note strong { + color: #36423e; + font-weight: 400; +} +.landing-map-column { + min-width: 0; +} +.landing-map-heading { + display: flex; + justify-content: space-between; + gap: 10px; + margin-bottom: 13px; + color: #68736d; + font-size: 10px; + font-weight: 800; + letter-spacing: 0.14em; +} +.landing-map-frame { + position: relative; + height: min(570px, 64vh); + min-height: 415px; + border: 1px solid #d4d8d2; + background: #e7e9e2; + box-shadow: 0 16px 38px rgba(44, 60, 50, 0.08); + overflow: hidden; +} +.landing-map { + position: absolute; + inset: 0; +} +.landing-map .mapboxgl-map { + font-family: inherit; +} +.landing-map-unavailable { + height: 100%; + display: grid; + place-items: center; + color: #65716b; font-size: 14px; } - -.nav-signin-button:hover { - background: rgba(255, 255, 255, 0.16); - transform: translateY(-2px); +.landing-map-topline { + position: absolute; + top: 18px; + left: 18px; + display: flex; + align-items: center; + gap: 8px; + padding: 10px 12px; + background: rgba(255, 255, 255, 0.94); + border: 1px solid #e6e9e3; + color: #34433c; + font-size: 10px; + font-weight: 800; + letter-spacing: 0.1em; + pointer-events: none; +} +.landing-live-dot { + width: 6px; + height: 6px; + border-radius: 50%; + background: #aa523e; +} +.landing-map-bottom { + position: absolute; + right: 18px; + bottom: 38px; + left: 18px; + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; + min-height: 55px; + padding: 8px 10px 8px 17px; + background: rgba(255, 255, 255, 0.96); + border: 1px solid #e4e7e1; + box-shadow: 0 6px 20px rgba(33, 46, 40, 0.1); +} +.landing-map-bottom > span { + color: #57655e; + font-size: 12px; + font-weight: 600; +} +.landing-map-bottom button { + display: inline-flex; + align-items: center; + gap: 9px; + padding: 9px 10px; + border: 0; + background: #273733; + color: #fff; + white-space: nowrap; + font-size: 11px !important; + font-weight: 750 !important; +} +.landing-map-bottom button:hover { + background: #9c4939; +} +.landing-map-bottom svg { + font-size: 16px; +} +.landing-map-pin { + width: 28px; + height: 28px; + display: grid; + place-items: center; + padding: 0; + border: 2px solid white; + border-radius: 50%; + background: #a94f3d; + color: white; + box-shadow: 0 2px 8px rgba(37, 52, 50, 0.24); +} +.landing-map-pin:hover { + transform: scale(1.12); +} +.landing-map-pin svg { + font-size: 17px; +} +.landing-map .mapboxgl-popup-content { + padding: 0 !important; + border: 0; + border-radius: 2px !important; + box-shadow: 0 12px 32px rgba(37, 52, 50, 0.22) !important; +} +.landing-map-popup { + max-width: 230px; + background: white; +} +.landing-map-popup img { + display: block; + width: 230px; + height: 120px; + object-fit: cover; +} +.landing-map-popup p { + margin: 0; + padding: 12px 14px; + color: #273733; + font-size: 12px; + line-height: 1.4; +} +.landing-map-caption { + margin: 13px 0 0; + color: #818b84; + font-family: Georgia, "Times New Roman", serif; + font-size: 13px; + font-style: italic; +} +.landing-footer { + width: min(1376px, calc(100% - 96px)); + min-height: 73px; + margin: auto; + display: flex; + align-items: center; + gap: clamp(20px, 4vw, 64px); + border-top: 1px solid #dedfd8; + color: #78837c; + font-size: 10px; + font-weight: 750; + letter-spacing: 0.11em; +} +.landing-footer-brand { + margin-left: auto; + font-weight: 500; + letter-spacing: 0; } - .login-dialog { position: relative; width: min(380px, calc(100vw - 32px)); margin: 16px; padding: 36px 28px 32px; - border-radius: 18px !important; - background: #f9fcfd !important; - color: #17252d; + border-radius: 6px !important; + background: #f9faf6 !important; + color: #273733; text-align: center; } - .login-dialog-close { position: absolute; top: 12px; @@ -179,86 +375,140 @@ display: grid; place-items: center; border: 0; - border-radius: 8px; + border-radius: 3px; background: transparent; - color: #64757c; + color: #64716b; cursor: pointer; } - .login-dialog-close:hover { - background: #edf3f5; - color: #17252d; + background: #edf0e9; + color: #273733; } - .login-dialog h2 { margin: 0; - font-family: var(--calistoga); - font-size: 26px; + font-family: Georgia, "Times New Roman", serif; + font-size: 27px; font-weight: 400; + letter-spacing: -0.03em; } - .login-dialog > p { margin: 10px 0 0; - color: #63767f; + color: #63716a; font-size: 14px; line-height: 1.5; } - .login-dialog-provider { display: flex; justify-content: center; margin-top: 28px; } - .login-dialog .login-error { color: #a33f3f; } - -.guest-link { - border: 1px solid rgba(246, 251, 255, 0.2); - background: rgba(255, 255, 255, 0.08); - color: #f6fbff; -} - -.guest-link { - padding: 14px 20px; - border-radius: 8px; - font-size: 16px; -} - -.guest-link:hover { - background: rgba(255, 255, 255, 0.16); - transform: translateY(-2px); +@media (max-width: 1020px) { + .landing-shell { + grid-template-columns: 1fr 1fr; + gap: 38px; + } + .landing-title { + font-size: clamp(55px, 6vw, 75px); + } + .landing-map-frame { + height: 510px; + } } - -@media (max-width: 900px) { - .landing-container { - overflow-y: auto; +@media (max-width: 760px) { + .landing-nav, + .landing-shell, + .landing-footer { + width: min(100% - 40px, 600px); + } + .landing-nav { + min-height: 72px; + } + .landing-nav-link { + display: none; } - .landing-shell { - min-height: calc(100vh - 88px); - padding-bottom: 40px; + display: block; + min-height: auto; + padding: 70px 0 45px; + } + .landing-content { + padding: 0; + } + .landing-title { + font-size: clamp(58px, 12vw, 82px); + } + .landing-subtitle { + margin-top: 25px; + } + .landing-note { + display: none; + } + .landing-map-column { + margin-top: 72px; + } + .landing-map-frame { + height: 480px; + min-height: 0; + } + .landing-footer { + min-height: 100px; + flex-wrap: wrap; + align-content: center; + gap: 14px 22px; + } + .landing-footer-brand { + width: 100%; + margin: 0; } } - -@media (max-width: 560px) { - .landing-nav { - width: min(100% - 28px, 1180px); - padding-top: 16px; +@media (max-width: 440px) { + .landing-nav, + .landing-shell, + .landing-footer { + width: calc(100% - 32px); + } + .landing-brand { + font-size: 17px; } - - .landing-brand span { - font-size: 18px; + .nav-signin-button { + min-height: 40px; + padding: 0 11px; } - .landing-shell { - width: min(100% - 28px, 900px); - min-height: calc(100vh - 82px); + padding-top: 56px; + } + .landing-title { + font-size: clamp(54px, 13vw, 68px); } - .landing-actions { - align-items: stretch; + align-items: flex-start; flex-direction: column; + gap: 18px; + } + .landing-map-column { + margin-top: 58px; + } + .landing-map-heading { + font-size: 9px; + } + .landing-map-frame { + height: 420px; + } + .landing-map-bottom { + right: 10px; + bottom: 34px; + left: 10px; + padding: 6px; + } + .landing-map-bottom > span { + display: none; + } + .landing-map-bottom button { + width: 100%; + justify-content: space-between; + padding: 10px; } }