-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
feat: New swap tables & Swap Modal follow up #11389
Merged
Merged
Changes from 21 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
834900d
add(TradeActivityTable.vue): init new swap tables
hassnian 852d581
Merge branch 'issue-11116' into issue-11385
hassnian 43ac2c6
fix(locales/en.json): unify trade keys
hassnian 351f926
add(TradeActivityTable.vue): resposive `swap` new style
hassnian c68d31c
fix(TradeActivityTable.vue): `offer` type trades view
hassnian 78094cb
Merge branch 'issue-11116' into issue-11385
hassnian eb9e6df
add(trades): responsive design across trade types
hassnian 4970937
fix(GalleryItemTradesTable.vue): update `surcharge` prop
hassnian 9a064fc
ref(trade/types.ts): make `surcharge` default key of `BaseTrade`
hassnian f3bf93a
fix(GalleryItemTradesTable.vue): counter swaps not working from galle…
hassnian 87914bd
add(SurchargeTag.vue): change tag color and text based on surcharge d…
hassnian a8140d8
fix(NeoTag.vue): `k-grey` variant not working
hassnian 9b83abf
ref(ActivityTableRowItem.vue): show trade item name while loading met…
hassnian 83625f0
ref(trades): `useTradeType.ts ` composable
hassnian af43ab7
fix(OverviewModalDetails.vue): always show expiration
hassnian 7e901d8
fix(TradeActivityTable.vue): swap items columns names based on tab type
hassnian 6f0be79
add(trades) trade modal with surcharge in item :
hassnian 57d2e7e
Merge branch 'main' into issue-11385
hassnian 1bc391b
add(TradeActivityTableRow.vue): mobile cols labels
hassnian 3e8d014
Merge branch 'main' into issue-11385
Jarsen136 32f05bb
Merge branch 'main' into issue-11385
hassnian 61577b0
fix(TokenInCollection.vue): make `title` optional prop
hassnian ab28036
fix(ActivityTable/RowItem.vue): `id` is undefined
hassnian 7364c52
Merge branch 'main' into issue-11385
hassnian 73ace93
Merge branch 'main' into issue-11385
hassnian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<template> | ||
<div | ||
v-if="item" | ||
class="flex items-center justify-between w-min" | ||
:class="containerSpacing" | ||
> | ||
<nuxt-link | ||
:to="itemPath" | ||
class="h-[50px]" | ||
> | ||
<BaseMediaItem | ||
class="border border-k-shade w-[3.125rem] h-[3.125rem] !shadow-none" | ||
:alt="item.name" | ||
:src="image" | ||
:animation-src="!image ? animationUrl : undefined" | ||
preview | ||
is-detail | ||
/> | ||
</nuxt-link> | ||
|
||
<div class="flex flex-col justify-between"> | ||
<nuxt-link | ||
class="is-ellipsis inline-block" | ||
:to="itemPath" | ||
> | ||
<span class="font-bold overflow-hidden"> | ||
{{ item.name }} | ||
</span> | ||
</nuxt-link> | ||
|
||
<TradeActivityTableSurchargeTag :value="surcharge" /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { fetchNft } from '@/components/items/ItemsGrid/useNftActions' | ||
import type { SwapSurcharge } from '@/composables/transaction/types' | ||
|
||
type ItemMedia = { image: string, animationUrl: string } | ||
|
||
const props = withDefaults( | ||
defineProps<{ | ||
item: { id: string, name: string } | undefined | ||
surcharge: SwapSurcharge | undefined | ||
containerSpacing?: string | ||
}>(), | ||
{ | ||
containerSpacing: 'gap-5', | ||
}, | ||
) | ||
|
||
const image = ref() | ||
const animationUrl = ref() | ||
|
||
const { urlPrefix } = usePrefix() | ||
|
||
const itemPath = computed(() => `/${urlPrefix.value}/gallery/${props.id}`) | ||
|
||
const getItem = async (id: string): Promise<ItemMedia> => { | ||
const nft = await fetchNft(id) | ||
|
||
if (!nft.metadata) { | ||
return { | ||
image: '', | ||
animationUrl: '', | ||
} | ||
} | ||
|
||
const meta = await getNftMetadata(nft) | ||
|
||
return { | ||
image: meta.image, | ||
animationUrl: meta.animationUrl, | ||
} | ||
} | ||
|
||
watch(() => props.item?.id, async (id) => { | ||
if (id) { | ||
const item = await getItem(id) | ||
image.value = item.image | ||
animationUrl.value = item.animationUrl | ||
} | ||
}, { immediate: true }) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<template> | ||
<div class="bg-neutral-3 dark:bg-neutral-11 flex flex-col rounded-xl h-full !px-3"> | ||
<span class="text-k-grey capitalize"> {{ $t('trades.anyNftFrom') }} </span> | ||
<div class="flex items-center gap-2"> | ||
<nuxt-link | ||
:to="`/${urlPrefix}/collection/${considered.id}`" | ||
class="font-bold" | ||
>{{ considered.name }} | ||
</nuxt-link> | ||
|
||
<TradeActivityTableSurchargeTag :value="surcharge" /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import type { TradeConsidered } from '@/components/trade/types' | ||
import type { SwapSurcharge } from '@/composables/transaction/types' | ||
|
||
defineProps<{ | ||
considered: TradeConsidered | ||
surcharge: SwapSurcharge | undefined | ||
}>() | ||
|
||
const { urlPrefix } = usePrefix() | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<template> | ||
<NeoTag | ||
v-if="config" | ||
size="small" | ||
:variant="config.variant" | ||
class="w-min" | ||
> | ||
<span> {{ config.label }} </span> | ||
</NeoTag> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import NeoTag from '@/components/shared/gallery/NeoTag.vue' | ||
import type { SwapSurcharge } from '@/composables/transaction/types' | ||
|
||
const props = defineProps<{ | ||
value: SwapSurcharge | undefined | ||
}>() | ||
|
||
const { $i18n } = useNuxtApp() | ||
const { format: formatPrice } = useFormatAmount() | ||
const { amount } = formatPrice(props.value?.amount || '') | ||
|
||
const config = computed(() => { | ||
if (!props.value) { | ||
return | ||
} | ||
|
||
return props.value.direction === 'Receive' | ||
? ({ label: $i18n.t('trades.requests', [amount]), variant: 'k-orange' as const }) | ||
: ({ label: `+${amount}`, variant: 'k-blue-2' as const }) | ||
}) | ||
</script> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated