Skip to content

Commit 662e2bb

Browse files
Bikram GoleBikram Gole
authored andcommitted
Improve mobile layout, terminal glyph fallback, and pulse reliability
1 parent 6e6d073 commit 662e2bb

3 files changed

Lines changed: 172 additions & 13 deletions

File tree

index.html

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,22 @@ <h2>Neo Terminal ⚡</h2>
143143
<p>Type commands and control the page like a mini shell.</p>
144144
<div class="mini-terminal">
145145
<div class="mini-terminal-head">
146-
<p class="omp-row omp-row-top">    Neo    0ms </p>
147-
<p class="omp-row omp-row-mid">╭─ </p>
146+
<p class="omp-row omp-row-top">
147+
<span class="omp-nerd">    Neo    0ms </span>
148+
<span class="omp-fallback">[arch] Neo | OK | 0ms</span>
149+
</p>
150+
<p class="omp-row omp-row-mid">
151+
<span class="omp-nerd">╭─ </span>
152+
<span class="omp-fallback">~/home/neo</span>
153+
</p>
148154
</div>
149155
<div class="mini-terminal-screen">
150156
<div id="mini-terminal-output" class="mini-terminal-output" aria-live="polite"></div>
151157
<form id="mini-terminal-form" class="mini-terminal-form">
152-
<label for="mini-terminal-input">╰─❯</label>
158+
<label for="mini-terminal-input">
159+
<span class="omp-nerd">╰─❯</span>
160+
<span class="omp-fallback">$</span>
161+
</label>
153162
<input id="mini-terminal-input" type="text" placeholder="help" autocomplete="off" />
154163
</form>
155164
</div>

script.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ const THEME_STORAGE_KEY = "neoThemeVariant.v1";
109109
const ACTION_STORAGE_KEY = "neoAutoAction.v1";
110110
const HERO_TYPED_KEY = "neoHeroTyped.v1";
111111
const MINI_PROMPT = "╰─❯";
112+
const NERD_FONT_FAMILIES = [
113+
"JetBrainsMono Nerd Font",
114+
"FiraCode Nerd Font",
115+
"CaskaydiaCove Nerd Font",
116+
];
112117
const THEME_OPTIONS = [
113118
"neo",
114119
"mint",
@@ -461,7 +466,17 @@ function triggerPulseBackdrop(clientX = null, clientY = null) {
461466
layer.style.setProperty("--pulse-y", `${Math.round((y / height) * 100)}%`);
462467

463468
document.body.appendChild(layer);
464-
layer.addEventListener("animationend", () => layer.remove(), { once: true });
469+
470+
// Force animation start reliably on slower mobile browsers.
471+
requestAnimationFrame(() => {
472+
requestAnimationFrame(() => {
473+
layer.classList.add("is-active");
474+
});
475+
});
476+
477+
const cleanup = () => layer.remove();
478+
layer.addEventListener("animationend", cleanup, { once: true });
479+
window.setTimeout(cleanup, 1150);
465480
}
466481

467482
function playPulseSound(pulseCount = 1) {
@@ -512,6 +527,25 @@ function triggerPenguinPowerUp() {
512527
window.setTimeout(() => penguinAvatar.classList.remove("power-up"), 620);
513528
}
514529

530+
function applyTerminalFontFallbackMode() {
531+
const hasNerdFont = NERD_FONT_FAMILIES.some((family) => {
532+
if (!window?.document?.fonts?.check) return false;
533+
return window.document.fonts.check(`12px "${family}"`);
534+
});
535+
document.body.classList.toggle("no-nerd-font", !hasNerdFont);
536+
}
537+
538+
function initTerminalFontFallbackMode() {
539+
applyTerminalFontFallbackMode();
540+
if (window?.document?.fonts?.ready) {
541+
window.document.fonts.ready
542+
.then(() => applyTerminalFontFallbackMode())
543+
.catch(() => {
544+
// Ignore font readiness failures.
545+
});
546+
}
547+
}
548+
515549
function initPenguinDateBadge() {
516550
if (!penguinBelly) return;
517551

@@ -1534,6 +1568,7 @@ initPenguinDateBadge();
15341568
initThemeSwitcher();
15351569
initHeroTypewriters();
15361570
initBlackflagGunfire();
1571+
initTerminalFontFallbackMode();
15371572
initMiniTerminal();
15381573
initCommandPalette();
15391574
initPersonaQuiz();

styles.css

Lines changed: 124 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,9 @@ kbd {
10891089
font-family: "JetBrainsMono Nerd Font", "FiraCode Nerd Font", "CaskaydiaCove Nerd Font", "Courier New", monospace;
10901090
letter-spacing: 0.01em;
10911091
text-shadow: 0 0 10px rgba(96, 169, 255, 0.18);
1092+
white-space: nowrap;
1093+
overflow: hidden;
1094+
text-overflow: ellipsis;
10921095
}
10931096

10941097
.omp-row-top {
@@ -1101,6 +1104,25 @@ kbd {
11011104
font-size: 0.8rem;
11021105
}
11031106

1107+
.omp-fallback {
1108+
display: none;
1109+
}
1110+
1111+
body.no-nerd-font .omp-row,
1112+
body.no-nerd-font .mini-terminal-line,
1113+
body.no-nerd-font .mini-terminal-form label,
1114+
body.no-nerd-font .mini-terminal-form input {
1115+
font-family: "JetBrains Mono", "Fira Mono", "Menlo", "Consolas", "Courier New", monospace;
1116+
}
1117+
1118+
body.no-nerd-font .omp-nerd {
1119+
display: none;
1120+
}
1121+
1122+
body.no-nerd-font .omp-fallback {
1123+
display: inline;
1124+
}
1125+
11041126
.mini-terminal-output {
11051127
flex: 1;
11061128
min-height: 0;
@@ -2258,7 +2280,7 @@ body[data-theme="liquidglass"] .site-footer {
22582280
position: fixed;
22592281
inset: -16%;
22602282
pointer-events: none;
2261-
z-index: 32;
2283+
z-index: 52;
22622284
overflow: hidden;
22632285
opacity: 0;
22642286
background:
@@ -2267,7 +2289,6 @@ body[data-theme="liquidglass"] .site-footer {
22672289
radial-gradient(680px 460px at var(--pulse-x, 50%) var(--pulse-y, 35%), rgba(68, 130, 244, 0.26), transparent 78%);
22682290
mix-blend-mode: screen;
22692291
filter: blur(1px) saturate(132%);
2270-
animation: pulse-bg-wave 840ms cubic-bezier(0.16, 0.82, 0.27, 1) forwards;
22712292
}
22722293

22732294
.pulse-wave::after {
@@ -2282,6 +2303,13 @@ body[data-theme="liquidglass"] .site-footer {
22822303
box-shadow: 0 0 16px rgba(122, 186, 255, 0.62), 0 0 28px rgba(255, 158, 74, 0.35);
22832304
transform: translate(-50%, -50%) scale(0.34);
22842305
opacity: 0;
2306+
}
2307+
2308+
.pulse-wave.is-active {
2309+
animation: pulse-bg-wave 840ms cubic-bezier(0.16, 0.82, 0.27, 1) forwards;
2310+
}
2311+
2312+
.pulse-wave.is-active::after {
22852313
animation: pulse-ring 840ms ease-out forwards;
22862314
}
22872315

@@ -2343,27 +2371,71 @@ body.istj-mode .egg-btn {
23432371
color: var(--orange-2);
23442372
}
23452373

2374+
@media (max-width: 980px) {
2375+
.site-header,
2376+
main,
2377+
.site-footer {
2378+
width: min(1200px, calc(100vw - 2rem));
2379+
}
2380+
2381+
.hero,
2382+
.panel {
2383+
padding: 0.74rem;
2384+
}
2385+
}
2386+
23462387
@media (max-width: 760px) {
2388+
.site-header,
2389+
main,
2390+
.site-footer {
2391+
width: min(1200px, calc(100vw - 1.25rem));
2392+
}
2393+
23472394
.site-header {
23482395
top: 0.34rem;
23492396
padding: 0.4rem;
2350-
flex-direction: column;
2351-
align-items: flex-start;
2397+
flex-wrap: wrap;
2398+
align-items: center;
2399+
gap: 0.45rem;
2400+
}
2401+
2402+
.brand-name {
2403+
font-size: 0.9rem;
2404+
}
2405+
2406+
nav a {
2407+
padding: 0.24rem 0.48rem;
2408+
font-size: 0.78rem;
23522409
}
23532410

23542411
nav {
2355-
width: 100%;
2412+
width: auto;
2413+
flex: 1 1 auto;
23562414
}
23572415

23582416
.header-tools {
2359-
width: 100%;
2360-
justify-content: flex-end;
2417+
width: auto;
2418+
margin-left: 0;
23612419
}
23622420

23632421
.hero-grid {
23642422
grid-template-columns: 1fr;
23652423
}
23662424

2425+
.hero,
2426+
.panel {
2427+
padding: 0.68rem;
2428+
}
2429+
2430+
h1 {
2431+
font-size: clamp(1.35rem, 8vw, 1.95rem);
2432+
}
2433+
2434+
.subtitle,
2435+
.panel p {
2436+
font-size: 0.8rem;
2437+
}
2438+
23672439
.btn,
23682440
.egg-btn {
23692441
width: 100%;
@@ -2390,8 +2462,21 @@ body.istj-mode .egg-btn {
23902462
margin-top: 6vh;
23912463
}
23922464

2393-
.mini-terminal-form {
2394-
grid-template-columns: auto 1fr;
2465+
.mini-terminal {
2466+
padding: 0.48rem;
2467+
}
2468+
2469+
.mini-terminal-screen {
2470+
height: 196px;
2471+
}
2472+
2473+
.mini-terminal-form input,
2474+
.mini-terminal-line {
2475+
font-size: 0.74rem;
2476+
}
2477+
2478+
.mini-terminal-hint {
2479+
font-size: 0.71rem;
23952480
}
23962481

23972482
.theme-grid {
@@ -2406,3 +2491,33 @@ body.istj-mode .egg-btn {
24062491
grid-template-columns: 1fr;
24072492
}
24082493
}
2494+
2495+
@media (max-width: 520px) {
2496+
.site-header,
2497+
main,
2498+
.site-footer {
2499+
width: calc(100vw - 0.9rem);
2500+
}
2501+
2502+
.site-header {
2503+
top: 0.24rem;
2504+
padding: 0.34rem;
2505+
}
2506+
2507+
.theme-top-label {
2508+
display: none;
2509+
}
2510+
2511+
.theme-top-select {
2512+
max-width: 10.2rem;
2513+
}
2514+
2515+
.mini-terminal-screen {
2516+
height: 178px;
2517+
}
2518+
2519+
.hero-actions,
2520+
.control-row {
2521+
gap: 0.3rem;
2522+
}
2523+
}

0 commit comments

Comments
 (0)