Skip to content

Commit

Permalink
kodadot#457 Adding tip in user profile
Browse files Browse the repository at this point in the history
  • Loading branch information
prachi00 committed Sep 21, 2021
1 parent c20d615 commit 5c46b90
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 5 deletions.
27 changes: 27 additions & 0 deletions src/components/transfer/DonationButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template>
<b-button
type="is-primary"
icon-left="gift"
outlined
@click="goToTransfer"
>
{{ $t("Gift 10$") }}
</b-button>
</template>


<script lang="ts">
import { Component, Vue, Prop } from "vue-property-decorator";
@Component({})
export default class DonationButton extends Vue {
@Prop() public address!: string;
public goToTransfer() {
this.$router.push({
name: "transfer",
query: { target: this.address, usdamount: "10" },
});
}
}
</script>

36 changes: 36 additions & 0 deletions src/components/transfer/Transfer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
<section>
<br />
<Loader v-model="isLoading" :status="status" />
<router-link :to="`rmrk/u/${destinationAddress}`" class="linkartist" v-if="this.$route.query.target">
<b-icon icon="chevron-left" size="is-small" class="linkartist--icon"></b-icon>
Go to artist's profile
</router-link>
<div class="box">
<div class="info">
<p class="title is-size-3">
Expand All @@ -15,6 +19,17 @@
<b-field>
<Auth />
</b-field>
<div class="box--target-info" v-if="this.$route.query.target">
Your donation will be sent to:
<a
:href="`https://kusama.subscan.io/account/${destinationAddress}`"
target="_blank"
rel="noopener noreferrer"
class="box--target-info--url"
>
<Identity ref="identity" :address="destinationAddress" inline />
</a>
</div>

<b-field>
{{ $t("general.balance") }}
Expand Down Expand Up @@ -81,6 +96,7 @@ import { calculateUsdFromKsm, calculateKsmFromUsd } from '@/utils/calculation'
Auth: () => import('@/components/shared/Auth.vue'),
BalanceInput: () => import('@/components/shared/BalanceInput.vue'),
ReadOnlyBalanceInput: () => import('@/components/shared/ReadOnlyBalanceInput.vue'),
Identity: () => import('@/components/shared/format/Identity.vue'),
Loader: () => import('@/components/shared/Loader.vue'),
AddressInput: () => import('@/components/shared/AddressInput.vue'),
Money: () => import('@/components/shared/format/Money.vue')
Expand Down Expand Up @@ -140,6 +156,12 @@ export default class Transfer extends Mixins(
if (query.amount) {
this.price = Number(query.amount);
}
if (query.usdamount) {
this.usdValue = Number(query.usdamount);
// getting ksm value from the usd value
this.price = calculateKsmFromUsd(this.$store.getters.getCurrentKSMValue, this.usdValue);
}
}
public async submit(): Promise<void> {
Expand Down Expand Up @@ -264,5 +286,19 @@ export default class Transfer extends Mixins(
flex-direction: column;
}
}
&--target-info {
margin-bottom: 0.8rem;
&--url {
font-weight: bold;
}
}
}
.linkartist {
padding-left: 1.25rem;
display: flex;
align-items: center;
&--icon {
margin-right: 0.5rem;
}
}
</style>
8 changes: 4 additions & 4 deletions src/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
faTrash, faCloudDownloadAlt, faKey,
faExternalLinkAlt, faUpload, faUsers,
faQuestionCircle, faMinus, faSearch,
faInfoCircle, faChevronDown, faChevronUp,
faInfoCircle, faChevronDown, faChevronUp, faChevronLeft,
faHeart, faCaretDown, faInfo,
faShareSquare, faCopy, faBookmark,
faLink, faLanguage,
Expand All @@ -18,7 +18,7 @@ import {
faCalendar, faCalculator, faEnvelope,
faArrowsAlt, faCompressAlt, faCompressArrowsAlt,
faAngleLeft, faAngleRight, faReply,
faExternalLinkSquareAlt,
faExternalLinkSquareAlt, faGift,
faEyeSlash, faArrowUp, faUser, faGlobe, faExclamationCircle,

} from '@fortawesome/free-solid-svg-icons';
Expand All @@ -44,7 +44,7 @@ library.add(
faKey, faExternalLinkAlt, faUpload,
faUsers, faQuestionCircle, faMinus,
faSearch, faInfoCircle, faChevronDown,
faChevronUp, faHeart,
faChevronUp, faChevronLeft, faHeart,
faCaretDown, faInfo, faShareSquare,
faBookmark, faLink,
faLanguage, faQuestion, faEye,
Expand All @@ -58,7 +58,7 @@ library.add(
faExclamationTriangle, faCalculator,
faArrowsAlt, faCompressAlt, faCompressArrowsAlt,
faEyeSlash, faArrowUp, faUser, faGlobe,
faExclamationCircle,
faExclamationCircle, faGift,

// Social
faTwitter, faTelegram, faFacebook,
Expand Down
5 changes: 4 additions & 1 deletion src/views/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
>
<Identity ref="identity" :address="id" inline emit @change="handleIdentity" />
</a>
<DonationButton :address="id" />
</div>
<div class="column">
<OnChainProperty
Expand Down Expand Up @@ -127,7 +128,9 @@ const components = {
Pagination: () => import('@/components/rmrk/Gallery/Pagination.vue'),
OnChainProperty: () => import('@/views/OnChainProperty.vue'),
PaginatedCardList: () =>
import('@/components/rmrk/Gallery/PaginatedCardList.vue')
import('@/components/rmrk/Gallery/PaginatedCardList.vue'),
DonationButton: () => import('@/components/transfer/DonationButton.vue'),
};
const eq = (tab: string) => (el: string) => tab === el;
Expand Down

0 comments on commit 5c46b90

Please sign in to comment.