Skip to content

Commit

Permalink
Merge branch 'main' into feat-asset-hub-offer
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarsen136 authored Aug 20, 2024
2 parents ab15789 + b23d38b commit 417c060
Show file tree
Hide file tree
Showing 24 changed files with 92 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/diagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions .github/push_release_beta.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# experimental
# https://github.com/kodadot/nft-gallery/issues/5770
# experimental
# https://github.com/kodadot/nft-gallery/issues/5770

gh pr list -s merged --json url -B main --jq ".[] | .url" | sed 's/^/- /' $1 | awk 'BEGIN{print "Beta Update \n"}{ print}' $1 | gh pr create -t "beta update" -d -H main -B beta -l beta --body-file -
gh pr list -s merged --json url -B main --jq ".[] | .url" | sed 's/^/- /' $1 | awk 'BEGIN{print "Beta Update \n"}{ print}' $1 | gh pr create -t "(beta): $(date +"%B %Y")" -d -H main -B beta -l beta --body-file -
6 changes: 3 additions & 3 deletions .github/push_release_production.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# experimental
# https://github.com/kodadot/nft-gallery/issues/5770
# experimental
# https://github.com/kodadot/nft-gallery/issues/5770

gh pr list -s merged --json url -B main --jq ".[] | .url" | sed 's/^/- /' $1 | awk 'BEGIN{print "Release Update \n"}{ print}' $1 | gh pr create -t "release update" -d -H beta -B production -l release --body-file -
gh pr list -s merged --json url -B main --jq ".[] | .url" | sed 's/^/- /' $1 | awk 'BEGIN{print "Release Update \n"}{ print}' $1 | gh pr create -t "(prod): $(date +"%B %Y")" -d -H beta -B production -l release --body-file -
20 changes: 16 additions & 4 deletions components/collection/drop/GenerativePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,26 @@
<span v-else>{{ $t('free') }}</span>
</div>
<div class="flex justify-end items-center">
<div class="mr-4 text-neutral-7">
<div
v-if="!isUnlimited"
class="mr-4 text-neutral-7"
>
{{ mintedPercent }}% ~
</div>
<div
v-if="drop.minted >= 0 && drop.max"
class="font-bold"
class="font-bold flex gap-2"
>
{{ drop.minted }}/{{ drop.max }}
{{ $t('statsOverview.minted') }}
<span>{{ drop.minted }}</span>
<span>/</span>
<span v-if="isUnlimited">
<NeoIcon
icon="infinity"
pack="fas"
/>
</span>
<span v-else>{{ drop.max }}</span>
<span>{{ $t('statsOverview.minted') }}</span>
</div>
<div v-else>
<NeoSkeleton width="100" />
Expand Down Expand Up @@ -111,6 +122,7 @@ const { formatted: formattedPrice } = useAmount(
)
const emit = defineEmits(['generation:start', 'generation:end', 'mint'])
const isUnlimited = computed(() => drop.value.max !== undefined && drop.value.max > Number.MAX_SAFE_INTEGER)
const { start: startTimer } = useTimeoutFn(() => {
// quick fix: ensure that even if the completed event is not received, the loading state of the drop can be cleared
Expand Down
4 changes: 4 additions & 0 deletions components/collection/drop/MintButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ const label = computed(() => {
return $i18n.t('mint.unlockable.notEligibility')
}
if (isMintNotLive.value) {
return $i18n.t('mint.unlockable.mintingNotLive')
}
switch (drop.value.type) {
case 'free':
return $i18n.t('drops.mintForFree')
Expand Down
3 changes: 1 addition & 2 deletions components/common/ConnectWallet/WalletAsset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ const MultipleBalances = defineAsyncComponent(
const identityStore = useIdentityStore()
const { $consola } = useNuxtApp()
const { getIsSubstrate } = storeToRefs(useWalletStore())
onMounted(async () => {
if (identityStore.getAuthAddress && getIsSubstrate.value) {
if (identityStore.getAuthAddress) {
$consola.log('fetching balance...')
await identityStore.fetchBalance({
address: identityStore.getAuthAddress,
Expand Down
2 changes: 1 addition & 1 deletion components/common/ConnectWallet/WalletAssetIdentity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const { logout } = useWallet()
const account = computed(() => identityStore.getAuthAddress)

const prefix = computed(() => getPrefixByAddress(account.value))
const { profile } = useFetchProfile(account.value)
const { profile } = useFetchProfile(account)

const { display, shortenedAddress } = useIdentity({
address: account,
Expand Down
17 changes: 14 additions & 3 deletions components/drops/BasicDropCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,21 @@
</div>
</div>
<div
class="h-[28px] flex justify-between items-center flex-wrap gap-y-4 gap-x-2"
class="h-[28px] flex justify-between items-center gap-y-4 gap-x-2"
>
<div class="flex gap-4">
<div
v-if="dropStatus !== 'scheduled_soon'"
class="flex gap-4"
>
<slot name="supply">
<div>
<span>{{ minted }}</span><span class="text-k-grey text-xs">/{{ dropMax }}</span>
<span>{{ minted }}</span><span class="text-k-grey text-xs">/
<span v-if="isUnlimited"><NeoIcon
icon="infinity"
pack="fas"
/></span>
<span v-else>{{ dropMax }}</span>
</span>
</div>
</slot>
<div
Expand Down Expand Up @@ -86,6 +95,7 @@
</template>

<script setup lang="ts">
import { NeoIcon } from '@kodadot1/brick'
import type { Prefix } from '@kodadot1/static'
import type { DropStatus } from '@/components/drops/useDrops'
import { chainPropListOf } from '@/utils/config/chain.config'
Expand Down Expand Up @@ -123,6 +133,7 @@ const props = withDefaults(
)
const { placeholder } = useTheme()
const isUnlimited = computed(() => props.dropMax > Number.MAX_SAFE_INTEGER)
const chainPropList = chainPropListOf(props.dropPrefix)
const { usd: formattedPrice } = useAmount(
Expand Down
30 changes: 16 additions & 14 deletions components/drops/Drops.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,21 @@
:default-skeleton-count="DEFAULT_SKELETON_COUNT"
/>

<hr class="my-14">

<h2 class="text-3xl font-semibold mb-7">
{{ $i18n.t('drops.pastArtDrops') }}
</h2>

<DropsGrid
:drops="pastDrops"
:loaded="loaded"
:default-skeleton-count="DEFAULT_SKELETON_COUNT"
:async-skeleton-count="asyncSkeletonCountOf(pastDrops.length)"
skeleton-key="skeleton"
/>
<template v-if="!(loaded && pastDrops.length === 0)">
<hr class="my-14">

<h2 class="text-3xl font-semibold mb-7">
{{ $i18n.t('drops.pastArtDrops') }}
</h2>

<DropsGrid
:drops="pastDrops"
:loaded="loaded"
:default-skeleton-count="DEFAULT_SKELETON_COUNT"
:async-skeleton-count="asyncSkeletonCountOf(pastDrops.length)"
skeleton-key="skeleton"
/>
</template>

<DropsCreateCalendarEventModal
v-model="isCreateEventModalActive"
Expand All @@ -82,7 +84,7 @@ const { $i18n } = useNuxtApp()
const { urlPrefix } = usePrefix()
const { drops, loaded, count } = useDrops({
active: [true],
chain: !isProduction ? [urlPrefix.value] : [],
chain: [urlPrefix.value],
limit: 100,
}, { async: true })
Expand Down
1 change: 1 addition & 0 deletions components/drops/useDrops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ export const useHolderOfCollectionDrop = () => {
export const useRelatedActiveDrop = (collectionId: string, chain: Prefix) => {
const { drops } = useDrops({
chain: [chain],
collection: collectionId,
})

const relatedActiveDrop = computed(() =>
Expand Down
4 changes: 2 additions & 2 deletions components/landing/LandingPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const forbiddenPrefixesForTopCollections: Prefix[] = ['ksm', 'dot', 'imx']
const { urlPrefix } = usePrefix()
const profileOnboardingStore = useProfileOnboardingStore()
const { hasProfile } = useProfile()
const { hasProfile, isFetchingProfile } = useProfile()
// currently only supported on rmrk
const showCarousel = computed(
Expand All @@ -56,7 +56,7 @@ const showTopCollections = computed(
)
watchEffect(() => {
if (!hasProfile.value && profileOnboardingStore.getShouldShowOnboarding) {
if (!hasProfile.value && !isFetchingProfile.value && profileOnboardingStore.getShouldShowOnboarding) {
profileOnboardingStore.setOnboardingShown()
// delay to show onboarding modal to avoid disturbing the user
Expand Down
4 changes: 2 additions & 2 deletions components/profile/ProfileDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,8 @@ watch(() => getPrefixByAddress(route.params.id.toString()), (prefix) => {
immediate: true,
})
onMounted(() => {
if (!hasProfile.value && isOwner.value) {
watchEffect(() => {
if (!hasProfile.value && !isFetchingProfile.value && isOwner.value) {
openProfileCreateModal()
}
})
Expand Down
1 change: 1 addition & 0 deletions components/profile/activityTab/History.vue
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ const createTable = (): void => {
const nftId = newEvent['nft'] ? newEvent['nft']['id'] : 'id'
// Type
switch (newEvent['interaction']) {
case Interaction.MINT:
case Interaction.MINTNFT:
event['From'] = newEvent['caller']
event['To'] = ''
Expand Down
4 changes: 3 additions & 1 deletion components/shared/Avatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ const props = withDefaults(
},
)
const formattedAddress = computed(() => props.value.toLowerCase())
const evmAvatarSvg = computed(() =>
toSvg(props.value, props.size - 2, {
toSvg(formattedAddress.value, props.size - 2, {
padding: 0.1,
}),
)
Expand Down
2 changes: 1 addition & 1 deletion components/shared/ProfileAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const props = withDefaults(
)
const { profile: profileFromAddress } = useFetchProfile(
props.profileImage ? undefined : props.address,
computed(() => props.profileImage ? undefined : props.address),
)
const profileImageUrl = computed(
Expand Down
6 changes: 3 additions & 3 deletions composables/autoTeleport/useAutoTeleportTransitionDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export default function (

const getTransitionBalances = () => {
return fetchChainsBalances([
...allowedSourceChains.value,
...(needsSourceChainBalances.value ? allowedSourceChains.value : []),
currentChain.value as Chain,
])
}
Expand Down Expand Up @@ -307,9 +307,9 @@ export default function (
)

watch(
[allowedSourceChains, needsSourceChainBalances],
[() => allowedSourceChains.value.length, needsSourceChainBalances],
async () => {
if (allowedSourceChains.value.length && needsSourceChainBalances.value) {
if ((allowedSourceChains.value.length && needsSourceChainBalances.value) || !currentChainBalance.value) {
hasFetched.balances = false
await getTransitionBalances()
hasFetched.balances = true
Expand Down
6 changes: 3 additions & 3 deletions composables/useFetchProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useQuery } from '@tanstack/vue-query'
import { fetchProfileByAddress, toSubstrateAddress } from '@/services/profile'
import type { Profile } from '@/services/profile'

export default function useFetchProfile(address?: string) {
export default function useFetchProfile(address: Ref<string | undefined>) {
const {
data: profile,
isPending,
Expand All @@ -11,9 +11,9 @@ export default function useFetchProfile(address?: string) {
} = useQuery<Profile | null>({
queryKey: [
'user-profile',
computed(() => address && toSubstrateAddress(address)),
computed(() => address.value && toSubstrateAddress(address.value)),
],
queryFn: () => (address ? fetchProfileByAddress(address!) : null),
queryFn: () => (address.value ? fetchProfileByAddress(address.value) : null),
staleTime: 1000 * 10,
})

Expand Down
2 changes: 1 addition & 1 deletion composables/useIdentity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function useIdentity({

const id = computed(() => address.value && getIdentityId(address.value))

const { profile, isPending: loading } = useFetchProfile(id.value)
const { profile, isPending: loading } = useFetchProfile(id)

const shortenedAddress = computed(() => shortAddress(address.value))

Expand Down
6 changes: 5 additions & 1 deletion composables/useMultipleBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export default function (refetchPeriodically: boolean = false) {
chainName,
})

identityStore.setBalance(prefix, currentBalance)
identityStore.setBalance(prefix, nativeBalance)
identityStore.multiBalanceNetwork = currentNetwork.value

return Promise.resolve()
Expand All @@ -202,6 +202,10 @@ export default function (refetchPeriodically: boolean = false) {
) => {
await fetchFiatPrice(forceFiat)

if (!accountId.value) {
return
}

const chainNetworks = onlyPrefixes.map(getNetwork).filter(Boolean)

const assetsToFetch = onlyPrefixes.length
Expand Down
4 changes: 2 additions & 2 deletions composables/useProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export default function useUserProfile() {
profile,
refetch: fetchProfile,
isLoading,
} = useFetchProfile(params?.id as string || accountId.value)
} = useFetchProfile(computed(() => params?.id as string || accountId.value))

return {
hasProfile: computed(() => !!profile.value),
hasProfile: computed(() => Boolean(profile.value)),
userProfile: profile,
fetchProfile,
isFetchingProfile: isLoading,
Expand Down
3 changes: 2 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,8 @@
"readyToMint": "Ready to Mint: {0} NFTs Remaining",
"requirementsNotMet": "Requirements not met",
"holderOfWarning1": "Each {0} collection NFT allows you to <strong>mint one</strong> new NFT.",
"holderOfWarning2": "After a claim, that NFT <strong>can't be</strong> used for another mint."
"holderOfWarning2": "After a claim, that NFT <strong>can't be</strong> used for another mint.",
"mintingNotLive": "Minting Not Started Yet"
},
"blockchain": {
"label": "Select Blockchain",
Expand Down
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ export default defineNuxtConfig({
transakEnvironment: process.env.TRANSAK_ENV || 'PRODUCTION',
walletConnectProjectId:
process.env.WALLET_CONNECT_PROJECT_ID
|| '3fcc6bba6f1de962d911bb5b5c3dba68', // WalletConnect project ID from `https://wagmi.sh/core/api/connectors/walletConnect#projectid`
|| '4483dd2f5c3049479618d611e8a1087a', // WalletConnect project ID from `https://wagmi.sh/core/api/connectors/walletConnect#projectid`
},
},

Expand Down
2 changes: 2 additions & 0 deletions pages/[prefix]/drops/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ const fixPrefix = () => {
}
fetchDrop().then(fixPrefix)
watch(urlPrefix, () => navigateTo(`/${urlPrefix.value}/drops`))
</script>
5 changes: 4 additions & 1 deletion stores/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ export const useIdentityStore = defineStore('identity', {
},
async fetchBalance({ address }: ChangeAddressRequest) {
const { fetchBalance } = useBalance()
await fetchBalance(address)
const balance = await fetchBalance(address)
if (balance) {
this.setPrefixBalance(balance)
}
},
setMultiBalances({ address, chains, chainName }) {
this.multiBalances = {
Expand Down

0 comments on commit 417c060

Please sign in to comment.