diff --git a/frontend/src/app/PortalPage.tsx b/frontend/src/app/PortalPage.tsx index 8c88a76..51ff5fb 100644 --- a/frontend/src/app/PortalPage.tsx +++ b/frontend/src/app/PortalPage.tsx @@ -2,11 +2,11 @@ import { useEffect, useState } from "react"; import { Icon } from "../shared/components/Icon"; import { MapPreview } from "../shared/components/MapPreview"; import { ProvinceTrendChart } from "../shared/components/ProvinceTrendChart"; -import { ThemeToggle } from "../shared/components/ThemeToggle"; +import { ThemeToggleControl } from "../shared/components/ThemeToggle"; import { LandingFooter } from "./LandingFooter"; import { HeroForecast } from "./HeroForecast"; import { RolesSection } from "./RolesSection"; -import { useTheme } from "../shared/utils/useTheme"; +import "./landingMobile.css"; import { motion, AnimatePresence, MotionConfig, useReducedMotion } from "framer-motion"; import { LandingHeading, scrollToLandingGuide, useLandingReveal } from "./landingMotion"; import { dashboardHashForRole } from "../shared/constants/roles"; @@ -35,8 +35,16 @@ export function PortalPage() { const reducedMotion = useReducedMotion(); const reveal = useLandingReveal(); const [openFaq, setOpenFaq] = useState(0); - const { isDark: isDarkMode, toggleTheme } = useTheme(); const [isScrolled, setIsScrolled] = useState(false); + // Menu ☰ di HP (tautan navigasi disembunyikan di header sempit). + const [menuOpen, setMenuOpen] = useState(false); + useEffect(() => { + if (!menuOpen) return; + const close = () => setMenuOpen(false); + window.addEventListener("scroll", close, { passive: true }); + window.addEventListener("hashchange", close); + return () => { window.removeEventListener("scroll", close); window.removeEventListener("hashchange", close); }; + }, [menuOpen]); // Header solid saat di puncak, berubah jadi frosted-blur (bukan transparan @@ -774,10 +782,25 @@ export function PortalPage() { Panduan
- + {userIsLoggedIn ? "Dashboard" : "Login"} +
+ {/* Cinematic Center Hero */}
@@ -836,7 +859,7 @@ export function PortalPage() { /> {/* Prediksi Probabilitas Rob — grafik sama persis dengan halaman Pantauan Provinsi */} -
+

Kondisi prediksi peluang banjir rob 30 hari ke depan di wilayah Provinsi Lampung.

diff --git a/frontend/src/app/RolesSection.css b/frontend/src/app/RolesSection.css index 39b2d4f..50c9cf4 100644 --- a/frontend/src/app/RolesSection.css +++ b/frontend/src/app/RolesSection.css @@ -149,9 +149,17 @@ /* Header section ini tetap tampil di HP (aturan lama menyembunyikan header bento untuk merapatkan area di bawah hero). */ .roles-section > .bento-header-wrap { display: flex !important; } -} -@media (max-width: 420px) { - .roles-features { grid-template-columns: 1fr; } - .roles-code pre { font-size: 0.72rem; } + /* Ubin satu kolom: ikon | judul + keterangan satu baris | panah — dulu dua + kolom sempit membuat "Cek Lokasi Saya" patah jadi 3 baris. */ + .roles-features { grid-template-columns: 1fr; gap: 8px; margin-bottom: 16px; } + .roles-features li { padding: 11px 12px; } + .roles-features-links a { padding: 11px 12px; } + .roles-features-links small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + .roles-wide-grid > .card-preview-container { margin-bottom: 14px; } + + /* Contoh API cukup satu permintaan; chip endpoint dihapus di HP. */ + .roles-code { margin-bottom: 16px; } + .roles-code pre { font-size: 0.74rem; padding: 12px; } + .roles-code-endpoints { display: none; } } diff --git a/frontend/src/app/landingMobile.css b/frontend/src/app/landingMobile.css new file mode 100644 index 0000000..6ad14c5 --- /dev/null +++ b/frontend/src/app/landingMobile.css @@ -0,0 +1,157 @@ +/* ── Tampilan HP landing (≤ 768px) ────────────────────────────────────── + * Satu sumber aturan mobile untuk landing: + * - jarak tepi seragam 20px, tanpa inset ganda section + kartu; + * - skala huruf: hero > judul section > judul kartu > teks; + * - jarak antar section seragam ~48px, judul rata kiri (kecuali hero); + * - konten ganda (grafik 30 hari, pratinjau peta kedua) disembunyikan. + * Banyak elemen landing memakai style inline, jadi sebagian aturan perlu + * !important. Desktop tidak terpengaruh. + */ + +/* Tombol & panel menu ☰ (hanya HP) */ +.landing-menu-btn { display: none; } +.landing-menu-panel { display: none; } + +@media (max-width: 768px) { + .saibar-landing-root { --m-gutter: 20px; --m-gap: 48px; } + + /* ── Header + menu ── */ + .landing-menu-btn { + align-items: center; + background: var(--bg-card); + border: 1px solid var(--border-color); + border-radius: 10px; + color: var(--ink-primary); + cursor: pointer; + display: inline-flex; + height: 38px; + justify-content: center; + width: 38px; + } + .landing-menu-btn .material-symbols-outlined { font-size: 22px; } + .landing-menu-panel { + background: var(--bg-card); + border: 1px solid var(--border-color); + border-radius: 14px; + box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14); + display: grid; + gap: 2px; + left: var(--m-gutter); + padding: 8px; + position: fixed; + right: var(--m-gutter); + top: 72px; + z-index: 120; + } + .landing-menu-panel[hidden] { display: none; } + .landing-menu-panel a { + align-items: center; + border-radius: 10px; + color: var(--ink-primary); + display: flex; + font-size: 0.98rem; + font-weight: 600; + gap: 12px; + padding: 12px; + text-decoration: none; + } + .landing-menu-panel a:active, + .landing-menu-panel a:hover { background: var(--surface-soft); } + .landing-menu-panel .material-symbols-outlined { color: var(--ocean-dark); font-size: 20px; } + .landing-header-full { padding: 0 var(--m-gutter) !important; } + .landing-header-full .header-actions { gap: 8px !important; } + + /* ── Skala huruf ── */ + .saibar-landing-root .hero-section h1 { font-size: 2rem !important; line-height: 1.15 !important; text-wrap: balance; } + .saibar-landing-root .landing-word-heading, + .saibar-landing-root .bento-header-wrap h2 { + font-size: 1.6rem !important; + letter-spacing: -0.02em !important; + line-height: 1.2 !important; + margin-bottom: 12px !important; + } + .saibar-landing-root .bento-card-el h3 { font-size: 1.3rem !important; margin-bottom: 8px !important; } + .saibar-landing-root .bento-header-wrap p, + .saibar-landing-root .bento-card-el p, + .saibar-landing-root .guide-section p { + font-size: 0.98rem !important; + line-height: 1.6 !important; + } + + /* ── Jarak tepi & antar section ── */ + .saibar-landing-root .hero-section { padding-left: var(--m-gutter) !important; padding-right: var(--m-gutter) !important; padding-bottom: 8px !important; } + .saibar-landing-root .hero-section p { padding: 0 !important; text-wrap: pretty; } + .saibar-landing-root .bento-section { padding: 0 var(--m-gutter) !important; margin-top: var(--m-gap) !important; } + .saibar-landing-root .guide-section { padding: 0 var(--m-gutter) !important; margin: var(--m-gap) auto !important; } + .saibar-landing-root .bento-header-wrap { + align-items: flex-start !important; + gap: 4px !important; + margin-bottom: 20px !important; + text-align: left !important; + } + .saibar-landing-root .bento-container-grid { gap: 14px !important; } + .saibar-landing-root .bento-card-el { padding: 20px 18px !important; border-radius: 14px !important; } + .saibar-landing-root .card-meta-title { font-size: 0.72rem !important; margin-bottom: 10px !important; } + .saibar-landing-root .card-links-row { padding-top: 16px !important; } + + /* ── Grafik 30 hari tetap tampil (digambar sesuai lebar layar, lihat + ProvinceTrendChart). Header section disembunyikan karena kartu grafik + sudah punya judul sendiri. ── */ + .landing-trend-section > .bento-header-wrap { display: none !important; } + .landing-trend-section .bento-card-el { padding: 18px 14px !important; } + .landing-trend-section h2 { font-size: 1.2rem !important; } + + /* ── Konten ganda disembunyikan di HP ── */ + .saibar-landing-root .landing-map-frame { display: none !important; } + + /* ── Bagian Panduan ── */ + .saibar-landing-root .guide-definition-grid, + .saibar-landing-root .guide-map-grid { gap: 24px !important; margin-bottom: var(--m-gap) !important; } + .saibar-landing-root .guide-definition-grid > div:last-child > p, + .saibar-landing-root .guide-map-grid > div > p { margin-bottom: 20px !important; } + .saibar-landing-root .guide-definition-grid .landing-button { justify-content: center; width: 100%; box-sizing: border-box; padding: 14px 20px !important; } + /* Legenda kelas risiko (bukan kata-kata judul yang juga berupa span). */ + .saibar-landing-root .guide-map-grid strong { min-width: 104px !important; } + .saibar-landing-root .guide-map-grid div > span:not(.landing-heading-word) { font-size: 0.88rem !important; } + + /* Cara Melaporkan: daftar bernomor ringkas, bukan tiga kartu besar */ + .saibar-landing-root .reporting-cta { + background: transparent !important; + border: 0 !important; + margin-bottom: var(--m-gap) !important; + padding: 0 !important; + text-align: left !important; + } + .saibar-landing-root .reporting-cta > p { margin: 0 0 20px !important; } + .saibar-landing-root .reporting-flow { gap: 10px !important; } + .saibar-landing-root .reporting-step { + align-items: start; + column-gap: 14px; + display: grid !important; + grid-template-columns: 36px 1fr; + padding: 14px 16px !important; + text-align: left !important; + } + .saibar-landing-root .reporting-step-number { + align-self: start; + border-width: 0 !important; + box-shadow: none !important; + font-size: 0.85rem !important; + grid-row: span 2; + height: 36px !important; + margin: 0 !important; + width: 36px !important; + } + .saibar-landing-root .reporting-step-icon { display: none !important; } + .saibar-landing-root .reporting-step h3 { font-size: 1rem !important; margin: 6px 0 2px !important; } + .saibar-landing-root .reporting-step p { font-size: 0.9rem !important; margin: 0 !important; } + .saibar-landing-root .reporting-cta > div:last-child { margin-top: 20px !important; } + .saibar-landing-root .reporting-cta > div:last-child .landing-button { justify-content: center; width: 100%; box-sizing: border-box; } + + /* FAQ */ + /* Margin bawah ditangani .guide-section; tanpa ini jarak ke footer dobel. */ + .saibar-landing-root .landing-faq-grid { gap: 16px !important; margin-bottom: 0 !important; } + .saibar-landing-root .landing-faq-grid [role="region"] > div { padding: 2px 18px 18px !important; font-size: 0.95rem !important; } + .saibar-landing-root .landing-faq-toggle { padding: 16px 18px !important; } + .saibar-landing-root .landing-faq-toggle strong { font-size: 0.98rem !important; } +} diff --git a/frontend/src/shared/components/AppShell.tsx b/frontend/src/shared/components/AppShell.tsx index 33ba742..d03f55f 100644 --- a/frontend/src/shared/components/AppShell.tsx +++ b/frontend/src/shared/components/AppShell.tsx @@ -7,8 +7,7 @@ import { useToast } from "./Toast"; import { api } from "../api/client"; import { roleLabels } from "../constants/roles"; import { clearSession, getCurrentUser, isLoggedIn } from "../auth/session"; -import { useTheme } from "../utils/useTheme"; -import { ThemeToggle } from "./ThemeToggle"; +import { ThemeToggleControl } from "./ThemeToggle"; const SIDEBAR_STORAGE_KEY = "saibar-sidebar"; @@ -47,7 +46,6 @@ export function AppShell({ active, title, subtitle, breadcrumbs, children, class const [isMobileSidebarOpen, setMobileSidebarOpen] = useState(false); const [isMoreMenuOpen, setIsMoreMenuOpen] = useState(false); const [isNotificationOpen, setNotificationOpen] = useState(false); - const { isDark: isDarkMode, toggleTheme } = useTheme(); const [notifications, setNotifications] = useState([]); const notificationRef = useRef(null); @@ -237,7 +235,7 @@ export function AppShell({ active, title, subtitle, breadcrumbs, children, class
- + {isUserLoggedIn ? (
); } + +/** + * Toggle tema yang menyimpan status temanya sendiri. Dipakai header landing & + * AppShell: saat tema berganti hanya tombol ini yang di-render ulang (di dalam + * flushSync transisi), bukan seluruh halaman — render ulang halaman penuh + * itulah yang membuat transisi tersendat di HP. + */ +export function ThemeToggleControl({ className }: { className?: string }) { + const { isDark, toggleTheme } = useTheme(); + return ; +} diff --git a/frontend/src/shared/utils/useTheme.ts b/frontend/src/shared/utils/useTheme.ts index a7d4f06..4fe74d5 100644 --- a/frontend/src/shared/utils/useTheme.ts +++ b/frontend/src/shared/utils/useTheme.ts @@ -54,10 +54,18 @@ export function useTheme() { return; } + // Selama tirai lingkaran membuka, tampilan baru adalah render "live": + // transisi warna CSS di puluhan elemen (transition: all, background, + // dsb.) ikut berjalan sehingga seluruh layar digambar ulang tiap frame. + // Dimatikan sementara — warna baru langsung jadi, tirai yang + // menganimasikan pergantiannya (tampilan akhirnya tetap sama). + const root = document.documentElement; + root.classList.add("theme-switching"); const transition = document.startViewTransition(() => { flushSync(() => setIsDark(next)); applyTheme(next); }); + void transition.finished.finally(() => root.classList.remove("theme-switching")); // Jari-jari sampai sudut layar terjauh dari titik asal. const radius = Math.hypot(