Skip to content

Commit c38175c

Browse files
authored
Add IN/OUT Indicator Column to Invoice Dashboard (#204)
1 parent 83d8974 commit c38175c

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed

packages/invoice-dashboard/src/lib/view-requests.svelte

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import Skeleton from "@requestnetwork/shared-components/skeleton.svelte";
1313
import Toaster from "@requestnetwork/shared-components/sonner.svelte";
1414
import Tooltip from "@requestnetwork/shared-components/tooltip.svelte";
15+
import TxType from "@requestnetwork/shared-components/tx-type.svelte";
1516
import { toast } from "svelte-sonner";
1617
// Icons
1718
import ChevronDown from "@requestnetwork/shared-icons/chevron-down.svelte";
@@ -302,7 +303,11 @@
302303
paymentNetworkExtension?.id ===
303304
Types.Extension.PAYMENT_NETWORK_ID.ETH_FEE_PROXY_CONTRACT
304305
) {
305-
paymentCurrencies = [currencyInfo as (CurrencyTypes.ERC20Currency | CurrencyTypes.NativeCurrency)];
306+
paymentCurrencies = [
307+
currencyInfo as
308+
| CurrencyTypes.ERC20Currency
309+
| CurrencyTypes.NativeCurrency,
310+
];
306311
} else {
307312
console.error(
308313
"Payment network extension not supported:",
@@ -539,6 +544,26 @@
539544
</i>
540545
</div>
541546
</th>
547+
<th
548+
on:click={() => {
549+
const sortBy = processedRequests?.some(
550+
(req) => req.payer?.value === signer
551+
)
552+
? "payer.value"
553+
: "payee.value";
554+
handleSort(sortBy);
555+
}}
556+
>
557+
<div>
558+
Type<i class={`caret `}>
559+
{#if sortOrder === "asc" && (sortColumn === "payer.value" || sortColumn === "payee.value")}
560+
<ChevronUp />
561+
{:else}
562+
<ChevronDown />
563+
{/if}
564+
</i>
565+
</div>
566+
</th>
542567
<th on:click={() => handleSort("state")}>
543568
<div>
544569
Status<i class={`caret `}>
@@ -623,6 +648,11 @@
623648
{/if}
624649
{request.currencySymbol}
625650
</td>
651+
<td>
652+
<TxType
653+
type={signer === request.payer?.value ? "OUT" : "IN"}
654+
/>
655+
</td>
626656
<td> {checkStatus(request)}</td>
627657
<td
628658
><Tooltip text="Download PDF">

shared/components/tx-type.svelte

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<script lang="ts">
2+
export let type: "IN" | "OUT";
3+
4+
$: isOut = type === "OUT";
5+
</script>
6+
7+
<div class="tx" class:out={isOut} class:in={!isOut}>
8+
{type}
9+
</div>
10+
11+
<style>
12+
.tx {
13+
padding: 8px 0px;
14+
border-radius: 6px;
15+
font-size: 12px;
16+
font-weight: 600;
17+
max-width: 40px;
18+
width: 100%;
19+
text-align: center;
20+
}
21+
22+
.out {
23+
background-color: rgba(255, 197, 49, 0.25);
24+
color: #be7117;
25+
}
26+
27+
.in {
28+
background-color: rgba(11, 180, 137, 0.25);
29+
color: #01503a;
30+
}
31+
</style>

0 commit comments

Comments
 (0)