From 34598997e298bd17c54ee640c360ed1c27331a61 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sun, 5 Mar 2023 18:41:08 +0300 Subject: [PATCH] Added toasts for Updatable Token Metadata toggle --- .../creation/CollectionDetails.tsx | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/components/collections/creation/CollectionDetails.tsx b/components/collections/creation/CollectionDetails.tsx index 8f0670f..13dbd65 100644 --- a/components/collections/creation/CollectionDetails.tsx +++ b/components/collections/creation/CollectionDetails.tsx @@ -10,7 +10,7 @@ import { useInputState } from 'components/forms/FormInput.hooks' import { InputDateTime } from 'components/InputDateTime' import { Tooltip } from 'components/Tooltip' import type { ChangeEvent } from 'react' -import { useEffect, useState } from 'react' +import { useEffect, useRef, useState } from 'react' import { toast } from 'react-hot-toast' import { TextInput } from '../../forms/FormInput' @@ -41,6 +41,8 @@ export const CollectionDetails = ({ onChange, uploadMethod, coverImageUrl, minte const [explicit, setExplicit] = useState(false) const [updatable, setUpdatable] = useState(false) + const initialRender = useRef(true) + const nameState = useInputState({ id: 'name', name: 'name', @@ -114,6 +116,22 @@ export const CollectionDetails = ({ onChange, uploadMethod, coverImageUrl, minte reader.readAsArrayBuffer(event.target.files[0]) } + useEffect(() => { + if (initialRender.current) { + initialRender.current = false + } else if (updatable) { + toast.success('Token metadata will be updatable upon collection creation.', { + style: { maxWidth: 'none' }, + icon: '✅📝', + }) + } else { + toast.error('Token metadata will not be updatable upon collection creation.', { + style: { maxWidth: 'none' }, + icon: '⛔🔏', + }) + } + }, [updatable]) + return (