import { View } from "@tarojs/components";
import BottomBar from "@/components/BottomBar";
import PageCustom from "@/components/page-custom/index";
import NavBarNormal from "@/components/NavBarNormal/index";
import editorStyle from "../editor.module.less";

import { useAgentStore } from "@/store/agentStore";
import WemetaTextarea from "@/components/wemeta-textarea/index";
import useEditContactCard from "@/hooks/useEditContactCard";
export default function Index() {
  const agentCard = useAgentStore((state) => state.agentContactCard);
  const { value, onChange, handleSubmit } = useEditContactCard(
    "mobile",
    agentCard?.mobile
  );

  return (
    <PageCustom>
      <NavBarNormal backText="手机号码"></NavBarNormal>
      <View className="flex flex-col items-center w-full">
        <View className="w-full p-16">
          <WemetaTextarea
            value={value}
            onBlur={(value: string) => onChange(value)}
            onInput={(value: string) => onChange(value)}
            placeholder="填写手机号码"
            autoFocus
          />
        </View>

        <BottomBar>
          <View
            className="button-rounded button-primary flex-1"
            onClick={handleSubmit}
          >
            保存
          </View>
        </BottomBar>
      </View>
    </PageCustom>
  );
}
