diff --git a/apps/block_scout_web/assets/js/lib/modals.js b/apps/block_scout_web/assets/js/lib/modals.js index 563fff4a15..182158447d 100644 --- a/apps/block_scout_web/assets/js/lib/modals.js +++ b/apps/block_scout_web/assets/js/lib/modals.js @@ -11,15 +11,27 @@ $(function () { }) $('.js-stake-stake').on('click', function () { - $('#stakeModal').modal() - const progress = parseInt($('.js-stakes-progress-data-progress').text()) - const total = parseInt($('.js-stakes-progress-data-total').text()) + const modal = '#stakeModal' + const progress = parseInt($(`${modal} .js-stakes-progress-data-progress`).text()) + const total = parseInt($(`${modal} .js-stakes-progress-data-total`).text()) - setupStakesProgress(progress, total) + $(modal).modal() + + setupStakesProgress(progress, total, modal) + }) + + $('.js-withdraw-stake').on('click', function () { + const modal = '#withdrawModal' + const progress = parseInt($(`${modal} .js-stakes-progress-data-progress`).text()) + const total = parseInt($(`${modal} .js-stakes-progress-data-total`).text()) + + $(modal).modal() + + setupStakesProgress(progress, total, modal) }) - function setupStakesProgress (progress, total) { - const stakeProgress = $('#stakeProgress') + function setupStakesProgress (progress, total, modal) { + const stakeProgress = $(`${modal} .js-stakes-progress`) const primaryColor = $('.btn-full-primary').css('background-color') const backgroundColors = [ primaryColor, diff --git a/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_btn_stake.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_btn_stake.html.eex new file mode 100644 index 0000000000..b02bde6fea --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_btn_stake.html.eex @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_btn_stake_more.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_btn_stake_more.html.eex deleted file mode 100644 index 3e5cf11cd2..0000000000 --- a/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_btn_stake_more.html.eex +++ /dev/null @@ -1,9 +0,0 @@ - \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_btn_withdraw.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_btn_withdraw.html.eex new file mode 100644 index 0000000000..3be7ca95d3 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_btn_withdraw.html.eex @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_modal_become_candidate.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_modal_become_candidate.html.eex index 7389f80d20..9dc9d6e953 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_modal_become_candidate.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_modal_become_candidate.html.eex @@ -1,4 +1,4 @@ -