From 316746a895d6cfdc0cb83bf0c88fb34c976328ac Mon Sep 17 00:00:00 2001 From: Derek Mackley Date: Sat, 21 Nov 2026 08:57:19 -0600 Subject: [PATCH] fit the cyber map card on phones and stop paint-heavy animations burning CPU --- .../atoms/ProfileAvatar/ProfileAvatar.css | 6 +- .../layout/Background/Background.css | 2 - .../layout/Navigation/Navigation.tsx | 4 +- .../GithubProfileCard/GithubProfileCard.css | 16 +- .../molecules/MapComponent/MapComponent.css | 319 ++++++++++-------- .../molecules/MapComponent/MapComponent.tsx | 1 + .../molecules/MapComponent/MapParts.tsx | 33 +- .../molecules/MapComponent/useLeafletMap.ts | 19 ++ .../ProfileContent/ProfileContent.css | 6 +- .../ProfileLocation/ProfileLocation.css | 67 ++-- .../ProfileLocation/ProfileLocation.tsx | 2 +- .../molecules/SkillCard/SkillCard.css | 2 - .../molecules/Timeline/Timeline.css | 61 +++- .../molecules/Timeline/Timeline.tsx | 59 ++-- .../molecules/Timeline/TimelineCard.css | 20 +- .../molecules/Timeline/TimelineCard.tsx | 12 +- .../organisms/ConsoleHeader/ConsoleHeader.css | 2 +- .../organisms/Experience/Experience.css | 9 +- .../organisms/Greetings/Greetings.css | 12 + 19 files changed, 396 insertions(+), 256 deletions(-) diff --git a/src/components/atoms/ProfileAvatar/ProfileAvatar.css b/src/components/atoms/ProfileAvatar/ProfileAvatar.css index 8260415d..5d5b4da7 100644 --- a/src/components/atoms/ProfileAvatar/ProfileAvatar.css +++ b/src/components/atoms/ProfileAvatar/ProfileAvatar.css @@ -55,10 +55,10 @@ } /* Responsive adjustments */ -@media (max-width: 480px) { +@media (max-width: 640px) { .profile-avatar__image { - width: 120px; - height: 120px; + width: 96px; + height: 96px; } .profile-avatar__clearance { diff --git a/src/components/layout/Background/Background.css b/src/components/layout/Background/Background.css index 2b5e7666..5236d4fa 100644 --- a/src/components/layout/Background/Background.css +++ b/src/components/layout/Background/Background.css @@ -33,8 +33,6 @@ html, body { overflow: hidden; background-color: var(--color-background); z-index: 0; - /* Apply will-change judiciously */ - will-change: opacity; } /* Vignette effect - optimized to reduce gradient complexity */ diff --git a/src/components/layout/Navigation/Navigation.tsx b/src/components/layout/Navigation/Navigation.tsx index 76efd1bc..a394b5e4 100644 --- a/src/components/layout/Navigation/Navigation.tsx +++ b/src/components/layout/Navigation/Navigation.tsx @@ -27,9 +27,9 @@ const Navigation = () => { return ( setTileMode((mode) => (mode === 'dark' ? 'light' : 'dark'))} gridVisible={gridVisible} tileMode={tileMode} + animated={motionOn} /> diff --git a/src/components/molecules/MapComponent/MapParts.tsx b/src/components/molecules/MapComponent/MapParts.tsx index 1120e48a..d351b0bc 100644 --- a/src/components/molecules/MapComponent/MapParts.tsx +++ b/src/components/molecules/MapComponent/MapParts.tsx @@ -1,4 +1,5 @@ import { motion, type Variants } from 'framer-motion'; +import { FaCrosshairs, FaMinus, FaPlus, FaTh } from 'react-icons/fa'; import ClusterStatus from '@molecules/ClusterStatus'; import type { ClusterStatusResult } from '@/types/cluster'; import type { MapTileMode } from './useLeafletMap'; @@ -52,42 +53,48 @@ export interface MapControlsBarProps { gridVisible: boolean; /** Current tile mode; the tiles button offers the other one */ tileMode: MapTileMode; + /** Whether the light-map button glows */ + animated?: boolean; } -/** The row of map controls under the map. */ -export const MapControlsBar = ({ onZoomIn, onZoomOut, onRecenter, onToggleGrid, onToggleTiles, gridVisible, tileMode }: MapControlsBarProps) => ( +/** + * The row of map controls under the map. On wide screens each button reads + * `[Label]`; on phones the same buttons show an icon and a short label and + * wrap into one compact toolbar of 44px targets. + */ +export const MapControlsBar = ({ onZoomIn, onZoomOut, onRecenter, onToggleGrid, onToggleTiles, gridVisible, tileMode, animated = true }: MapControlsBarProps) => (
Controls: Zoom
|
{tileMode === 'dark' ? '☀ LIGHT MAP' : '☾ DARK MAP'} diff --git a/src/components/molecules/MapComponent/useLeafletMap.ts b/src/components/molecules/MapComponent/useLeafletMap.ts index 895aa5d7..c3bba1e8 100644 --- a/src/components/molecules/MapComponent/useLeafletMap.ts +++ b/src/components/molecules/MapComponent/useLeafletMap.ts @@ -29,6 +29,19 @@ const RINGS: Array<{ radius: number; options: L.CircleMarkerOptions }> = [ { radius: 100000, options: { color: `rgba(${RING_COLOR}, 0.2)`, fillColor: `rgba(${RING_COLOR}, 0.02)`, fillOpacity: 0.1, weight: 1, dashArray: '3, 7' } }, ]; +/** + * True on touch-first devices. There a one-finger swipe on the map must scroll + * the page, so the map's own drag and pinch handlers are left off and the + * zoom buttons are the way to zoom. + */ +const isTouchFirst = (): boolean => { + try { + return Boolean(L.Browser.mobile) || (typeof window.matchMedia === 'function' && window.matchMedia('(pointer: coarse)').matches); + } catch { + return false; + } +}; + const el = (tag: string, className: string, text?: string): HTMLElement => { const node = document.createElement(tag); node.className = className; @@ -98,8 +111,12 @@ const useLeafletMap = (containerRef: RefObject, view: MapVie if (!container) return undefined; let map: L.Map; + const touchFirst = isTouchFirst(); try { map = L.map(container, { + dragging: !touchFirst, + touchZoom: !touchFirst, + doubleClickZoom: !touchFirst, center: [0, 0], zoom: 2, scrollWheelZoom: false, @@ -112,6 +129,7 @@ const useLeafletMap = (containerRef: RefObject, view: MapVie setError(`Error initializing map: ${cause instanceof Error ? cause.message : String(cause)}`); return undefined; } + if (touchFirst) container.classList.add('map--page-scroll'); L.control.attribution({ position: 'bottomright', prefix: 'Map by Leaflet' }).addTo(map); mapRef.current = map; setReady(true); @@ -123,6 +141,7 @@ const useLeafletMap = (containerRef: RefObject, view: MapVie return () => { observer?.disconnect(); + container.classList.remove('map--page-scroll'); map.remove(); mapRef.current = null; tilesRef.current = null; diff --git a/src/components/molecules/ProfileContent/ProfileContent.css b/src/components/molecules/ProfileContent/ProfileContent.css index be6c9c62..97ca8f4f 100644 --- a/src/components/molecules/ProfileContent/ProfileContent.css +++ b/src/components/molecules/ProfileContent/ProfileContent.css @@ -71,6 +71,10 @@ } .profile-content__contact { - margin-top: var(--spacing-6); + margin-top: var(--spacing-4); + } + + .profile-content { + margin-bottom: var(--spacing-2); } } \ No newline at end of file diff --git a/src/components/molecules/ProfileLocation/ProfileLocation.css b/src/components/molecules/ProfileLocation/ProfileLocation.css index 823a82ac..5be01dd4 100644 --- a/src/components/molecules/ProfileLocation/ProfileLocation.css +++ b/src/components/molecules/ProfileLocation/ProfileLocation.css @@ -219,62 +219,57 @@ } /* Responsive Design */ +.refresh-btn { + position: relative; +} + @media (max-width: 768px) { .profile-location { font-size: 12px; } +} - .profile-location__system-status, - .profile-location__security-footer { - padding: 6px 12px; - font-size: 11px; - } - - .system-label, - .metric-label { - font-size: 10px; +/* Phones: the status bar is two tidy rows (system and live controls, then the + place) instead of a column of fragments; the button keeps a 44px hit area. */ +@media (max-width: 640px) { + .profile-location { + margin-bottom: var(--spacing-4); } - .metric-value { - font-size: 10px; + .profile-location__system-status { + padding: 6px 10px; + font-size: 11px; + gap: 4px 8px; } .status-left { - flex-direction: column; - align-items: flex-start; - gap: 4px; + flex: 1 1 0; + min-width: 0; + gap: 0 6px; } - .refresh-btn { - padding: 2px 4px; - font-size: 10px; - } -} - -@media (max-width: 480px) { - .profile-location { - font-size: 11px; - margin-bottom: var(--spacing-4); + .profile-location__system-status .separator { + display: none; } - .profile-location__system-status, - .profile-location__security-footer { - padding: 4px 8px; - font-size: 10px; + .profile-location__place { + flex-basis: 100%; + overflow-wrap: anywhere; } - .system-label, - .metric-label { - font-size: 9px; + .system-label { + margin-right: 0; } - .metric-value { - font-size: 9px; + .refresh-btn { + padding: 2px 6px; + font-size: 10px; } - .refresh-btn { - padding: 1px 3px; - font-size: 9px; + .refresh-btn::after { + content: ''; + position: absolute; + inset: -10px -6px; } } diff --git a/src/components/molecules/ProfileLocation/ProfileLocation.tsx b/src/components/molecules/ProfileLocation/ProfileLocation.tsx index 8e89a1de..b3e846d3 100644 --- a/src/components/molecules/ProfileLocation/ProfileLocation.tsx +++ b/src/components/molecules/ProfileLocation/ProfileLocation.tsx @@ -58,7 +58,7 @@ const ProfileLocation = ({ location = 'Canton, GA', variant = 'default', animate SECURITY SYSTEM: {STATUS_TEXT[variant]} | - Location: {location} + Location: {location}
[{isLive ? 'LIVE' : 'OFF'}] diff --git a/src/components/molecules/SkillCard/SkillCard.css b/src/components/molecules/SkillCard/SkillCard.css index aab37039..8316f09d 100644 --- a/src/components/molecules/SkillCard/SkillCard.css +++ b/src/components/molecules/SkillCard/SkillCard.css @@ -26,7 +26,6 @@ 0 0 12px rgba(var(--color-cyan-rgb), 0.1), inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.12), inset 0 -1px 0 rgba(var(--color-cyan-rgb), 0.05); - backdrop-filter: blur(12px); height: 100%; position: relative; cursor: pointer; @@ -204,7 +203,6 @@ 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 8px rgba(var(--color-cyan-rgb), 0.25), inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.1); - backdrop-filter: blur(6px); z-index: 2; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); /* Subtle pulse animation to draw attention */ diff --git a/src/components/molecules/Timeline/Timeline.css b/src/components/molecules/Timeline/Timeline.css index 74328d88..fa458596 100644 --- a/src/components/molecules/Timeline/Timeline.css +++ b/src/components/molecules/Timeline/Timeline.css @@ -78,7 +78,33 @@ ); box-shadow: 0 0 10px rgba(100, 255, 218, 0.5); transform-origin: top; - animation: pulseGlow 3s ease-in-out infinite; + --glow-rgb: 100, 255, 218; + --glow-duration: 3s; +} + +/* The line's glow pulses as opacity on a pseudo-element. Animating box-shadow + itself repaints the full-height line on every frame. */ +.timeline__line::after { + content: ''; + position: absolute; + inset: 0; + pointer-events: none; + box-shadow: 0 0 20px rgba(var(--glow-rgb), 0.8); + opacity: 0.3; + will-change: opacity; + animation: timelineGlow var(--glow-duration) ease-in-out infinite; +} + +@keyframes timelineGlow { + 0%, 100% { opacity: 0.3; } + 50% { opacity: 1; } +} + +/* Off screen, or reduced motion: the looping CSS effects hold still */ +.timeline--idle *, +.timeline--idle *::before, +.timeline--idle *::after { + animation-play-state: paused !important; } /* Enhanced data particles */ @@ -156,7 +182,23 @@ box-shadow: 0 0 0 4px rgba(100, 255, 218, 0.4), 0 0 20px rgba(100, 255, 218, 0.6); - animation: pulseGlow 2s ease-in-out infinite; +} + +.timeline__node { + position: relative; +} + +/* Active node glow pulses as opacity on a pseudo-element */ +.timeline__node--active::after { + content: ''; + position: absolute; + inset: -2px; + border-radius: 50%; + pointer-events: none; + box-shadow: 0 0 24px rgba(var(--glow-rgb, 100, 255, 218), 0.9); + opacity: 0.2; + will-change: opacity; + animation: timelineGlow 2s ease-in-out infinite; } /* Pulse rings for active nodes */ @@ -259,6 +301,7 @@ rgba(34, 197, 94, 0.8) 100% ); box-shadow: 0 0 10px rgba(34, 197, 94, 0.5); + --glow-rgb: 34, 197, 94; } .timeline--secure .timeline__node--active { @@ -281,7 +324,8 @@ rgba(239, 68, 68, 0.8) 100% ); box-shadow: 0 0 10px rgba(239, 68, 68, 0.5); - animation: pulseGlow 1s ease-in-out infinite; + --glow-rgb: 239, 68, 68; + --glow-duration: 1s; } .timeline--breach .timeline__node--active { @@ -316,7 +360,8 @@ rgba(251, 191, 36, 0.8) 100% ); box-shadow: 0 0 10px rgba(251, 191, 36, 0.5); - animation: pulseGlow 1.5s ease-in-out infinite; + --glow-rgb: 251, 191, 36; + --glow-duration: 1.5s; } .timeline--critical .timeline__node--active { @@ -343,8 +388,12 @@ box-shadow: 0 0 10px rgba(251, 191, 36, 0.5); } -/* Performance optimizations */ -.timeline * { +/* Performance: only the layers that actually move get promoted. Promoting + every descendant (as `.timeline *` did) cost a compositor layer per element. */ +.timeline__security-scan, +.timeline__hack-scanline, +.timeline__radar-sweep, +.timeline__matrix-column { will-change: transform; } diff --git a/src/components/molecules/Timeline/Timeline.tsx b/src/components/molecules/Timeline/Timeline.tsx index 4bcf9062..5108c4d3 100644 --- a/src/components/molecules/Timeline/Timeline.tsx +++ b/src/components/molecules/Timeline/Timeline.tsx @@ -1,5 +1,7 @@ import React, { useMemo } from 'react'; import { motion, Transition, Variants } from 'framer-motion'; +import useIntersectionObserver from '@hooks/useIntersectionObserver'; +import { useMotionEnabled } from '@utils/motion'; import TimelineCard from './TimelineCard'; import type { TimelineEffects, TimelineExperience } from './TimelineCard'; import './Timeline.css'; @@ -27,25 +29,22 @@ const loop = (duration: number, extra: Transition = {}): Transition => ({ durati interface TimelineNodeProps { active?: boolean; hack?: boolean; + /** Whether the looping effects run: false when off screen or motion is off */ + ambient?: boolean; } /** The node on the centre line for one entry, with pulse rings while its card is open. */ -const TimelineNode = ({ active, hack }: TimelineNodeProps) => ( +const TimelineNode = ({ active, hack, ambient = true }: TimelineNodeProps) => ( - {matrix && ( + {ambient && matrix && (