feat(platform): make mobile workflows task focused

This commit is contained in:
lingniu
2026-07-16 12:05:01 +08:00
parent 6d82a66d68
commit 069b324565
8 changed files with 227 additions and 13 deletions

View File

@@ -0,0 +1,15 @@
import { useEffect, useState } from 'react';
export function useMobileLayout(maxWidth = 680) {
const query = `(max-width: ${maxWidth}px)`;
const [mobile, setMobile] = useState(() => typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(query).matches);
useEffect(() => {
if (typeof window.matchMedia !== 'function') return;
const media = window.matchMedia(query);
const update = () => setMobile(media.matches);
media.addEventListener('change', update);
update();
return () => media.removeEventListener('change', update);
}, [query]);
return mobile;
}