feat: update mobile app view styles and improve touch handling for back navigation
Deploy / deploy (push) Successful in 13s

This commit is contained in:
M1ngdaXie
2026-05-31 17:15:06 +08:00
parent f6a21d8084
commit 037f0b5fc8
2 changed files with 24 additions and 24 deletions
+17 -8
View File
@@ -1,6 +1,9 @@
.mobile-app-view { .mobile-app-view {
position: fixed; position: fixed;
inset: 0; top: var(--mobile-statusbar-height);
left: 0;
right: 0;
bottom: 0;
background: #0d0d1a; background: #0d0d1a;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -20,15 +23,21 @@
.mobile-back-btn { .mobile-back-btn {
font-family: var(--font-mono); font-family: var(--font-mono);
font-size: 10px; font-size: 11px;
color: var(--pixel-cyan); color: #0d0d1a;
letter-spacing: 0.5px; background: var(--pixel-cyan);
border: 2px solid var(--pixel-cyan);
box-shadow: 2px 2px 0 #000;
padding: 4px 10px;
cursor: pointer; cursor: pointer;
background: none; letter-spacing: 0.5px;
border: none;
padding: 0;
-webkit-tap-highlight-color: transparent;
flex-shrink: 0; flex-shrink: 0;
-webkit-tap-highlight-color: transparent;
}
.mobile-back-btn:active {
box-shadow: none;
transform: translate(2px, 2px);
} }
.mobile-app-title { .mobile-app-title {
+7 -16
View File
@@ -10,22 +10,12 @@ interface Props {
export default function MobileAppView({ appId, onBack }: Props) { export default function MobileAppView({ appId, onBack }: Props) {
const app = APPS.find(a => a.id === appId); const app = APPS.find(a => a.id === appId);
const dragStartY = useRef<number | null>(null); const touchStartY = useRef<number | null>(null);
if (!app) return null; if (!app) return null;
const AppComponent = app.component; const AppComponent = app.component;
function handleDragStart(y: number) {
dragStartY.current = y;
}
function handleDragEnd(y: number) {
if (dragStartY.current === null) return;
if (y - dragStartY.current > 60) onBack();
dragStartY.current = null;
}
return ( return (
<motion.div <motion.div
className="mobile-app-view" className="mobile-app-view"
@@ -33,14 +23,15 @@ export default function MobileAppView({ appId, onBack }: Props) {
animate={{ x: 0 }} animate={{ x: 0 }}
exit={{ x: '100%' }} exit={{ x: '100%' }}
transition={{ duration: 0.22, ease: 'easeOut' }} transition={{ duration: 0.22, ease: 'easeOut' }}
onTouchStart={e => handleDragStart(e.touches[0].clientY)} onTouchStart={e => { touchStartY.current = e.touches[0].clientY; }}
onTouchEnd={e => handleDragEnd(e.changedTouches[0].clientY)} onTouchEnd={e => {
onMouseDown={e => handleDragStart(e.clientY)} if (touchStartY.current !== null && e.changedTouches[0].clientY - touchStartY.current > 60) onBack();
onMouseUp={e => handleDragEnd(e.clientY)} touchStartY.current = null;
}}
> >
<div className="mobile-app-topbar"> <div className="mobile-app-topbar">
<button className="mobile-back-btn" onClick={onBack}> <button className="mobile-back-btn" onClick={onBack}>
back HOME
</button> </button>
<span className="mobile-app-title">{app.title}</span> <span className="mobile-app-title">{app.title}</span>
<span className="mobile-app-topbar-spacer" /> <span className="mobile-app-topbar-spacer" />