"use client";

import React,{useState,useEffect} from "react";
import { Image ,Toast} from "antd-mobile";
import { get,save } from "@/utils/storeInfo";
export default function AddToHome() {
  const [firstLogin, setFirstLogin] = useState("0");
  useEffect(() => {
    if(!(("standalone" in window.navigator) && window.navigator.standalone)
    ){
      setFirstLogin(get("firstLogin"))
    }

  }, []);
  return (
    firstLogin=="1"?<div
      className="fixed top-0 z-[999] flex flex-col justify-end items-center h-screen w-screen bg-[#262626b0]"
      onClick={() => {save("firstLogin", 0);setFirstLogin("0")}}
    >
      <div className="font-bold text-xl mb-2 flex items-center">
        点击
        <Image
          fit="cover"
          // src={process.env.NEXT_PUBLIC_WEB_ASSETS_URL+"/icons/nodata.png"}
          src={"/icons/ios_share.png"}
          placeholder=""
          width={32}
          height={32}
        />
        添加到主屏幕
      </div>
      <Image
        fit="cover"
        // src={process.env.NEXT_PUBLIC_WEB_ASSETS_URL+"/icons/nodata.png"}
        src={"/images/addToHome.png"}
        placeholder=""
        width={54}
        height={54}
      />
    </div>:null
  );
}
