Skip to content

Commit

Permalink
🚸 Update default price
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Mar 12, 2024
1 parent 368471e commit e9ce8c3
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 32 deletions.
3 changes: 3 additions & 0 deletions constant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ export const CHAIN_EXPLORER_URL = IS_TESTNET ? 'https://node.testnet.like.co/cos
export const NFT_MARKETPLACE_URL = IS_TESTNET ? 'https://likecoin-nft-marketplace-testnet.netlify.app' : 'https://likecoin.github.io/likecoin-nft-marketplace'

export const ISCN_TOOLS_URL = IS_TESTNET ? 'https://likecoin-iscn-nft-tools-testnet.netlify.app' : 'https://likecoin.github.io/iscn-nft-tools'

export const MINIMAL_PRICE = 0.99
export const DEFAULT_PRICE = 4.99
10 changes: 4 additions & 6 deletions pages/nft-book-store/collection/new.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<div>
<div class="space-y-4">
<UFormGroup :label="`Price(USD) of this book collection (Minimal ${MINIMAL_PRICE} or free)`">
<UFormGroup :label="`Price(USD) of this book collection (Minimal ${MINIMAL_PRICE} or $0 (free))`">
<UInput v-model="price.price" type="number" step="0.01" :min="0" />
</UFormGroup>
Expand Down Expand Up @@ -330,7 +330,7 @@ import { MdEditor, ToolbarNames, config } from 'md-editor-v3'
import 'md-editor-v3/lib/style.css'
import DOMPurify from 'dompurify'
import { LCD_URL, LIKE_CO_API } from '~/constant'
import { DEFAULT_PRICE, MINIMAL_PRICE, LCD_URL, LIKE_CO_API } from '~/constant'
import { useBookStoreApiStore } from '~/stores/book-store-api'
import { useWalletStore } from '~/stores/wallet'
import { useNftStore } from '~/stores/nft'
Expand All @@ -350,8 +350,6 @@ const { getClassMetadataById, lazyFetchClassMetadataById } = nftStore
const router = useRouter()
const route = useRoute()
const MINIMAL_PRICE = 0.9
const error = ref('')
const isLoading = ref(false)
const connectStatus = ref<any>({})
Expand All @@ -371,7 +369,7 @@ const classIdInput = ref('')
const classIds = ref<string[]>([])
const defaultPaymentCurrency = ref('USD')
const price = ref({
price: MINIMAL_PRICE,
price: DEFAULT_PRICE,
stock: Number(route.query.count as string || 1),
hasShipping: false,
isPhysicalOnly: false,
Expand Down Expand Up @@ -566,7 +564,7 @@ async function submitNewCollection () {
}))
if (price.value.price !== 0 && price.value.price < MINIMAL_PRICE) {
throw new Error(`Price of each edition must be at least $${MINIMAL_PRICE} or free`)
throw new Error(`Price of each edition must be at least $${MINIMAL_PRICE} or $0 (free)`)
}
await checkStripeConnect()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
/>
</UFormGroup>

<UFormGroup :label="`Price(USD) of this collection (Minimal ${MINIMAL_PRICE} or free)`">
<UFormGroup :label="`Price(USD) of this collection (Minimal ${MINIMAL_PRICE} or $0 (free))`">
<UInput v-model="price" type="number" step="0.01" :min="MINIMAL_PRICE" />
</UFormGroup>

Expand Down Expand Up @@ -125,6 +125,7 @@ import { MdEditor, config } from 'md-editor-v3'
import 'md-editor-v3/lib/style.css'
import DOMPurify from 'dompurify'
import { DEFAULT_PRICE, MINIMAL_PRICE } from 'constant'
import { useCollectionStore } from '~/stores/collection'
const collectionStore = useCollectionStore()
Expand All @@ -136,12 +137,10 @@ const toast = useToast()
const collectionId = ref(route.params.collectionId)
const MINIMAL_PRICE = 0.9
const isLoading = ref(false)
const classIds = ref<string[]>([])
const price = ref(MINIMAL_PRICE)
const price = ref(DEFAULT_PRICE)
const stock = ref(1)
const nameEn = ref('Standard Edition')
const nameZh = ref('標準版')
Expand Down Expand Up @@ -264,7 +263,7 @@ async function handleSubmit () {
throw new Error('Please input price of edition')
}
if (editedPrice.price !== 0 && editedPrice.price < MINIMAL_PRICE) {
throw new Error(`Price of each edition must be at least $${MINIMAL_PRICE} or free`)
throw new Error(`Price of each edition must be at least $${MINIMAL_PRICE} or $0 (free)`)
}
if (!editedPrice.stock && editedPrice.stock !== 0) {
Expand Down
14 changes: 6 additions & 8 deletions pages/nft-book-store/new.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<component :is="hasMultiplePrices ? 'li' : 'div'" v-for="p, index in prices" :key="p.index" class="space-y-4">
<UDivider v-if="index > 0" />

<UFormGroup :label="`Price(USD) of this ${priceItemLabel} (Minimal ${MINIMAL_PRICE} or free)`">
<UFormGroup :label="`Price(USD) of this ${priceItemLabel} (Minimal ${MINIMAL_PRICE} or $0 (free))`">
<UInput :value="p.price" type="number" step="0.01" :min="0" @input="e => updatePrice(e, 'price', index)" />
</UFormGroup>

Expand Down Expand Up @@ -380,7 +380,7 @@ import 'md-editor-v3/lib/style.css'
import DOMPurify from 'dompurify'
import { v4 as uuidv4 } from 'uuid'
import { LCD_URL, LIKE_CO_API } from '~/constant'
import { DEFAULT_PRICE, MINIMAL_PRICE, LCD_URL, LIKE_CO_API } from '~/constant'
import { useBookStoreApiStore } from '~/stores/book-store-api'
import { useWalletStore } from '~/stores/wallet'
import { getPortfolioURL, deliverMethodOptions } from '~/utils'
Expand All @@ -400,8 +400,6 @@ const route = useRoute()
const classId = ref(route.params.editingClassId || route.query.class_id as string)
const editionIndex = ref(route.params.editionIndex as string)
const MINIMAL_PRICE = 0.9
const error = ref('')
const isLoading = ref(false)
const connectStatus = ref<any>({})
Expand All @@ -417,7 +415,7 @@ const defaultPaymentCurrency = ref('USD')
const mustClaimToView = ref(true)
const hideDownload = ref(false)
const prices = ref<any[]>([{
price: MINIMAL_PRICE,
price: DEFAULT_PRICE,
deliveryMethod: 'auto',
autoMemo: 'Thanks for purchasing this NFT ebook.',
stock: Number(route.query.count as string || 1),
Expand Down Expand Up @@ -591,7 +589,7 @@ function addMorePrice () {
nextPriceIndex.value += 1
prices.value.push({
index: uuidv4(),
price: MINIMAL_PRICE,
price: DEFAULT_PRICE,
deliveryMethod: 'auto',
autoMemo: '',
stock: 1,
Expand Down Expand Up @@ -696,7 +694,7 @@ async function submitNewClass () {
const p = mapPrices(prices.value)
if (p.find((price: any) => price.price !== 0 && price.price < MINIMAL_PRICE)) {
throw new Error(`Price of each edition must be at least $${MINIMAL_PRICE} or free`)
throw new Error(`Price of each edition must be at least $${MINIMAL_PRICE} or $0 (free)`)
}
await checkStripeConnect()
Expand Down Expand Up @@ -772,7 +770,7 @@ async function submitEditedClass () {
throw new Error('Please input price of edition')
}
if (price.price !== 0 && price.price < MINIMAL_PRICE) {
throw new Error(`Price of each edition must be at least $${MINIMAL_PRICE} or free`)
throw new Error(`Price of each edition must be at least $${MINIMAL_PRICE} or $0 (free)`)
}
if (!price.stock && price.stock !== 0) {
Expand Down
12 changes: 5 additions & 7 deletions pages/nft-book-store/status/[classId]/edit/[editionIndex].vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
/>
</UFormGroup>

<UFormGroup :label="`Price(USD) of this ${priceItemLabel} (Minimal ${MINIMAL_PRICE} or free)`">
<UFormGroup :label="`Price(USD) of this ${priceItemLabel} (Minimal ${MINIMAL_PRICE} or $0 (free))`">
<UInput v-model="price" type="number" step="0.01" :min="MINIMAL_PRICE" />
</UFormGroup>

Expand Down Expand Up @@ -139,7 +139,7 @@ import { storeToRefs } from 'pinia'
import { MdEditor, config } from 'md-editor-v3'
import 'md-editor-v3/lib/style.css'
import DOMPurify from 'dompurify'
import { LIKE_CO_API } from '~/constant'
import { DEFAULT_PRICE, LIKE_CO_API, MINIMAL_PRICE } from '~/constant'
import { useBookStoreApiStore } from '~/stores/book-store-api'
import { useWalletStore } from '~/stores/wallet'
Expand All @@ -160,14 +160,12 @@ const toast = useToast()
const classId = ref(route.params.classId)
const editionIndex = ref(route.params.editionIndex as string)
const MINIMAL_PRICE = 0.9
const isLoading = ref(false)
const classData = ref<any>({})
const hasMultiplePrices = computed(() => classData?.value?.prices?.length > 1)
const price = ref(MINIMAL_PRICE)
const price = ref(DEFAULT_PRICE)
const stock = ref(1)
const deliveryMethod = ref('auto')
const autoMemo = ref('Thanks for purchasing this NFT ebook.')
Expand Down Expand Up @@ -238,7 +236,7 @@ onMounted(async () => {
}
})
const classResData = classRes?.data?.value
const classResData: any = classRes?.data?.value
if (classResData) {
shippingRates.value = classResData?.shippingRates || []
if (classResData?.ownerWallet !== wallet.value) {
Expand Down Expand Up @@ -349,7 +347,7 @@ async function handleSubmit () {
throw new Error('Please input price of edition')
}
if (editedPrice.price !== 0 && editedPrice.price < MINIMAL_PRICE) {
throw new Error(`Price of each edition must be at least $${MINIMAL_PRICE} or free`)
throw new Error(`Price of each edition must be at least $${MINIMAL_PRICE} or $0 (free)`)
}
if (!editedPrice.stock && editedPrice.stock !== 0) {
Expand Down
10 changes: 4 additions & 6 deletions pages/nft-book-store/status/[classId]/edit/new.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
/>
</UFormGroup>

<UFormGroup :label="`Price(USD) of this ${priceItemLabel} (Minimal ${MINIMAL_PRICE} or free)`">
<UFormGroup :label="`Price(USD) of this ${priceItemLabel} (Minimal ${MINIMAL_PRICE} or $0 (free))`">
<UInput v-model="price" type="number" step="0.01" :min="MINIMAL_PRICE" />
</UFormGroup>

Expand Down Expand Up @@ -139,7 +139,7 @@ import { MdEditor, config } from 'md-editor-v3'
import 'md-editor-v3/lib/style.css'
import DOMPurify from 'dompurify'
import { LIKE_CO_API } from '~/constant'
import { DEFAULT_PRICE, LIKE_CO_API, MINIMAL_PRICE } from '~/constant'
import { useBookStoreApiStore } from '~/stores/book-store-api'
import { useWalletStore } from '~/stores/wallet'
Expand All @@ -160,14 +160,12 @@ const toast = useToast()
const classId = ref(route.params.classId)
const priceIndex = ref(route.query.priceIndex as string)
const MINIMAL_PRICE = 0.9
const isLoading = ref(false)
const classData = ref<any>({})
const hasMultiplePrices = computed(() => classData?.value?.prices?.length > 1)
const price = ref(MINIMAL_PRICE)
const price = ref(DEFAULT_PRICE)
const stock = ref(1)
const deliveryMethod = ref('auto')
const autoMemo = ref('Thanks for purchasing this NFT ebook.')
Expand Down Expand Up @@ -312,7 +310,7 @@ async function handleSubmit () {
throw new Error('Please input price of edition')
}
if (editedPrice.price !== 0 && editedPrice.price < MINIMAL_PRICE) {
throw new Error(`Price of each edition must be at least $${MINIMAL_PRICE} or free`)
throw new Error(`Price of each edition must be at least $${MINIMAL_PRICE} or $0 (free)`)
}
if (!editedPrice.stock && editedPrice.stock !== 0) {
Expand Down

0 comments on commit e9ce8c3

Please sign in to comment.