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

  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>
  );
}
