Skip to content
This repository was archived by the owner on Oct 8, 2022. It is now read-only.

Commit e8937ab

Browse files
committed
Treasury: updated add tip modal
1 parent 8ab191e commit e8937ab

File tree

3 files changed

+17
-34
lines changed

3 files changed

+17
-34
lines changed

dashboard/src/components/shared/modals/Proposal.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export default class ProposalModal extends Vue {
4444
private accountId: string = '';
4545
private beneficiaryId: string = '';
4646
private password: string = '';
47-
private beneficiary: any = {};
4847
private amount: number = 0;
4948
5049
public async shipIt() {
@@ -67,7 +66,7 @@ export default class ProposalModal extends Vue {
6766
}
6867
6968
get disabled() {
70-
return !this.accountId || !this.beneficiary || !this.amount
69+
return !this.accountId || !this.beneficiaryId || !this.amount
7170
}
7271
7372
}

dashboard/src/components/shared/modals/Tip.vue

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
<template>
22
<ModalWrapper label="Add Tip" icon="plus">
33
<div>
4-
<Dropdown mode="accounts" @selected="handleAccountSelection" />
5-
<Dropdown mode="accounts" @selected="handleBeneficiary" />
6-
<b-field label="reason" class="password-wrapper">
4+
<AccountSelect label="submit with account" v-model="accountId" />
5+
<AccountSelect label="beneficiary" v-model="beneficiaryId" />
6+
<b-field label="tip reason" >
77
<b-input v-model="reason" > </b-input>
88
</b-field>
9-
10-
<b-field label="password 🤫 magic spell" class="password-wrapper">
11-
<b-input v-model="password" type="password" password-reveal> </b-input>
12-
</b-field>
9+
<PasswordInput v-model="password" />
1310

1411
<b-button
1512
type="is-primary"
@@ -33,51 +30,43 @@ import { KeyringPair } from '@polkadot/keyring/types';
3330
import { notificationTypes, showNotification } from '@/utils/notification';
3431
import exec from '@/utils/transactionExecutor';
3532
import { urlBuilderTransaction } from '@/utils/explorerGuide';
36-
import C from '@vue-polkadot/vue-api'
33+
import Connector from '@vue-polkadot/vue-api';
34+
import AccountSelect from '@/components/shared/AccountSelect.vue'
35+
import PasswordInput from '@/components/shared/PasswordInput.vue';
3736
3837
@Component({
3938
components: {
4039
ModalWrapper,
41-
Dropdown,
40+
AccountSelect,
41+
PasswordInput
4242
},
4343
})
4444
export default class TipModal extends Vue {
45-
private account: any = {};
45+
private accountId: string = '';
46+
private beneficiaryId: string = '';
4647
private password: string = '';
47-
private beneficiary: any = {};
4848
private reason: string = '';
4949
50-
51-
52-
public handleAccountSelection(account: KeyringPair) {
53-
this.account = account;
54-
}
55-
56-
public handleBeneficiary(account: KeyringPair) {
57-
console.log(account.address)
58-
this.beneficiary = account;
59-
}
60-
6150
public async shipIt() {
62-
const { api } = C.getInstance()
51+
const { api } = Connector.getInstance();
6352
6453
if (!api) {
6554
return;
6655
}
6756
6857
try {
69-
const { reason, beneficiary } = this;
58+
const { reason, beneficiaryId, accountId, password } = this;
7059
showNotification('Dispatched');
71-
const tx = await exec(this.account, this.password, api.tx.treasury.reportAwesome, [reason, beneficiary.address]);
72-
// showNotification(`Second ${referendumId.toString()}`, { ...notificationTypes.success, onAction: this.onAction() });
60+
const tx = await exec(accountId, this.password, api.tx.treasury.reportAwesome, [reason, beneficiaryId]);
61+
showNotification('[TIP] Success', notificationTypes.success);
7362
} catch (e) {
7463
showNotification(e, notificationTypes.danger);
7564
}
7665
7766
}
7867
7968
get disabled() {
80-
return !this.account || !this.password || !this.beneficiary || !this.reason
69+
return !this.accountId || !this.beneficiaryId || !this.reason
8170
}
8271
8372
}

dashboard/src/components/treasury/Tip.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ export default class Tip extends Vue {
6464
</script>
6565

6666
<style scoped>
67-
.proposal-adress__overflow {
68-
white-space: nowrap;
69-
overflow: hidden;
70-
text-overflow: ellipsis;
71-
}
7267
7368
.proposal-tip__reason {
7469
word-break: break-word;

0 commit comments

Comments
 (0)