Improve reimbursement lists #222
@@ -0,0 +1,19 @@
|
||||
import Component from '@glimmer/component';
|
||||
|
|
||||
import { action } from '@ember/object';
|
||||
import { inject as service } from '@ember/service';
|
||||
import config from 'kredits-web/config/environment';
|
||||
|
||||
export default class ReimbursementItemComponent extends Component {
|
||||
@service kredits;
|
||||
|
||||
get ipfsGatewayUrl () {
|
||||
return config.ipfs.gatewayUrl;
|
||||
}
|
||||
|
||||
@action
|
||||
veto (id) {
|
||||
this.kredits.vetoReimbursement(id).then(transaction => {
|
||||
console.debug('[controllers:budget] Veto submitted to chain: '+transaction.hash);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<li data-reimbursement-id={{@reimbursement.id}}
|
||||
|
I'm guessing this is the offender why you had to disable the linter rule Adding a I'm guessing this is the offender why you had to disable the linter rule `no-invalid-interactive`.
Adding a `role="button"` to the list element should fix that.
```suggestion
<li data-reimbursement-id={{@reimbursement.id}}
class="{{item-status @reimbursement}}"
role="button"
{{on "click" this.toggleExpenseDetails}}>
```
|
||||
class="{{item-status @reimbursement}}">
|
||||
<p class="meta">
|
||||
<span class="recipient">
|
||||
<UserAvatar @contributor={{@reimbursement.contributor}} />
|
||||
</span>
|
||||
<span class="title">
|
||||
Expenses covered by {{@reimbursement.contributor.name}}
|
||||
</span>
|
||||
</p>
|
||||
<p class="token-amount">
|
||||
<span class="amount">
|
||||
{{sats-to-btc @reimbursement.amount}}</span> <span class="symbol">BTC</span>
|
||||
</p>
|
||||
|
||||
<ExpenseList @expenses={{@reimbursement.expenses}} />
|
||||
|
||||
<div class="meta">
|
||||
<p class="confirmation-eta">
|
||||
<ConfirmedIn @confirmedAtBlock={{@reimbursement.confirmedAt}} />
|
||||
</p>
|
||||
<p class="actions">
|
||||
<a href="{{this.ipfsGatewayUrl}}/{{@reimbursement.ipfsHash}}"
|
||||
class="button small" target="_blank" rel="noopener noreferrer">
|
||||
Inspect IPFS data
|
||||
</a>
|
||||
{{#if this.kredits.currentUserIsCore}}
|
||||
<button {{on "click" (fn this.veto @reimbursement.id)}}
|
||||
disabled={{@reimbursement.vetoed}}
|
||||
class="button small danger" type="button">veto</button>
|
||||
{{/if}}
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
@@ -1,23 +1,10 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { sort } from '@ember/object/computed';
|
||||
import { action } from '@ember/object';
|
||||
import { inject as service } from '@ember/service';
|
||||
import config from 'kredits-web/config/environment';
|
||||
|
||||
export default class ReimbursementListComponent extends Component {
|
||||
@service kredits;
|
||||
|
||||
itemSorting = Object.freeze(['pendingStatus:asc', 'id:desc']);
|
||||
@sort('args.items', 'itemSorting') itemsSorted;
|
||||
|
||||
get ipfsGatewayUrl () {
|
||||
return config.ipfs.gatewayUrl;
|
||||
}
|
||||
|
||||
@action
|
||||
veto (id) {
|
||||
this.kredits.vetoReimbursement(id).then(transaction => {
|
||||
console.debug('[controllers:budget] Veto submitted to chain: '+transaction.hash);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,5 @@
|
||||
<ul class="item-list spaced reimbursement-list {{if @loading 'loading'}}">
|
||||
{{#each this.itemsSorted as |reimbursement|}}
|
||||
<li data-reimbursement-id={{reimbursement.id}}
|
||||
class="{{item-status reimbursement}}">
|
||||
<p class="meta">
|
||||
<span class="recipient">
|
||||
<UserAvatar @contributor={{reimbursement.contributor}} />
|
||||
</span>
|
||||
<span class="title">
|
||||
Expenses covered by {{reimbursement.contributor.name}}
|
||||
</span>
|
||||
</p>
|
||||
<p class="token-amount">
|
||||
<span class="amount">
|
||||
{{sats-to-btc reimbursement.amount}}</span> <span class="symbol">BTC</span>
|
||||
</p>
|
||||
|
||||
<ExpenseList @expenses={{reimbursement.expenses}} />
|
||||
|
||||
<div class="meta">
|
||||
<p class="confirmation-eta">
|
||||
<ConfirmedIn @confirmedAtBlock={{reimbursement.confirmedAt}} />
|
||||
</p>
|
||||
<p class="actions">
|
||||
<a href="{{this.ipfsGatewayUrl}}/{{reimbursement.ipfsHash}}"
|
||||
class="button small" target="_blank" rel="noopener noreferrer">
|
||||
Inspect IPFS data
|
||||
</a>
|
||||
{{#if this.kredits.currentUserIsCore}}
|
||||
<button {{on "click" (fn this.veto reimbursement.id)}}
|
||||
disabled={{reimbursement.vetoed}}
|
||||
class="button small danger" type="button">veto</button>
|
||||
{{/if}}
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
{{#each this.itemsSorted as |item|}}
|
||||
<ReimbursementItem @reimbursement={{item}} />
|
||||
{{/each}}
|
||||
</ul>
|
||||
Reference in New Issue
Block a user
✂️