Skip to content

Commit

Permalink
Hide veto button for confirmed reimbursements
Browse files Browse the repository at this point in the history
  • Loading branch information
raucao committed Mar 7, 2024
1 parent c14168e commit 49bd48c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions app/components/reimbursement-item/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ export default class ReimbursementItemComponent extends Component {
return config.ipfs.gatewayUrl;
}

get isConfirmed () {
return (this.args.reimbursement.confirmedAt - this.kredits.currentBlock) <= 0;
}

get isUnconfirmed () {
return !this.isConfirmed;
}

get showVetoButton () {
return this.isUnconfirmed && this.kredits.currentUserIsCore;
}

@action
veto (id) {
this.kredits.vetoReimbursement(id).then(transaction => {
Expand Down
2 changes: 1 addition & 1 deletion app/components/reimbursement-item/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class="button small" target="_blank" rel="noopener noreferrer">
Inspect IPFS data
</a>
{{#if this.kredits.currentUserIsCore}}
{{#if this.showVetoButton}}
<button {{on "click" (fn this.veto @reimbursement.id)}}
disabled={{@reimbursement.vetoed}}
class="button small danger" type="button">veto</button>
Expand Down

0 comments on commit 49bd48c

Please sign in to comment.