Skip to content

Commit 118911f

Browse files
authored
Merge pull request #2 from DoktorShift/comment_formatting
Update IndexPage.vue
2 parents e4fb9b9 + 82cd34a commit 118911f

File tree

1 file changed

+49
-16
lines changed

1 file changed

+49
-16
lines changed

src/pages/IndexPage.vue

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
</q-card-section>
147147
<q-card-section class="text-h4 text-weight-bolder q-pt-none"
148148
:class="$q.dark.isActive ? 'dark_text' : 'text-grey-8'">
149+
149150
<!-- &#163; -->
150151

151152
<span v-if="balance_toggle">{{ formatSatoshis(balance) }} sats <i
@@ -226,7 +227,6 @@
226227
</div>
227228
<div class="col-12 q-mt-sm">
228229

229-
230230
<JsonExcel
231231
:data="transactions"
232232
:fields="json_fields" class="float-right"
@@ -261,9 +261,10 @@
261261
row-key="id"
262262
:filter="filter"
263263
>
264+
<!-- Updated body-cell-memo Template -->
264265
<template v-slot:body-cell-memo="props">
265266
<q-td :props="props" class="truncate-chip-labels">
266-
<q-chip dense :dark="false" class="q-px-sm" color="primary" text-color="white" :label="props.value">
267+
<q-chip dense :dark="false" class="q-px-sm whitespace-nowrap" color="primary" text-color="white" :label="props.value">
267268
<q-tooltip>
268269
{{ props.value }}
269270
</q-tooltip>
@@ -275,24 +276,45 @@
275276
<q-list dense>
276277
<div class="text-body1 text-white q-pa-sm">Comments</div>
277278
<q-separator color="white"/>
278-
<q-item clickable v-for="comment in props.row['extra']['comment']" :key="comment.id">
279-
<q-item-section class="text-left text-body2 text-white ellipsis-3-lines">
280-
<div>
281-
<q-avatar size="15px">
282-
<q-icon name="circle"/>
283-
</q-avatar>
284-
{{ comment }}
285-
</div>
286-
</q-item-section>
287-
<q-item-section side>
288-
<q-icon color="white" size="20px" name="content_copy" @click="copyToClipboard(comment)" class="cursor-pointer"/>
289-
</q-item-section>
290-
</q-item>
279+
<!-- Check if comment is an array -->
280+
<div v-if="Array.isArray(props.row['extra']['comment'])">
281+
<q-item clickable v-for="(comment, index) in props.row['extra']['comment']" :key="index">
282+
<q-item-section class="text-left text-body2 text-white ellipsis-3-lines whitespace-nowrap">
283+
<div class="flex items-center">
284+
<q-avatar size="15px">
285+
<q-icon name="circle"/>
286+
</q-avatar>
287+
<span class="ml-2">{{ comment }}</span>
288+
</div>
289+
</q-item-section>
290+
<q-item-section side>
291+
<q-icon color="white" size="20px" name="content_copy" @click="copyToClipboard(comment)" class="cursor-pointer"/>
292+
</q-item-section>
293+
</q-item>
294+
</div>
295+
<!-- If comment is a string -->
296+
<div v-else>
297+
<q-item clickable>
298+
<q-item-section class="text-left text-body2 text-white ellipsis-3-lines whitespace-nowrap">
299+
<div class="flex items-center">
300+
<q-avatar size="15px">
301+
<q-icon name="circle"/>
302+
</q-avatar>
303+
<span class="ml-2">{{ props.row['extra']['comment'] }}</span>
304+
</div>
305+
</q-item-section>
306+
<q-item-section side>
307+
<q-icon color="white" size="20px" name="content_copy" @click="copyToClipboard(props.row['extra']['comment'])" class="cursor-pointer"/>
308+
</q-item-section>
309+
</q-item>
310+
</div>
291311
</q-list>
292312
</q-menu>
293313
</q-btn>
294314
</q-td>
295315
</template>
316+
<!-- End of Updated Template -->
317+
296318
<template v-slot:body-cell-amount_sats="props">
297319
<q-td :props="props">
298320
<q-icon v-if="props.row['amount'] > 0" name="call_received" color="positive"/>
@@ -834,7 +856,6 @@ export default defineComponent({
834856
console.error("There was an error fetching the transactions!", error);
835857
});
836858
837-
838859
},
839860
exportTable() {
840861
const content = [this.columns.map(col => wrapCsvValue(col.label))].concat(
@@ -1070,4 +1091,16 @@ export default defineComponent({
10701091
.truncate-chip-labels > .q-chip {
10711092
max-width: 300px
10721093
}
1094+
.whitespace-nowrap {
1095+
white-space: nowrap;
1096+
}
1097+
.flex {
1098+
display: flex;
1099+
}
1100+
.items-center {
1101+
align-items: center;
1102+
}
1103+
.ml-2 {
1104+
margin-left: 0.5rem;
1105+
}
10731106
</style>

0 commit comments

Comments
 (0)