Skip to content

Commit

Permalink
fix: do not show options until amount is inputed
Browse files Browse the repository at this point in the history
  • Loading branch information
annipi authored and lserra-iov committed Nov 4, 2024
1 parent 5ea3248 commit 4a545ec
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/common/store/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ export const FLYOVER_PEGOUT_SET_BTC_ADDRESS = 'FLYOVER_PEGOUT_SET_BTC_ADDRESS';
export const FLYOVER_PEGOUT_SET_TX_HASH = 'FLYOVER_PEGOUT_SET_TX_HASH';
export const FLYOVER_PEGOUT_SET_SELECTED_QUOTE = 'FLYOVER_PEGOUT_SET_SELECTED_QUOTE';
export const FLYOVER_PEGOUT_SET_QUOTES_DIFFERENCES = 'FLYOVER_PEGOUT_SET_QUOTES_DIFFERENCES';
export const FLYOVER_PEGOUT_SET_RESPONDING = 'FLYOVER_PEGOUT_SET_RESPONDING';

// Flyover PegIn mutations
export const FLYOVER_PEGIN_SET_PROVIDERS = 'FLYOVER_PEGIN_SET_PROVIDERS';
Expand Down
1 change: 0 additions & 1 deletion src/common/types/Flyover/FlyoverPegout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ export interface FlyoverPegoutState {
flyoverService: FlyoverService;
txHash?: string;
selectedQuoteHash: string;
isResponding: boolean;
}
1 change: 0 additions & 1 deletion src/common/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export const getClearFlyoverPegoutState = (): FlyoverPegoutState => ({
flyoverService: markRaw(new FlyoverService()),
selectedQuoteHash: '',
differences: [],
isResponding: false,
});

export const getClearFlyoverPeginState = (): FlyoverPeginState => ({
Expand Down
8 changes: 5 additions & 3 deletions src/common/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@
</v-btn>
</div>
<div class="d-flex justify-start align-baseline flex-wrap ml-6">
<span class="text-body-1">To learn about the various RBTC access methods, visit </span>
<v-btn variant="text" color="orange" density="compact" class="pa-0 text-body-1 mr-2"
href="https://rootstock.io/rbtc/" target="_blank">
<span class="text-body-1 mr-2 mt-4">
To learn about the various RBTC access methods, visit
</span>
<v-btn variant="text" color="orange" density="compact" class="pa-0 text-body-1"
href="https://rootstock.io/rbtc/" target="_blank">
RBTC Webpage
</v-btn>
</div>
Expand Down
11 changes: 4 additions & 7 deletions src/pegout/components/PegoutForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
">Select Mode</span>
</v-row>
<v-row>
<v-col cols="6" v-if="pegoutQuotes.length === 0" >
<v-col cols="6" v-if="!flyoverResponded" >
<pegout-option class="mr-2" flyover-not-available
:option-type="pegoutType.FLYOVER">
<template v-slot>
Expand Down Expand Up @@ -189,7 +189,6 @@ export default defineComponent({
const getFlyoverProviders = useAction('flyoverPegout', constants.FLYOVER_PEGOUT_GET_PROVIDERS);
const quotes = useStateAttribute<Record<number, QuotePegOut2WP[]>>('flyoverPegout', 'quotes');
const quoteDifferences = useStateAttribute<Array<ObjectDifference>>('flyoverPegout', 'differences');
const isFlyoverResponding = useStateAttribute<boolean>('flyoverPegout', 'isResponding');
const selectedQuote = useGetter<QuotePegOut2WP>('flyoverPegout', constants.FLYOVER_PEGOUT_GET_SELECTED_QUOTE);
const estimatedBtcToReceive = useGetter<SatoshiBig>('pegOutTx', constants.PEGOUT_TX_GET_ESTIMATED_BTC_TO_RECEIVE);
const isEnoughBalance = useGetter<boolean>('pegOutTx', constants.PEGOUT_TX_IS_ENOUGH_BALANCE);
Expand Down Expand Up @@ -285,6 +284,8 @@ export default defineComponent({
return isFlyoverReady.value;
});
const flyoverResponded = computed(() => pegoutQuotes.value.length > 0 || props.flyoverEnabled);
function handlePegoutError(error: ServiceError) {
txError.value = error;
showTxErrorDialog.value = true;
Expand Down Expand Up @@ -402,10 +403,6 @@ export default defineComponent({
}
}
if (!props.flyoverEnabled) {
showStep.value = true;
}
const amountToReceive = computed(() => {
let finalAmount = '';
if (selectedOption.value) {
Expand Down Expand Up @@ -464,9 +461,9 @@ export default defineComponent({
flyoverService,
executeRecaptcha,
nativeQuote,
isFlyoverResponding,
pegoutType: constants.pegoutType,
isValid,
flyoverResponded,
};
},
});
Expand Down
4 changes: 0 additions & 4 deletions src/pegout/store/FlyoverPegout/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ export const actions: ActionTree<FlyoverPegoutState, RootState> = {
const providers: LiquidityProvider2WP[] = await state.flyoverService.getProviders();
commit(constants.FLYOVER_PEGOUT_SET_PROVIDERS, providers);
result = constants.FlyoverCallResult.SUCCESS;
commit(constants.FLYOVER_PEGOUT_SET_RESPONDING, true);
} catch (e) {
console.error(`Error getting flyover providers: ${e}`);

Check warning on line 27 in src/pegout/store/FlyoverPegout/actions.ts

View workflow job for this annotation

GitHub Actions / checkout-and-build

Unexpected console statement

Check warning on line 27 in src/pegout/store/FlyoverPegout/actions.ts

View workflow job for this annotation

GitHub Actions / checkout-and-build

Unexpected console statement
commit(constants.FLYOVER_PEGOUT_SET_RESPONDING, false);
} finally {
try {
await ApiService.registerFlyoverCall({ ...flyoverCallPayload, result } as FlyoverCall);
Expand Down Expand Up @@ -81,10 +79,8 @@ export const actions: ActionTree<FlyoverPegoutState, RootState> = {
});
result = constants.FlyoverCallResult.SUCCESS;
commit(constants.FLYOVER_PEGOUT_SET_QUOTES, quotesByProvider);
commit(constants.FLYOVER_PEGOUT_SET_RESPONDING, true);
resolve();
} catch (e) {
commit(constants.FLYOVER_PEGOUT_SET_RESPONDING, false);
reject();
} finally {
try {
Expand Down
3 changes: 0 additions & 3 deletions src/pegout/store/FlyoverPegout/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,4 @@ export const mutations: MutationTree<FlyoverPegoutState> = {
[constants.FLYOVER_PEGOUT_SET_QUOTES_DIFFERENCES]: (state, differences) => {
state.differences = differences;
},
[constants.FLYOVER_PEGOUT_SET_RESPONDING]: (state, isResponding) => {
state.isResponding = isResponding;
},
};

0 comments on commit 4a545ec

Please sign in to comment.