import React, { useState } from "react"; import TextInput from "@/components/TextInput"; import { HexColorPicker } from "react-colorful"; import { CollectionIncludingMembersAndLinkCount } from "@/types/global"; import Modal from "../Modal"; import { useTranslation } from "next-i18next"; import { useUpdateCollection } from "@/hooks/store/collections"; type Props = { onClose: Function; activeCollection: CollectionIncludingMembersAndLinkCount; }; export default function EditCollectionModal({ onClose, activeCollection, }: Props) { const { t } = useTranslation(); const [collection, setCollection] = useState(activeCollection); const [submitLoader, setSubmitLoader] = useState(false); const updateCollection = useUpdateCollection(); const submit = async () => { if (!submitLoader) { setSubmitLoader(true); if (!collection) return null; setSubmitLoader(true); await updateCollection.mutateAsync(collection, { onSuccess: () => { onClose(); }, }); setSubmitLoader(false); } }; return (

{t("edit_collection_info")}

{t("name")}

setCollection({ ...collection, name: e.target.value }) } />

{t("color")}

setCollection({ ...collection, color }) } />
setCollection({ ...collection, color: "#0ea5e9" }) } > {t("reset")}

{t("description")}