Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(prod): 83% of August 2024 Vampire 🧛🏽‍♀️ #10910

Merged
merged 35 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
523fa29
feat: create offer on AssetHub
Jarsen136 Aug 16, 2024
3514eaf
fix: deepscan
Jarsen136 Aug 16, 2024
b4cdef7
refactor: offer modal
Jarsen136 Aug 18, 2024
eca9f9c
refactor: making offer
Jarsen136 Aug 19, 2024
ab15789
Update components/offer/MakeOffer.vue
Jarsen136 Aug 20, 2024
417c060
Merge branch 'main' into feat-asset-hub-offer
Jarsen136 Aug 20, 2024
dd212f9
fix: eslint
Jarsen136 Aug 20, 2024
c750642
fix(ItemsGridImage): missing skeleton card inside card component
hassnian Aug 20, 2024
b69b4d8
fix(Items.vue): items count not showing skeleton
hassnian Aug 20, 2024
2eca00f
fix(profile): profile onboarding modal shown muitple times per session
hassnian Aug 21, 2024
be00bfb
fix(drops): correct metadata fetching for on-chain data and remove un…
preschian Aug 22, 2024
042e9be
refactor(collection): remove user checks and update metadata fields
preschian Aug 22, 2024
863e79a
add(useIcon.ts): mnt icon
hassnian Aug 22, 2024
a5bc5b9
ref(utils/shortAddress.ts): simpler `shortAddress`
hassnian Aug 22, 2024
5945169
Merge branch 'main' of github.com:kodadot/nft-gallery into refactor--…
preschian Aug 23, 2024
d4cb20a
add: navbar active profile pill
hassnian Aug 23, 2024
82d38bc
fix(WalletMenuItem.vue): using wrong `ss58Format` when `evm` wallet s…
hassnian Aug 23, 2024
be9341a
Merge pull request #10891 from hassnian/issue-10881-0
vikiival Aug 23, 2024
74a887c
Merge branch 'main' into issue-10892
hassnian Aug 24, 2024
7852dc5
refactor(drops): consolidate onchain and offchain data single object
preschian Aug 24, 2024
6550d34
test(e2e): replace waitForTimeout with waitForLoadState in View Colle…
preschian Aug 24, 2024
3bb671a
Merge branch 'main' into refactor--drop-store-value
vikiival Aug 24, 2024
afa918d
Merge branch 'main' into issue-10856
hassnian Aug 24, 2024
e2e16b8
Merge pull request #10873 from hassnian/issue-10856
vikiival Aug 25, 2024
dccbd61
fix(ProfileDetail.vue): `avatar` image wrong size
hassnian Aug 26, 2024
090d8af
Merge pull request #10890 from kodadot/refactor--drop-store-value
preschian Aug 26, 2024
9842d91
Merge pull request #10877 from hassnian/issue-10876
preschian Aug 26, 2024
0fa84aa
Merge pull request #10893 from hassnian/issue-10892
vikiival Aug 26, 2024
4dc6b92
fix(GalleryItem): low quality image download on genart
hassnian Aug 26, 2024
d1b6074
Merge pull request #10842 from Jarsen136/feat-asset-hub-offer
Jarsen136 Aug 26, 2024
b9f4e77
Merge branch 'main' into issue-10816
vikiival Aug 26, 2024
c9fdef4
Merge pull request #10902 from hassnian/issue-10816
vikiival Aug 26, 2024
547656d
Merge branch 'main' into main
vikiival Aug 26, 2024
3a359b2
Merge pull request #10907 from hassnian/main
vikiival Aug 26, 2024
9903b38
Merge pull request #10908 from kodadot/main
vikiival Aug 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions components/collection/drop/MintButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ const label = computed(() => {
if (isCheckingMintRequirements.value) {
return $i18n.t('checking')
}
if (drop.value.userAccess === false) {
return $i18n.t('mint.unlockable.notEligibility')
}

if (isMintNotLive.value) {
return $i18n.t('mint.unlockable.mintingNotLive')
Expand Down Expand Up @@ -131,7 +128,6 @@ const enabled = computed(() => {
|| !previewItem.value // no image
|| isCheckingMintRequirements.value // still checking requirements
|| loading.value // still loading
|| drop.value.userAccess === false // no access due to geofencing
) {
return false
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div>
<div v-if="nft">
<div class="flex justify-between">
<div class="flex">
<div>
Expand Down Expand Up @@ -48,23 +48,30 @@
<script setup lang="ts">
import { parseNftAvatar } from '@/utils/nft'
import type { ListCartItem } from '@/stores/listingCart'
import type { MakingOfferItem } from '@/components/offer/types'
import BasicImage from '@/components/shared/view/BasicImage.vue'
import { sanitizeIpfsUrl } from '@/utils/ipfs'

const avatar = ref<string>()

const props = defineProps<{
nft: ListCartItem
nft?: (ListCartItem | MakingOfferItem) & {
mediaUrl?: {
image: string
mimeType: string
}
}
discarded?: boolean
}>()

const getAvatar = async () => {
if (props.nft) {
avatar.value = await parseNftAvatar(props.nft)
avatar.value = await parseNftAvatar(props.nft as EntityWithMeta)
}
}

onMounted(() => {
if (!props.nft.mediaUrl) {
if (!props.nft?.mediaUrl) {
getAvatar()
}
})
Expand Down
15 changes: 8 additions & 7 deletions components/common/ConnectWallet/ConnectWalletModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import { ModalCloseType } from '@/components/navbar/types'

const emit = defineEmits(['close', 'connect'])
const props = defineProps<{ preselected?: ChainVM }>()
const { isWalletModalOpen } = useWallet()

const { urlPrefix, setUrlPrefix } = usePrefix()
const { redirectAfterChainChange } = useChainRedirect()
Expand All @@ -67,16 +68,11 @@ const selectedTab = ref<ChainVM>(props.preselected ?? 'SUB')

const showAccount = computed(() => Boolean(account.value))

const isCurrentPrefixAvailableForVm = (vm: ChainVM) =>
getAvailableChainsByVM(vm)
.map(({ value }) => value)
.includes(urlPrefix.value)

const setAccount = (account: WalletAccount) => {
walletStore.setWallet(account)
identityStore.setAuth({ address: account.address })

if (!isCurrentPrefixAvailableForVm(account.vm)) {
if (!isPrefixVmOf(urlPrefix.value, account.vm)) {
const newChain = DEFAULT_VM_PREFIX[account.vm]
setUrlPrefix(newChain)
redirectAfterChainChange(newChain)
Expand All @@ -85,7 +81,12 @@ const setAccount = (account: WalletAccount) => {
emit('connect', account)
}

onMounted(() => walletStore.setDisconnecting(false))
onMounted(() => {
walletStore.setDisconnecting(false)
isWalletModalOpen.value = true
})

onUnmounted(() => isWalletModalOpen.value = false)

watch([urlPrefix], () => {
emit('close', ModalCloseType.NAVIGATION)
Expand Down
5 changes: 4 additions & 1 deletion components/common/ConnectWallet/WalletMenuItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@

<script lang="ts" setup>
import { NeoIcon, NeoSkeleton } from '@kodadot1/brick'
import { DEFAULT_VM_PREFIX } from '@kodadot1/static'
import { chainPropListOf } from '@/utils/config/chain.config'
import type { WalletAccount } from '@/utils/config/wallets'
import type { BaseDotsamaWallet } from '@/utils/config/wallets/BaseDotsamaWallet'
import shouldUpdate from '@/utils/shouldUpdate'
Expand All @@ -128,6 +130,7 @@ defineProps<{

const { chainProperties } = useChain()
const { $consola } = useNuxtApp()
const { urlPrefix } = usePrefix()
const hasWalletProviderExtension = ref(false)
const walletAccounts = ref<WalletAccount[]>([])
const showAccountList = ref(false)
Expand Down Expand Up @@ -166,7 +169,7 @@ const { data: existingProfiles, isLoading: isProfilesLoading } = useProfiles('ac
const formatAccount = (account: WalletAccount): WalletAccount => {
return {
...account,
address: formatAddress(account.address, ss58Format.value),
address: formatAddress(account.address, !isPrefixVmOf(urlPrefix.value, 'SUB') ? chainPropListOf(DEFAULT_VM_PREFIX['SUB']).ss58Format : ss58Format.value),
}
}

Expand Down
6 changes: 4 additions & 2 deletions components/common/autoTeleport/AutoTeleportActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<NeoButton
:label="autoTeleportLabel"
variant="primary"
:variant="buttonVariant"
no-shadow
:shiny="shiny"
:disabled="isDisabled"
Expand Down Expand Up @@ -96,7 +96,7 @@
</template>

<script setup lang="ts">
import { NeoButton, NeoSwitch } from '@kodadot1/brick'
import { NeoButton, NeoSwitch, type NeoButtonVariant } from '@kodadot1/brick'
import AutoTeleportWelcomeModal from './AutoTeleportWelcomeModal.vue'
import type { ActionlessInteraction } from './utils'
import { getActionDetails } from './utils'
Expand Down Expand Up @@ -133,6 +133,7 @@ const props = withDefaults(
loading?: boolean
shiny?: boolean
earlySuccess?: boolean
buttonVariant?: NeoButtonVariant
}>(),
{
autoCloseModalDelayModal: undefined,
Expand All @@ -146,6 +147,7 @@ const props = withDefaults(
loading: false,
shiny: false,
earlySuccess: true,
buttonVariant: 'primary',
},
)

Expand Down
72 changes: 30 additions & 42 deletions components/common/listingCart/ListingCartModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

<div class="flex justify-between px-6">
<AutoTeleportActionButton
ref="autoteleportButton"
ref="autoTeleportButton"
:actions="actions"
:disabled="confirmButtonDisabled"
:fees="{ forceActionAutoFees: true }"
Expand Down Expand Up @@ -114,6 +114,7 @@ import AutoTeleportActionButton, {
} from '@/components/common/autoTeleport/AutoTeleportActionButton.vue'
import type { AutoTeleportAction } from '@/composables/autoTeleport/types'
import { hasOperationsDisabled } from '@/utils/prefix'
import useAutoTeleportActionButton from '@/composables/autoTeleport/useAutoTeleportActionButton'

const { urlPrefix } = usePrefix()
const preferencesStore = usePreferencesStore()
Expand All @@ -138,19 +139,17 @@ const { chainSymbol, decimals } = useChain()

const fixedPrice = ref()
const floorPricePercentAdjustment = ref()
const autoTeleport = ref(false)
const autoteleportButton = ref()

const itemCount = ref(listingCartStore.count)
const items = ref<ListCartItem[]>([])
const autoTeleportLoaded = ref(false)

const isSuccessModalOpen = computed(
() => Boolean(items.value.length) && isTransactionSuccessful.value,
)

const teleportTransitionTxFees = computed(() =>
format(
autoteleportButton.value?.optimalTransition.txFees || 0,
autoTeleportButton.value?.optimalTransition.txFees || 0,
decimals.value,
chainSymbol.value,
),
Expand All @@ -167,7 +166,30 @@ watch(floorPricePercentAdjustment, (rate) => {
})

const fiatStore = useFiatStore()
const action = ref<Actions>(emptyObject<Actions>())

const getAction = (items: ListCartItem[]): Actions => {
const token = items
.filter((item): item is ListCartItem & { listPrice: number } =>
Boolean(item.listPrice),
)
.map(item => ({
price: String(calculateBalance(item.listPrice, decimals.value)),
nftId: item.id,
})) as TokenToList[]

return {
interaction: Interaction.LIST,
urlPrefix: urlPrefix.value,
token,
successMessage: $i18n.t('transaction.price.success') as string,
errorMessage: $i18n.t('transaction.price.error') as string,
}
}

const { action, autoTeleport, autoTeleportButton, autoTeleportLoaded } = useAutoTeleportActionButton({
getActionFn: () => getAction(listingCartStore.itemsInChain),
})

const actions = computed<AutoTeleportAction[]>(() => [
{
action: action.value,
Expand Down Expand Up @@ -218,7 +240,7 @@ const confirmButtonDisabled = computed(
() =>
hasOperationsDisabled(urlPrefix.value)
|| Boolean(listingCartStore.incompleteListPrices)
|| !autoteleportButton.value?.isReady,
|| !autoTeleportButton.value?.isReady,
)

const confirmListingLabel = computed(() => {
Expand All @@ -227,7 +249,7 @@ const confirmListingLabel = computed(() => {
}
switch (listingCartStore.incompleteListPrices) {
case 0:
if (!autoteleportButton.value?.isReady) {
if (!autoTeleportButton.value?.isReady) {
return $i18n.t('autoTeleport.checking')
}

Expand All @@ -245,25 +267,6 @@ const confirmListingLabel = computed(() => {
}
})

const getAction = (items: ListCartItem[]): Actions => {
const token = items
.filter((item): item is ListCartItem & { listPrice: number } =>
Boolean(item.listPrice),
)
.map(item => ({
price: String(calculateBalance(item.listPrice, decimals.value)),
nftId: item.id,
})) as TokenToList[]

return {
interaction: Interaction.LIST,
urlPrefix: urlPrefix.value,
token,
successMessage: $i18n.t('transaction.price.success') as string,
errorMessage: $i18n.t('transaction.price.error') as string,
}
}

const submitListing = () => {
return transaction(getAction(items.value || []))
}
Expand Down Expand Up @@ -321,21 +324,6 @@ watch(
},
)

watch(
() => autoteleportButton.value?.isReady,
() => {
if (autoteleportButton.value?.isReady && !autoTeleportLoaded.value) {
autoTeleportLoaded.value = true
}
},
)

watchSyncEffect(() => {
if (!autoTeleport.value) {
action.value = getAction(listingCartStore.itemsInChain)
}
})

const closeListingCartModal = () =>
(preferencesStore.listingCartModalOpen = false)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="border-t border-k-shade py-5">
<ListingCartItemDetails
<CartItemDetails
:nft="nft"
:discarded="nft.discarded"
>
Expand Down Expand Up @@ -36,14 +36,14 @@
</div>
</div>
</template>
</ListingCartItemDetails>
</CartItemDetails>
</div>
</template>

<script setup lang="ts">
import { NeoButton } from '@kodadot1/brick'
import ListingCartPriceInput from '../shared/ListingCartPriceInput.vue'
import ListingCartItemDetails from '../shared/ListingCartItemDetails.vue'
import CartItemDetails from '@/components/common/CartItemDetails.vue'
import type { ListCartItem } from '@/stores/listingCart'
import { useListingCartStore } from '@/stores/listingCart'
import formatBalance from '@/utils/format/balance'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="py-5">
<ListingCartItemDetails :nft="item">
<CartItemDetails :nft="item">
<template #right>
<div class="flex items-end">
{{ itemPrice }}
Expand All @@ -17,7 +17,7 @@
</div>
</div>
</template>
</ListingCartItemDetails>
</CartItemDetails>

<hr class="my-5">

Expand All @@ -36,9 +36,9 @@
</template>

<script setup lang="ts">
import ListingCartItemDetails from '../shared/ListingCartItemDetails.vue'
import ListingCartFloorPrice from '../shared/ListingCartFloorPrice.vue'
import ListingCartPriceInput from '../shared/ListingCartPriceInput.vue'
import CartItemDetails from '@/components/common/CartItemDetails.vue'
import { useListingCartStore } from '@/stores/listingCart'
import formatBalance from '@/utils/format/balance'

Expand Down
17 changes: 17 additions & 0 deletions components/common/shoppingCart/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { sum } from '@/utils/math'
import type { NFT, TokenId } from '@/components/rmrk/service/scheme'
import { chainPropListOf } from '@/utils/config/chain.config'
import { nameWithIndex } from '@/utils/nft'
import type { MakingOfferItem } from '@/components/offer/types'

export const prefixToToken = {
ksm: 'KSM',
Expand Down Expand Up @@ -90,6 +91,22 @@ export const nftToListingCartItem = (
}
}

export const nftToOfferItem = (nft: NFT & TokenId): MakingOfferItem => {
const { urlPrefix } = usePrefix()

return {
id: nft.id,
name: nameWithIndex(nft.name, nft.sn),
price: nft.price ?? '0',
urlPrefix: urlPrefix.value,
collection: nft.collection,
metadata: nft.metadata,
meta: nft.meta,
sn: nft.sn,
currentOwner: nft.currentOwner,
}
}

export const shoppingCartItemToListingCartItem = (
item: ShoppingCartItem,
floor = '',
Expand Down
Loading
Loading