Skip to content

Commit

Permalink
Change tip to modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Duddino committed Jan 16, 2025
1 parent 082c367 commit 4257e61
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 40 deletions.
57 changes: 57 additions & 0 deletions scripts/Tip.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<script setup>
import Modal from './Modal.vue';
const emit = defineEmits(['close']);
const props = defineProps({
show: Boolean,
body: String,
});
</script>

<template>
<Teleport to="body">
<Modal :show="show">
<template #body>
<div class="tipBody">
<p class="tipText">{{ body }}</p>
<i
class="fa-solid fa-xmark closeButton"
@click="emit('close')"
></i>
</div>
</template>
</Modal>
</Teleport>
</template>

<style>
.tipBody {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding: 1rem;
}
.tipText {
flex: 1;
/* Take available space for the text */
margin: 0;
font-size: 1rem;
}
.closeButton {
font-size: 1.25rem;
position: absolute;
top: 0.5rem;
/* Adjust vertically */
right: 0.5rem;
/* Adjust horizontally */
color: #999;
cursor: pointer;
transition: color 0.2s ease;
}
.closeButton:hover {
color: #666;
}
</style>
55 changes: 15 additions & 40 deletions scripts/dashboard/WalletBalance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { renderWalletBreakdown } from '../charting.js';
import { guiRenderCurrentReceiveModal } from '../contacts-book';
import { getNewAddress } from '../wallet.js';
import LoadingBar from '../Loadingbar.vue';
import Tip from '../Tip.vue';
import { sleep } from '../utils.js';
import iShieldLock from '../../assets/icons/icon_shield_lock_locked.svg';
Expand Down Expand Up @@ -105,10 +106,12 @@ const primaryImmatureBalanceStr = computed(() => {
return nCoins.toFixed(displayDecimals.value) + strPrefix + ticker.value;
});
const showImmatureBalanceTip = computed(
const showImmatureBalanceIcon = computed(
() => immatureColdBalance.value > 0 && publicMode.value
);
const showImmatureBalanceTip = ref(false);
const balanceValue = computed(() => {
// Convert our primary balance to the user's currency
const nCoins = (publicMode.value ? balance : shieldBalance).value / COIN;
Expand Down Expand Up @@ -351,14 +354,20 @@ function restoreWallet() {
>{{ primaryImmatureBalanceStr }}</span
>
<div
v-if="showImmatureBalanceTip"
v-if="showImmatureBalanceIcon"
class="immatureTooltip"
>
<i class="fa-solid fa-circle-info"></i>
<span class="immatureTooltiptext">{{
translation.immatureRewards
}}</span>
<i
class="fa-solid fa-circle-info"
@click="showImmatureBalanceTip = true"
>
</i>
</div>
<Tip
:body="translation.immatureRewards"
:show="showImmatureBalanceTip"
@close="showImmatureBalanceTip = false"
/>
</div>
</div>
<div
Expand Down Expand Up @@ -594,38 +603,4 @@ function restoreWallet() {
.immatureTooltip {
margin-left: 12px;
}
.immatureTooltip .immatureTooltiptext {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
position: absolute;
z-index: 1;
top: 19%;
/* Start at 50% down the parent */
left: 70%;
/* Keep it on the right side of the parent */
transform: translateY(-50%);
/* Vertically center the tooltip */
}
.immatureTooltip .immatureTooltiptext::after {
content: '';
position: absolute;
top: 50%;
/* Center the arrow vertically */
right: 100%;
/* Position the arrow on the left edge of the tooltip */
transform: translateY(-50%);
border-width: 5px;
border-style: solid;
border-color: transparent black transparent transparent;
}
.immatureTooltip:hover .immatureTooltiptext {
visibility: visible;
}
</style>

0 comments on commit 4257e61

Please sign in to comment.