diff --git a/backend/src/graphql/model/Transaction.ts b/backend/src/graphql/model/Transaction.ts index 3aa3c429d..89ecd1513 100644 --- a/backend/src/graphql/model/Transaction.ts +++ b/backend/src/graphql/model/Transaction.ts @@ -15,6 +15,7 @@ export class Transaction { this.balance = 0 this.totalBalance = 0 this.memo = '' + this.firstTransaction = false } @Field(() => String) @@ -52,4 +53,7 @@ export class Transaction { @Field({ nullable: true }) decay?: Decay + + @Field(() => Boolean) + firstTransaction: boolean } diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index d9a2e4974..518cf1f1c 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -95,6 +95,8 @@ async function calculateAndAddDecayTransactions( ).toString() } } + } else { + finalTransaction.firstTransaction = true } // sender or receiver when user has sent money diff --git a/frontend/src/components/DecayInformation.vue b/frontend/src/components/DecayInformation.vue index 0daa45a18..9da5e4b2c 100644 --- a/frontend/src/components/DecayInformation.vue +++ b/frontend/src/components/DecayInformation.vue @@ -4,7 +4,7 @@ {{ decay ? ' − ' + $n(decay.balance, 'decimal') : '' }} -
+
@@ -56,17 +56,22 @@
{{ $t('decay.decay') }}
-
− {{ $n(decay.balance, 'decimal') }}
+
- {{ $n(decay.balance, 'decimal') }}
+
+ {{ $n(decay.balance + gddbalance, 'decimal') }} GDD - + {{ $n(decay.balance, 'decimal') }} GDD = + {{ $n(gddbalance, 'decimal') }} GDD +

- + {{ $t('decay.calculation_total') }} - +
{{ $t('decay.sent') }}
{{ $t('decay.received') }}
@@ -77,7 +82,7 @@
- +
{{ $t('decay.decay') }}
@@ -86,7 +91,7 @@
- +
{{ $t('decay.total') }}
@@ -109,6 +114,7 @@ export default { name: 'DecayInformation', props: { + gddbalance: { type: Number }, balance: { type: Number }, type: { type: String, default: '' }, decay: { diff --git a/frontend/src/components/Transaction.spec.js b/frontend/src/components/Transaction.spec.js index aaad023e0..ac80fefc8 100644 --- a/frontend/src/components/Transaction.spec.js +++ b/frontend/src/components/Transaction.spec.js @@ -31,8 +31,13 @@ describe('Transaction', () => { expect(wrapper.find('div.gdt-transaction-list-item').exists()).toBeTruthy() }) - it('has a collapse button', () => { - expect(wrapper.find('button[type="button"].btn-secondary').text()).toBe('i') + it('has a collapse icon bi-caret-down-square', () => { + expect(wrapper.find('div.gdt-transaction-list-item').findAll('svg').at(1).classes()).toEqual([ + 'bi-caret-down-square', + 'b-icon', + 'bi', + 'text-muted', + ]) }) describe('no valid GDT entry type', () => { diff --git a/frontend/src/components/Transaction.vue b/frontend/src/components/Transaction.vue index 1dcfee13a..649b81b4d 100644 --- a/frontend/src/components/Transaction.vue +++ b/frontend/src/components/Transaction.vue @@ -9,9 +9,10 @@
- - i - +
@@ -85,6 +86,16 @@ export default { gdt: { type: Number }, id: { type: Number }, }, + data() { + return { + collapseStatus: [], + } + }, + methods: { + getCollapseState(id) { + return this.collapseStatus.includes('gdt-collapse-' + id) + }, + }, computed: { collapseId() { return 'gdt-collapse-' + String(this.id) @@ -130,5 +141,14 @@ export default { } }, }, + mounted() { + this.$root.$on('bv::collapse::state', (collapseId, isJustShown) => { + if (isJustShown) { + this.collapseStatus.push(collapseId) + } else { + this.collapseStatus = this.collapseStatus.filter((id) => id !== collapseId) + } + }) + }, } diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index ff211fc07..70d0ea5a4 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -78,6 +78,7 @@ export const transactionsQuery = gql` decayDuration decayStartBlock } + firstTransaction } } } diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 0fdac973f..3bfad63e8 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -21,6 +21,7 @@ "switch-to-this-community": "zu dieser Gemeinschaft wechseln" }, "decay": { + "befor_startblock_transaction": "Diese Transaktion beinhaltet keine Vergänglichkeit.", "calculation_decay": "Berechnung der Vergänglichkeit", "calculation_total": "Berechnung der Gesamtsumme", "created": "Geschöpft", @@ -29,6 +30,7 @@ "decayStart": " - Startblock für Vergänglichkeit am: ", "decay_introduced": "Die Vergänglichkeit wurde eingeführt am ", "decay_since_last_transaction": "Vergänglichkeit seit der letzten Transaktion", + "first_transaction": "Die erste Transaktion beinhaltet keine Vergänglichkeit.", "hours": "Stunden", "last_transaction": "Letzte Transaktion", "minutes": "Minuten", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index fdbf37bd7..b06030947 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -21,6 +21,7 @@ "switch-to-this-community": "Switch to this community" }, "decay": { + "befor_startblock_transaction": "This transaction does not include decay.", "calculation_decay": "Calculation of Decay", "calculation_total": "Calculation of the total Amount", "created": "Created", @@ -29,6 +30,7 @@ "decayStart": " - Starting block for decay at: ", "decay_introduced": "Decay was introduced on", "decay_since_last_transaction": "Decay since the last transaction", + "first_transaction": "The first transaction does not include decay.", "hours": "Hours", "last_transaction": "Last transaction:", "minutes": "Minutes", diff --git a/frontend/src/views/Pages/AccountOverview.vue b/frontend/src/views/Pages/AccountOverview.vue index b62481806..c0ba55155 100644 --- a/frontend/src/views/Pages/AccountOverview.vue +++ b/frontend/src/views/Pages/AccountOverview.vue @@ -15,6 +15,7 @@
{ decay: { balance: '1.5' }, }, { - balance: '1.07', + balance: 1.07, type: 'decay', }, ], @@ -135,12 +135,31 @@ describe('GddTransactionList', () => { transaction = wrapper.findAll('div.gdd-transaction-list-item').at(0) }) + it('has a bi-caret-down-square icon', () => { + expect(transaction.findAll('svg').at(0).classes()).toEqual([ + 'bi-caret-down-square', + 'b-icon', + 'bi', + 'text-muted', + ]) + }) + + // it('transaction is clicked', async () => { + // await transaction.trigger('click') + // expect(transaction.findAll('svg').at(0).classes()).toEqual([ + // 'bi-caret-up-square', + // 'b-icon', + // 'bi', + // 'text-muted', + // ]) + // }) + it('has a bi-arrow-left-circle icon', () => { - expect(transaction.find('svg').classes()).toContain('bi-arrow-left-circle') + expect(transaction.findAll('svg').at(1).classes()).toContain('bi-arrow-left-circle') }) it('has text-danger color', () => { - expect(transaction.find('svg').classes()).toContain('text-danger') + expect(transaction.findAll('svg').at(1).classes()).toContain('text-danger') }) it('has a minus operator', () => { @@ -186,12 +205,33 @@ describe('GddTransactionList', () => { transaction = wrapper.findAll('div.gdd-transaction-list-item').at(1) }) + it('has a bi-caret-down-square icon', () => { + expect(transaction.findAll('svg').at(0).classes()).toEqual([ + 'bi-caret-down-square', + 'b-icon', + 'bi', + 'text-muted', + ]) + }) + + // it('transaction is clicked', async () => { + // await transaction.trigger('click') + // expect(transaction.findAll('svg').at(0).classes()).toEqual([ + // 'bi-caret-up-square', + // 'b-icon', + // 'bi', + // 'text-muted', + // ]) + // }) + it('has a bi-gift icon', () => { - expect(transaction.find('svg').classes()).toContain('bi-gift') + expect(transaction.findAll('svg').at(1).classes()).toContain('bi-gift') }) it('has gradido-global-color-accent color', () => { - expect(transaction.find('svg').classes()).toContain('gradido-global-color-accent') + expect(transaction.findAll('svg').at(1).classes()).toContain( + 'gradido-global-color-accent', + ) }) it('has a plus operator', () => { @@ -225,12 +265,33 @@ describe('GddTransactionList', () => { transaction = wrapper.findAll('div.gdd-transaction-list-item').at(2) }) + it('has a bi-caret-down-square icon', () => { + expect(transaction.findAll('svg').at(0).classes()).toEqual([ + 'bi-caret-down-square', + 'b-icon', + 'bi', + 'text-muted', + ]) + }) + + // it('transaction is clicked', async () => { + // await transaction.trigger('click') + // expect(transaction.findAll('svg').at(0).classes()).toEqual([ + // 'bi-caret-up-square', + // 'b-icon', + // 'bi', + // 'text-muted', + // ]) + // }) + it('has a bi-arrow-right-circle icon', () => { - expect(transaction.find('svg').classes()).toContain('bi-arrow-right-circle') + expect(transaction.findAll('svg').at(1).classes()).toContain('bi-arrow-right-circle') }) it('has gradido-global-color-accent color', () => { - expect(transaction.find('svg').classes()).toContain('gradido-global-color-accent') + expect(transaction.findAll('svg').at(1).classes()).toContain( + 'gradido-global-color-accent', + ) }) it('has a plus operator', () => { @@ -276,12 +337,31 @@ describe('GddTransactionList', () => { transaction = wrapper.findAll('div.gdd-transaction-list-item').at(3) }) + it('has a bi-caret-down-square icon', () => { + expect(transaction.findAll('svg').at(0).classes()).toEqual([ + 'bi-caret-down-square', + 'b-icon', + 'bi', + 'text-muted', + ]) + }) + + // it('transaction is clicked', async () => { + // await transaction.trigger('click') + // expect(transaction.findAll('svg').at(0).classes()).toEqual([ + // 'bi-caret-up-square', + // 'b-icon', + // 'bi', + // 'text-muted', + // ]) + // }) + it('has a bi-droplet-half icon', () => { - expect(transaction.find('svg').classes()).toContain('bi-droplet-half') + expect(transaction.findAll('svg').at(1).classes()).toContain('bi-droplet-half') }) it('has gradido-global-color-gray color', () => { - expect(transaction.find('svg').classes()).toContain('gradido-global-color-gray') + expect(transaction.findAll('svg').at(1).classes()).toContain('gradido-global-color-gray') }) it('has a minus operator', () => { diff --git a/frontend/src/views/Pages/AccountOverview/GddTransactionList.vue b/frontend/src/views/Pages/AccountOverview/GddTransactionList.vue index 4e2df58d1..db24e90ba 100644 --- a/frontend/src/views/Pages/AccountOverview/GddTransactionList.vue +++ b/frontend/src/views/Pages/AccountOverview/GddTransactionList.vue @@ -2,35 +2,44 @@
- + {{ $t('error.no-transactionlist') }}
- + {{ $t('error.empty-transactionlist') }}
-
- - i - +
+
-
@@ -112,9 +121,13 @@
- - -
+ + +
+
+ {{ $t('decay.first_transaction') }} +
+ +
+ {{ $t('decay.befor_startblock_transaction') }} +
+
+ +
@@ -161,9 +198,11 @@ export default { data() { return { currentPage: 1, + collapseStatus: [], } }, props: { + gddbalance: { type: Number }, transactions: { default: () => [] }, pageSize: { type: Number, default: 25 }, timestamp: { type: Number, default: 0 }, @@ -191,6 +230,18 @@ export default { throwError(msg) { throw new Error(msg) }, + getCollapseState(transactionId) { + return this.collapseStatus.includes('decay-' + transactionId) + }, + }, + mounted() { + this.$root.$on('bv::collapse::state', (collapseId, isJustShown) => { + if (isJustShown) { + this.collapseStatus.push(collapseId) + } else { + this.collapseStatus = this.collapseStatus.filter((id) => id !== collapseId) + } + }) }, watch: { currentPage() { diff --git a/frontend/src/views/Pages/UserProfileTransactionList.vue b/frontend/src/views/Pages/UserProfileTransactionList.vue index 383e908b6..494819f05 100644 --- a/frontend/src/views/Pages/UserProfileTransactionList.vue +++ b/frontend/src/views/Pages/UserProfileTransactionList.vue @@ -5,6 +5,7 @@

{{ $t('transaction.gdd-text') }}