2018-09-08 23:44:19 +02:00
|
|
|
<template>
|
2020-03-03 04:16:23 +01:00
|
|
|
<q-item class="address-header">
|
2018-09-08 23:44:19 +02:00
|
|
|
<q-item-main class="self-start">
|
2020-03-03 04:16:23 +01:00
|
|
|
<q-item-tile sublabel class="title non-selectable">{{ title }}</q-item-tile>
|
|
|
|
<q-item-tile class="break-all" label>{{ address }}</q-item-tile>
|
2020-03-25 23:21:04 +01:00
|
|
|
<q-item-tile v-if="paymentId" sublabel>{{ $t("fieldLabels.paymentId") }}: {{ paymentId }}</q-item-tile>
|
2020-03-03 04:16:23 +01:00
|
|
|
<q-item-tile v-if="extra" sublabel class="extra non-selectable">{{ extra }}</q-item-tile>
|
2018-09-08 23:44:19 +02:00
|
|
|
</q-item-main>
|
2019-02-22 04:46:15 +01:00
|
|
|
<q-item-side v-if="showCopy">
|
2020-03-03 04:16:23 +01:00
|
|
|
<q-btn ref="copy" color="primary" style="width:25px;" size="sm" icon="file_copy" @click="copyAddress">
|
|
|
|
<q-tooltip anchor="center left" self="center right" :offset="[5, 10]">
|
|
|
|
{{ $t("menuItems.copyAddress") }}
|
|
|
|
</q-tooltip>
|
|
|
|
</q-btn>
|
2018-10-27 18:18:28 +02:00
|
|
|
</q-item-side>
|
2018-11-02 19:31:36 +01:00
|
|
|
|
|
|
|
<q-context-menu>
|
2020-03-03 04:16:23 +01:00
|
|
|
<q-list link separator style="min-width: 150px; max-height: 300px;">
|
|
|
|
<q-item v-close-overlay @click.native="copyAddress($event)">
|
|
|
|
<q-item-main :label="$t('menuItems.copyAddress')" />
|
|
|
|
</q-item>
|
|
|
|
</q-list>
|
2018-11-02 19:31:36 +01:00
|
|
|
</q-context-menu>
|
2020-03-03 04:16:23 +01:00
|
|
|
</q-item>
|
2018-09-08 23:44:19 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-03-03 04:16:23 +01:00
|
|
|
const { clipboard } = require("electron");
|
2018-09-08 23:44:19 +02:00
|
|
|
export default {
|
2020-03-03 04:16:23 +01:00
|
|
|
name: "AddressHeader",
|
|
|
|
props: {
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
2018-09-08 23:44:19 +02:00
|
|
|
},
|
2020-03-03 04:16:23 +01:00
|
|
|
address: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
2018-09-08 23:44:19 +02:00
|
|
|
},
|
2020-03-03 04:16:23 +01:00
|
|
|
paymentId: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: undefined
|
|
|
|
},
|
|
|
|
extra: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: undefined
|
2018-10-27 18:18:28 +02:00
|
|
|
},
|
2020-03-03 04:16:23 +01:00
|
|
|
showCopy: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: true
|
2018-09-08 23:44:19 +02:00
|
|
|
}
|
2020-03-03 04:16:23 +01:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
copyAddress(event) {
|
|
|
|
if (event) {
|
|
|
|
event.stopPropagation();
|
|
|
|
}
|
|
|
|
if (this.$refs.copy) {
|
|
|
|
this.$refs.copy.$el.blur();
|
|
|
|
}
|
|
|
|
clipboard.writeText(this.address);
|
2020-03-25 23:21:04 +01:00
|
|
|
if (this.paymentId) {
|
2020-03-03 04:16:23 +01:00
|
|
|
this.$q
|
|
|
|
.dialog({
|
|
|
|
title: this.$t("dialog.copyAddress.title"),
|
|
|
|
message: this.$t("dialog.copyAddress.message"),
|
|
|
|
ok: {
|
|
|
|
label: this.$t(`dialog.copyAddress.ok`)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(() => null)
|
|
|
|
.then(() => {
|
|
|
|
this.$q.notify({
|
|
|
|
type: "positive",
|
|
|
|
timeout: 1000,
|
|
|
|
message: this.$t("notification.positive.addressCopied")
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.$q.notify({
|
|
|
|
type: "positive",
|
|
|
|
timeout: 1000,
|
|
|
|
message: this.$t("notification.positive.addressCopied")
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2018-09-08 23:44:19 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.address-header {
|
2020-03-03 04:16:23 +01:00
|
|
|
padding: 0;
|
|
|
|
img {
|
|
|
|
float: left;
|
|
|
|
margin-right: 15px;
|
|
|
|
}
|
|
|
|
h3 {
|
|
|
|
margin: 15px 0 0;
|
|
|
|
}
|
|
|
|
p {
|
|
|
|
word-break: break-all;
|
|
|
|
}
|
|
|
|
&::after {
|
|
|
|
content: "";
|
|
|
|
clear: both;
|
|
|
|
display: table;
|
|
|
|
}
|
2018-09-08 23:44:19 +02:00
|
|
|
|
2020-03-03 04:16:23 +01:00
|
|
|
.q-item-main {
|
|
|
|
.q-item-label {
|
|
|
|
font-weight: 400;
|
|
|
|
}
|
2019-02-22 04:46:15 +01:00
|
|
|
|
2020-03-03 04:16:23 +01:00
|
|
|
.q-item-sublabel,
|
|
|
|
.q-list-header {
|
|
|
|
font-size: 13px;
|
|
|
|
}
|
2019-02-22 04:46:15 +01:00
|
|
|
|
2020-03-03 04:16:23 +01:00
|
|
|
.title {
|
|
|
|
font-size: 14px;
|
|
|
|
margin-bottom: 2px;
|
|
|
|
}
|
2019-02-22 04:46:15 +01:00
|
|
|
|
2020-03-03 04:16:23 +01:00
|
|
|
.extra {
|
|
|
|
margin-top: 8px;
|
2018-09-08 23:44:19 +02:00
|
|
|
}
|
2020-03-03 04:16:23 +01:00
|
|
|
}
|
2018-09-08 23:44:19 +02:00
|
|
|
}
|
|
|
|
</style>
|