Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

misc/feat: copy button in wallet table, redirect & success message #1053

Merged
merged 8 commits into from Feb 6, 2019
7 changes: 6 additions & 1 deletion src/renderer/components/Button/ButtonClipboard.vue
Expand Up @@ -36,6 +36,11 @@ export default {
type: String,
required: false,
default: '0 0 12 16'
},
subject: {
type: String,
required: false,
default: ''
}
},

Expand All @@ -51,7 +56,7 @@ export default {
// when using portals. Probably is this bug:
// https://github.com/LinusBorg/portal-vue/issues/159
if (this.$i18n) {
this.copyText = this.$t('BUTTON_CLIPBOARD.COPY_TO_CLIPBOARD')
this.copyText = this.$t('BUTTON_CLIPBOARD.COPY_TO_CLIPBOARD', [this.subject])
}
},

Expand Down
21 changes: 17 additions & 4 deletions src/renderer/components/Wallet/WalletTable.vue
Expand Up @@ -75,8 +75,18 @@
v-else-if="data.column.field === 'actions'"
class="flex items-center justify-center"
>
<span class="ml-1">
<ButtonClipboard
:value="data.row.address"
view-box="0 0 16 16"
:subject="$t('COMMON.ADDRESS').toLowerCase()"
class="hover:text-red text-theme-page-text-light p-1"
/>
</span>

<span>
<button
v-tooltip="$t('WALLET_TABLE.RENAME')"
class="font-semibold flex text-xs hover:text-red text-theme-page-text-light p-1"
@click="renameRow(data.row)"
>
Expand All @@ -88,10 +98,8 @@
</span>

<span
v-tooltip="{
content: data.row.isLedger ? $t('WALLET_TABLE.NO_DELETE') : '',
placement: 'left'
}"
v-tooltip="data.row.isLedger ? $t('WALLET_TABLE.NO_DELETE') : $t('WALLET_TABLE.DELETE')"
class="mr-1"
>
<button
class="font-semibold flex text-xs hover:text-red text-theme-page-text-light p-1"
Expand All @@ -117,6 +125,7 @@
</template>

<script>
import { ButtonClipboard } from '@/components/Button'
import SvgIcon from '@/components/SvgIcon'
import TableWrapper from '@/components/utils/TableWrapper'
import { WalletIdenticon } from '@/components/Wallet'
Expand All @@ -125,6 +134,7 @@ export default {
name: 'WalletTable',

components: {
ButtonClipboard,
SvgIcon,
TableWrapper,
WalletIdenticon
Expand Down Expand Up @@ -241,4 +251,7 @@ export default {
transition: 0.5s;
opacity: 0.5;
}
.WalletTable button {
transition: color 0.2s;
}
</style>
10 changes: 7 additions & 3 deletions src/renderer/i18n/locales/en-US.js
@@ -1,5 +1,6 @@
export default {
COMMON: {
ADDRESS: 'Address',
ALL: 'All',
APP_NAME: 'ARK Desktop Wallet',
APPEARANCE: 'Appearance',
Expand Down Expand Up @@ -267,7 +268,7 @@ export default {

BUTTON_CLIPBOARD: {
DONE: 'Copied!',
COPY_TO_CLIPBOARD: 'Copy to clipboard',
COPY_TO_CLIPBOARD: 'Copy {0} to clipboard',
NOT_SUPPORTED: 'Copying to clipboard is not supported'
},

Expand Down Expand Up @@ -442,7 +443,8 @@ export default {
NAME: 'Contact name (optional)',
NAME_INFO: 'Info.:',
NAME_DESCRIPTION: 'Contact name is not required, but it can be used for your convenience',
FAILED: 'Failed to create contact'
FAILED: 'Failed to create contact',
SUCCESS: '\'{0}\' has been added to your contacts'
},

DASHBOARD: {
Expand Down Expand Up @@ -890,7 +892,9 @@ export default {
},

WALLET_TABLE: {
ACTIONS: 'Actions',
DELETE: 'Delete',
NO_DELETE: 'Ledger wallets cannot be deleted',
ACTIONS: 'Actions'
RENAME: 'Rename'
}
}
8 changes: 7 additions & 1 deletion src/renderer/pages/Contact/ContactNew.vue
Expand Up @@ -125,7 +125,13 @@ export default {
profileId: this.session_profile.id,
isContact: true
})
this.$router.push({ name: 'wallet-show', params: { address } })

const name = this.schema.name.length
? this.wallet_name(address)
: this.wallet_truncate(address)

this.$success(this.$t('PAGES.CONTACT_NEW.SUCCESS', [name]))
this.$router.push({ name: 'contacts' })
} catch (error) {
this.$error(`${this.$t('PAGES.CONTACT_NEW.FAILED')}: ${error.message}`)
}
Expand Down