Skip to content

Commit c87638c

Browse files
Optimize mobile experience
1 parent a9efffa commit c87638c

3 files changed

Lines changed: 35 additions & 11 deletions

File tree

src/app/globals.css

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -579,18 +579,36 @@ textarea {
579579
}
580580

581581
@media (max-width: 960px) {
582+
.hero-shell {
583+
min-height: 170vh;
584+
}
585+
582586
.fixed-menu {
583-
top: 16px;
584-
left: 16px;
587+
top: 14px;
588+
left: 14px;
589+
}
590+
591+
.menu-button {
592+
width: 34px;
593+
height: 34px;
594+
font-size: 12px;
585595
}
586596

587597
.hero-overlay {
588-
left: 24px;
589-
bottom: 24px;
598+
left: 18px;
599+
bottom: 18px;
590600
}
591601

592602
.content-section {
593-
padding: 80px 8vw 60px;
603+
padding: 64px 8vw 52px;
604+
}
605+
606+
.hero-name {
607+
font-size: 22px;
608+
}
609+
610+
.hero-role {
611+
font-size: 10px;
594612
}
595613
}
596614

src/components/hero/HeroScene.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ function SceneContent({
304304
<hemisphereLight args={["#f2d3aa", "#120b06", lights.hemi]} />
305305
<directionalLight
306306
position={[5, 6, 3]}
307-
intensity={lights.directional}
307+
intensity={isMobile ? lights.directional * 0.7 : lights.directional}
308308
castShadow={!isMobile}
309309
shadow-mapSize-width={1024}
310310
shadow-mapSize-height={1024}
@@ -323,13 +323,13 @@ function SceneContent({
323323
<PlaceholderComputer devSettings={devSettings} terminalApi={terminalApi} />
324324
)}
325325
</group>
326-
<Environment preset="city" />
326+
{isMobile ? null : <Environment preset="city" />}
327327
<OrbitControls
328328
enableZoom={Boolean(devSettings)}
329329
enablePan={Boolean(devSettings)}
330330
enabled={!isMobile}
331331
autoRotate
332-
autoRotateSpeed={isMobile ? 0.2 : 0.4}
332+
autoRotateSpeed={isMobile ? 0.15 : 0.4}
333333
/>
334334
<mesh
335335
onPointerDown={(event) => {
@@ -351,9 +351,10 @@ export default function HeroScene(props: HeroSceneProps) {
351351
const isMobile = useMediaQuery("(max-width: 900px)");
352352
return (
353353
<Canvas
354-
dpr={isMobile ? [1, 1.2] : [1, 1.6]}
354+
dpr={isMobile ? [1, 1.1] : [1, 1.6]}
355355
camera={{ position: [0.2, 0.8, 3.6], fov: 42 }}
356356
gl={{ antialias: !isMobile, powerPreference: "high-performance" }}
357+
shadows={!isMobile}
357358
style={{ width: "100%", height: "100%" }}
358359
>
359360
<SceneContent {...props} />

src/components/terminal/TerminalCanvas.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export default function TerminalCanvas({
152152
const historyIndexRef = useRef(-1);
153153
const inputRef = useRef("");
154154
const scrollOffsetRef = useRef(0);
155+
const lastDrawRef = useRef(0);
155156
const focusedRef = useRef(false);
156157
const cwdRef = useRef("/");
157158
const fsRef = useRef<FsNode>(buildFileTree(files));
@@ -538,12 +539,16 @@ export default function TerminalCanvas({
538539
useEffect(() => {
539540
let rafId = 0;
540541
const drawLoop = () => {
541-
drawTerminal();
542+
const now = performance.now();
543+
if (!isMobile || now - lastDrawRef.current > 33) {
544+
drawTerminal();
545+
lastDrawRef.current = now;
546+
}
542547
rafId = requestAnimationFrame(drawLoop);
543548
};
544549
drawLoop();
545550
return () => cancelAnimationFrame(rafId);
546-
}, [drawTerminal]);
551+
}, [drawTerminal, isMobile]);
547552

548553
return <canvas ref={canvasRef} className="terminal-canvas" />;
549554
}

0 commit comments

Comments
 (0)