Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

599 B
Raw Blame
import { useSyncExternalStore } from 'react';

// True on phone-width viewports, matching the app's Tailwind `sm` breakpoint
// (640px). Below it the project views disable drag so a touch scrolls the list.
const QUERY = '(max-width: 639px)';

function subscribe(onChange: () => void): () => void {
  const mql = window.matchMedia(QUERY);
  mql.addEventListener('change', onChange);
  return () => mql.removeEventListener('change', onChange);
}

export function useIsPhone(): boolean {
  return useSyncExternalStore(
    subscribe,
    () => window.matchMedia(QUERY).matches,
    () => false,
  );
}