|
1 | 1 | <script setup lang="ts"> |
2 | 2 | import type { IGroup } from '@renderer/services/organization'; |
3 | | -import type { IGroupItem, ITransactionFull } from '@shared/interfaces'; |
| 3 | +import { BackEndTransactionType, type IGroupItem, type ITransactionFull } from '@shared/interfaces'; |
4 | 4 | import { TransactionStatus, TransactionTypeName } from '@shared/interfaces'; |
5 | 5 |
|
6 | 6 | import { computed, onBeforeMount, reactive, ref, watch, watchEffect } from 'vue'; |
@@ -58,7 +58,10 @@ import useContactsStore from '@renderer/stores/storeContacts.ts'; |
58 | 58 | import AppDropDown from '@renderer/components/ui/AppDropDown.vue'; |
59 | 59 | import { NodeByIdCache } from '@renderer/caches/mirrorNode/NodeByIdCache.ts'; |
60 | 60 | import { errorToastOptions, successToastOptions } from '@renderer/utils/toastOptions.ts'; |
61 | | -import { formatTransactionType } from '@renderer/utils/sdk/transactions.ts'; |
| 61 | +import { |
| 62 | + formatTransactionType, |
| 63 | + getTransactionTypeFromBackendType, |
| 64 | +} from '@renderer/utils/sdk/transactions.ts'; |
62 | 65 | import TransactionId from '@renderer/components/ui/TransactionId.vue'; |
63 | 66 | import NextTransactionCursor from '@renderer/components/NextTransactionCursor.vue'; |
64 | 67 |
|
@@ -123,6 +126,35 @@ const loadingStates = reactive<{ [key: string]: string | null }>({ |
123 | 126 | }); |
124 | 127 |
|
125 | 128 | /* Computed */ |
| 129 | +const pageTitle = computed(() => { |
| 130 | + let txType: BackEndTransactionType | null = null; |
| 131 | + let result: string | null = null; |
| 132 | +
|
| 133 | + if (group.value) { |
| 134 | + if (group.value.groupItems.length >= 1) { |
| 135 | + txType = group.value.groupItems[0].transaction.type; |
| 136 | + for (const item of group.value.groupItems.slice(1)) { |
| 137 | + if (item.transaction.type !== txType) { |
| 138 | + txType = null; |
| 139 | + break; |
| 140 | + } |
| 141 | + } |
| 142 | + result = txType |
| 143 | + ? `Group of ${group.value.groupItems.length} ${getTransactionTypeFromBackendType(txType, false, true)} transactions` |
| 144 | + : `Group of ${group.value.groupItems.length} transactions`; |
| 145 | + } |
| 146 | + } |
| 147 | + return result; |
| 148 | +}); |
| 149 | +
|
| 150 | +const description = computed(() => { |
| 151 | + return group.value ? group.value.description : null; |
| 152 | +}); |
| 153 | +
|
| 154 | +const isSequential = computed(() => { |
| 155 | + return group.value?.sequential ?? false; |
| 156 | +}); |
| 157 | +
|
126 | 158 | const canSignAll = computed(() => { |
127 | 159 | return ( |
128 | 160 | isLoggedInOrganization(user.selectedOrganization) && |
@@ -638,13 +670,19 @@ function itemStatusBadgeClass(item: IGroupItem): string { |
638 | 670 | <form @submit.prevent="handleSubmit" class="p-5"> |
639 | 671 | <div class="flex-column-100"> |
640 | 672 | <div class="flex-centered justify-content-between flex-wrap gap-4"> |
641 | | - <div class="d-flex align-items-center gap-4"> |
| 673 | + <div class="d-flex align-items-center gap-4 flex-1"> |
642 | 674 | <AppButton type="button" color="secondary" class="btn-icon-only" @click="handleBack"> |
643 | 675 | <i class="bi bi-arrow-left"></i> |
644 | 676 | </AppButton> |
645 | 677 | <NextTransactionCursor /> |
646 | 678 |
|
647 | | - <h2 class="text-title text-bold">Transaction Group Details</h2> |
| 679 | + <Transition mode="out-in" name="fade"> |
| 680 | + <template v-if="pageTitle"> |
| 681 | + <h2 class="text-title text-bold flex-1 text-one-line-ellipsis"> |
| 682 | + {{ pageTitle }} |
| 683 | + </h2> |
| 684 | + </template> |
| 685 | + </Transition> |
648 | 686 | </div> |
649 | 687 |
|
650 | 688 | <div class="flex-centered gap-4"> |
@@ -682,18 +720,14 @@ function itemStatusBadgeClass(item: IGroupItem): string { |
682 | 720 | <Transition name="fade" mode="out-in"> |
683 | 721 | <template v-if="group"> |
684 | 722 | <div class="fill-remaining flex-column-100 mt-5"> |
685 | | - <div class="d-flex"> |
686 | | - <div class="col-6 flex-1"> |
687 | | - <label class="form-label">Transaction Group Description</label> |
688 | | - <div>{{ group?.description }}</div> |
689 | | - </div> |
| 723 | + <div class="mt-5"> |
| 724 | + <label class="form-label">Transaction Group Description</label> |
| 725 | + <div>{{ description }}</div> |
| 726 | + </div> |
690 | 727 |
|
691 | | - <template v-if="isLoggedInOrganization(user.selectedOrganization)"> |
692 | | - <div class="col-6"> |
693 | | - <label class="form-label">Sequential Execution</label> |
694 | | - <div>{{ group?.sequential ? 'Yes' : 'No' }}</div> |
695 | | - </div> |
696 | | - </template> |
| 728 | + <div v-if="isLoggedInOrganization(user.selectedOrganization)" class="mt-5"> |
| 729 | + <label class="form-label">Sequential Execution</label> |
| 730 | + <div>{{ isSequential ? 'Yes' : 'No' }}</div> |
697 | 731 | </div> |
698 | 732 |
|
699 | 733 | <hr class="separator my-5 w-100" /> |
|
0 commit comments