From 53f13e4a6366eb56acebe6d672b06ec063fd5881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Thu, 7 Mar 2024 16:48:37 +0100 Subject: [PATCH] Move reimbursement items to separate component --- .../reimbursement-item/component.js | 19 ++++++++++ .../reimbursement-item/template.hbs | 34 +++++++++++++++++ .../reimbursement-list/component.js | 13 ------- .../reimbursement-list/template.hbs | 37 +------------------ 4 files changed, 55 insertions(+), 48 deletions(-) create mode 100644 app/components/reimbursement-item/component.js create mode 100644 app/components/reimbursement-item/template.hbs diff --git a/app/components/reimbursement-item/component.js b/app/components/reimbursement-item/component.js new file mode 100644 index 0000000..1ada034 --- /dev/null +++ b/app/components/reimbursement-item/component.js @@ -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); + }); + } +} diff --git a/app/components/reimbursement-item/template.hbs b/app/components/reimbursement-item/template.hbs new file mode 100644 index 0000000..96828de --- /dev/null +++ b/app/components/reimbursement-item/template.hbs @@ -0,0 +1,34 @@ +
  • +

    + + + + + Expenses covered by {{@reimbursement.contributor.name}} + +

    +

    + + {{sats-to-btc @reimbursement.amount}}BTC +

    + + + +
    +

    + +

    +

    + + Inspect IPFS data + + {{#if this.kredits.currentUserIsCore}} + + {{/if}} +

    +
    +
  • diff --git a/app/components/reimbursement-list/component.js b/app/components/reimbursement-list/component.js index 79c260d..34f7820 100644 --- a/app/components/reimbursement-list/component.js +++ b/app/components/reimbursement-list/component.js @@ -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); - }); - } } diff --git a/app/components/reimbursement-list/template.hbs b/app/components/reimbursement-list/template.hbs index 50dcedf..98cd41f 100644 --- a/app/components/reimbursement-list/template.hbs +++ b/app/components/reimbursement-list/template.hbs @@ -1,38 +1,5 @@ \ No newline at end of file