24
24
</span >
25
25
26
26
<a
27
- v-if =" count"
27
+ v-if =" count && !isCollectionSwapDesired "
28
28
@click =" clearAll"
29
29
>
30
30
{{ $t('shoppingCart.clearAll') }}
46
46
:name =" nft.name"
47
47
:image =" sanitizeIpfsUrl(nft.meta.image)"
48
48
image-class =" border border-k-shade"
49
+ :removable =" !(isCollectionSwap && nft.id === null)"
49
50
@remove =" swapStore.removeStepItem(nft.id)"
50
51
/>
51
52
107
108
size =" large"
108
109
label =" Next"
109
110
variant =" primary"
110
- :disabled
111
+ :disabled = " disabled "
111
112
no-shadow
112
113
expanded
113
114
@click =" onNext"
@@ -133,23 +134,6 @@ type StepDetails = {
133
134
surchargeDirection: SwapSurchargeDirection
134
135
}
135
136
136
- const stepDetailsMap: Partial <Record <SwapStep , StepDetails >> = {
137
- [SwapStep .DESIRED ]: {
138
- title: ' swap.yourSwapList' ,
139
- surchargeTitle: ' swap.requestToken' ,
140
- nextRouteName: getSwapStepRouteName (SwapStep .OFFERED ),
141
- backRouteName: getSwapStepRouteName (SwapStep .COUNTERPARTY ),
142
- surchargeDirection: ' Receive' ,
143
- },
144
- [SwapStep .OFFERED ]: {
145
- title: ' swap.yourOffer' ,
146
- surchargeTitle: ' swap.addToken' ,
147
- nextRouteName: getSwapStepRouteName (SwapStep .REVIEW ),
148
- backRouteName: getSwapStepRouteName (SwapStep .DESIRED ),
149
- surchargeDirection: ' Send' ,
150
- },
151
- }
152
-
153
137
const props = defineProps <{
154
138
step: SwapStep
155
139
}>()
@@ -161,20 +145,40 @@ const { accountId } = useAuth()
161
145
const { decimals } = useChain ()
162
146
const { urlPrefix } = usePrefix ()
163
147
const { getChainIcon } = useIcon ()
148
+ const isCollectionSwap = computed (() => swap .value .isCollectionSwap )
149
+
150
+ const stepDetailsMap: ComputedRef <Partial <Record <SwapStep , StepDetails >>> = computed (() => ({
151
+ [SwapStep .DESIRED ]: {
152
+ title: ' swap.yourSwapList' ,
153
+ surchargeTitle: ' swap.requestToken' ,
154
+ nextRouteName: getSwapStepRouteName (SwapStep .OFFERED , isCollectionSwap .value ),
155
+ backRouteName: getSwapStepRouteName (SwapStep .COUNTERPARTY , isCollectionSwap .value ),
156
+ surchargeDirection: ' Receive' ,
157
+ },
158
+ [SwapStep .OFFERED ]: {
159
+ title: ' swap.yourOffer' ,
160
+ surchargeTitle: ' swap.addToken' ,
161
+ nextRouteName: getSwapStepRouteName (SwapStep .REVIEW , isCollectionSwap .value ),
162
+ backRouteName: getSwapStepRouteName (SwapStep .DESIRED , isCollectionSwap .value ),
163
+ surchargeDirection: ' Send' ,
164
+ },
165
+ }))
164
166
165
167
const target = ref ()
166
168
const amount = ref ()
167
169
const itemsContainer = ref ()
168
170
169
171
const isTargetVisible = useElementVisibility (target )
170
172
const stepItems = computed (() => swapStore .getStepItems (props .step ))
171
- const stepDetails = computed (() => stepDetailsMap [props .step ] as StepDetails )
173
+ const stepDetails = computed (() => stepDetailsMap . value [props .step ] as StepDetails )
172
174
const title = computed (() => $i18n .t (stepDetails .value .title ))
173
175
const surchargeTitle = computed (() => $i18n .t (stepDetails .value .surchargeTitle ))
174
176
const surchargeDisabled = computed (() => Boolean (swap .value .surcharge ))
175
177
const stepHasSurcharge = computed (() => swap .value .surcharge ?.direction === stepDetails .value .surchargeDirection )
176
178
const count = computed (() => stepItems .value .length + (stepHasSurcharge .value ? 1 : 0 ))
177
179
const isOverOneToOneSwap = computed (() => swap .value .offered .length > swap .value .desired .length && props .step === SwapStep .OFFERED )
180
+ const isCollectionSwapDesired = computed (() => isCollectionSwap .value && props .step === SwapStep .DESIRED )
181
+
178
182
const disabled = computed (() => {
179
183
if ((! accountId .value && props .step === SwapStep .OFFERED ) || isOverOneToOneSwap .value ) {
180
184
return true
0 commit comments