import { ChangeEvent } from "react"; import StyledContainer from "./StyledContainer"; import Input from "../../../common/component/styled/Input"; import Textarea from "../../../common/component/styled/Textarea"; import Toggle from "../../../common/component/styled/Toggle"; import Label from "../../../common/component/styled/Label"; import SaveTip from "../../../common/component/SaveTip"; import useConfig from "../../../common/hook/useConfig"; import { FirebaseConfig } from "../../../types/server"; import { useTranslation } from "react-i18next"; export default function ConfigFirebase() { const { t } = useTranslation("setting"); const { values, toggleEnable, updateConfig, setValues, reset, changed } = useConfig("firebase"); const handleUpdate = () => { // const { token_url, description } = values; updateConfig(values); }; const handleChange = (evt: ChangeEvent) => { const newValue = evt.target.value; const { type = "" } = evt.target.dataset; setValues((prev) => { if (!prev) return prev; return { ...prev, [type]: newValue }; }); }; if (!values) return null; const { token_url, project_id, private_key, client_email, enabled = false } = values as FirebaseConfig; return (