"use client";

import { useEffect } from "react";

/** iOS / iPad PWA 部分版本不识别 display-mode 媒体查询，用 data 属性兜底 */
export default function PwaDisplayMode() {
  useEffect(() => {
    const standalone =
      window.matchMedia("(display-mode: standalone)").matches ||
      (window.navigator as Navigator & { standalone?: boolean }).standalone ===
        true;

    if (standalone) {
      document.documentElement.dataset.displayMode = "standalone";
    }
  }, []);

  return null;
}
