Skip to content

Commit df14935

Browse files
committed
feat: enable sell and swap modals in demo mode
1 parent 6cd2a13 commit df14935

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/stores/Demo.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const useDemoStore = createStore({
110110
attachIframeListeners();
111111
replaceStakingFlow();
112112
replaceBuyNimFlow();
113-
enableSendModalInDemoMode();
113+
enableSellAndSwapModals();
114114

115115
listenForSwapChanges();
116116
},
@@ -1058,10 +1058,7 @@ const demoCSS = `
10581058
`;
10591059

10601060
/**
1061-
* Intercepts fetch request:
1062-
* - fastspot.apiEndpoint will return a mock limit response
1063-
* - estimate endpoint will return mock estimate response
1064-
* - the rest of requests will be passed through
1061+
* Intercepts fetch request for swaps
10651062
*/
10661063
function interceptFetchRequest() {
10671064
const originalFetch = window.fetch;
@@ -1307,17 +1304,17 @@ function getNetworkFeePerUnit(asset: string): number {
13071304
* Ensures the Send button in modals is always enabled in demo mode, regardless of network state.
13081305
* This allows users to interact with the send functionality without waiting for network sync.
13091306
*/
1310-
function enableSendModalInDemoMode() {
1307+
function enableSellAndSwapModals() {
13111308
const observer = new MutationObserver(() => {
1312-
// Target the send modal footer button
1313-
const sendButton = document.querySelector('.send-modal-footer .nq-button');
1314-
if (!sendButton) return;
1309+
// Target the send modal and swap footer button
1310+
const bottomButton = document.querySelector('.send-modal-footer .nq-button');
1311+
if (!bottomButton) return;
13151312

1316-
if (sendButton.hasAttribute('disabled')) {
1317-
sendButton.removeAttribute('disabled');
1313+
if (bottomButton.hasAttribute('disabled')) {
1314+
bottomButton.removeAttribute('disabled');
13181315

13191316
// Also remove any visual indications of being disabled
1320-
sendButton.classList.remove('disabled');
1317+
bottomButton.classList.remove('disabled');
13211318

13221319
// Also find and hide any sync message if shown
13231320
const footer = document.querySelector('.send-modal-footer');

0 commit comments

Comments
 (0)