stargaze-studio/contexts/collection.ts
Serkan Reis 7740841168
Upload assets and metadata (#4)
* Initial preview & upload logic

* Refactor image & metadata selection & preview logic

* Refactor image & metadata selection & preview logic - 2

* Establish metadata-modal connection

* Metadata attribute manipulation

* Successful metadata attribute removal & update

* Successful metadata attribute addition & update

* Update existing attributes success

* Display image uri among metadata following the upload

* Fix: buttons being displayed without an image overlay

* Separate upload logic & incorporate useRefs

* Clean up: removed unused imports and structures

* Add radio buttons for upload service selection

* Remove package-lock.json (duplicate .lock files)

* Refactor upload logic & metadata modal

* Utilize serviceType enum in upload logic

* Utilize serviceType enum in upload logic - 2

* Implement user input for NFT.Storage & Pinata API keys

* Update use an existing URI text

* Remove upload_old.tsx

* Fix: reset main metadata fields on metadata modal refresh

* Fix: reset main metadata fields on metadata modal refresh - 2

* Make linter happy

* Make linter happy - 2

* Move upload file under collections

* Post-review update - 1

* Source Pinata endpoint URL from environment variables

* Replace regular file arrays with states

Co-authored-by: findolor <anakisci@gmail.com>
2022-07-28 16:38:43 +03:00

60 lines
1.5 KiB
TypeScript

import create from 'zustand'
export const useCollectionStore = create(() => ({
name: 'Example',
base_token_uri: '',
description: 'Lorem',
image: 'ipfs://bafybeigi3bwpvyvsmnbj46ra4hyffcxdeaj6ntfk5jpic5mx27x6ih2qvq/images/1.png',
external_image: '',
num_tokens: 10,
per_address_limit: 1,
start_time: '1650982532000000000',
symbol: 'EXP',
unit_price: 50,
whitelist: '',
}))
export const setName = (value: string) => {
useCollectionStore.setState({ name: value })
}
export const setBaseTokenUri = (value: string) => {
useCollectionStore.setState({ base_token_uri: value })
}
export const setDescription = (value: string) => {
useCollectionStore.setState({ description: value })
}
export const setImage = (value: string) => {
useCollectionStore.setState({ image: value })
}
export const setExternalImage = (value: string) => {
useCollectionStore.setState({ external_image: value })
}
export const setNumTokens = (value: number) => {
useCollectionStore.setState({ num_tokens: value })
}
export const setPerAddressLimit = (value: number) => {
useCollectionStore.setState({ per_address_limit: value })
}
export const setStartTime = (value: string) => {
useCollectionStore.setState({ start_time: value })
}
export const setSymbol = (value: string) => {
useCollectionStore.setState({ symbol: value })
}
export const setUnitPrice = (value: number) => {
useCollectionStore.setState({ unit_price: value })
}
export const setWhitelist = (value: string) => {
useCollectionStore.setState({ whitelist: value })
}