+ {...restProps}>
{#if !nestLabel}
{@render TooltipLabel()}
{/if}
{#each visibleSeries as item, i (item.key + i)}
- {@const key = `${nameKey || item.key || item.label || "value"}`}
+ {@const key = `${nameKey || item.key || item.label || 'value'}`}
{@const itemConfig = getPayloadConfigFromPayload(
chart.config,
item,
key,
- chartCtx.tooltip.data
+ chartCtx.tooltip.data,
)}
- {@const indicatorColor = color || item.config?.color || item.color}
+ {@const indicatorColor =
+ color || item.config?.color || item.color}
svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:size-2.5",
- indicator === "dot" && "items-center"
- )}
- >
+ '[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:size-2.5',
+ indicator === 'dot' && 'items-center',
+ )}>
{#if formatter && item.value !== undefined && item.label}
{@render formatter({
value: item.value,
@@ -145,23 +172,22 @@
+ 'size-2.5': indicator === 'dot',
+ 'h-full w-1': indicator === 'line',
+ 'w-0 border-[1.5px] border-dashed bg-transparent':
+ indicator === 'dashed',
+ 'my-0.5': nestLabel && indicator === 'dashed',
+ },
+ )}>
+
{/if}
+ 'flex flex-1 shrink-0 justify-between leading-none',
+ nestLabel ? 'items-end' : 'items-center',
+ )}>
{#if nestLabel}
{@render TooltipLabel()}
@@ -171,8 +197,13 @@
{#if item.value !== undefined}
-
- {item.value.toLocaleString()}
+
+ {#if valueFormatter}
+ {valueFormatter(item.value)}
+ {:else}
+ {item.value.toLocaleString()}
+ {/if}
{/if}
diff --git a/apps/desktop/src/routes/monero/wallet/[name].svelte b/apps/desktop/src/routes/monero/wallet/[name].svelte
index 4c7b61e..22a7f9d 100644
--- a/apps/desktop/src/routes/monero/wallet/[name].svelte
+++ b/apps/desktop/src/routes/monero/wallet/[name].svelte
@@ -53,6 +53,21 @@
estimatedFee: string
} | null>(null)
let moneroPrice = $state<{ usd: string } | null>(null)
+ let selectedRange = $state<'1D' | '1W' | '1M' | '1Y' | 'ALL'>('ALL')
+
+ const rangeCutoff = $derived(
+ selectedRange === 'ALL'
+ ? 0
+ : Date.now() -
+ (
+ {
+ '1D': 86400000,
+ '1W': 604800000,
+ '1M': 2592000000,
+ '1Y': 31536000000,
+ } as const
+ )[selectedRange],
+ )
const balanceHistory = $derived.by(() => {
const sorted = [...w.txs].reverse()
@@ -75,7 +90,11 @@
return points
})
- $inspect(balanceHistory)
+ const chartData = $derived(
+ selectedRange === 'ALL'
+ ? balanceHistory
+ : balanceHistory.filter((p) => p.date.getTime() >= rangeCutoff),
+ )
let accountDialogOpen = $state(false)
let accountLabel = $state('')
@@ -353,62 +372,81 @@
{#if balanceHistory.length > 1}
- Balance
+
+
Balance
+
+ {#each ['1D', '1W', '1M', '1Y', 'ALL'] as const as range}
+
+ {/each}
+
+
-
-
- a.balance < b.balance ? a : b,
- ).balance,
- balanceHistory.reduce((a, b) =>
- a.balance > b.balance ? a : b,
- ).balance,
- ]}
- props={{
- spline: {
- curve: curveLinear,
- motion: 'tween',
- strokeWidth: 2,
- },
- yAxis: {},
- xAxis: {
- format: (v: Date) =>
- v.toLocaleDateString('en-US', {
- month: 'short',
- day: 'numeric',
- // hour: '2-digit',
- }),
- },
- highlight: { points: { r: 4 } },
+ {#if chartData.length > 1}
+
- {#snippet tooltip()}
- {
- return value.toLocaleDateString()
- }}
- valueFormatter={(value: Number) => {
- return value.toString().slice(0, 8)
- }} />
- {/snippet}
-
-
+
+ a.balance < b.balance ? a : b,
+ ).balance,
+ chartData.reduce((a, b) =>
+ a.balance > b.balance ? a : b,
+ ).balance,
+ ]}
+ props={{
+ spline: {
+ curve: curveLinear,
+ motion: 'tween',
+ strokeWidth: 2,
+ },
+ yAxis: {},
+ xAxis: {
+ format: (v: Date) =>
+ v.toLocaleDateString('en-US', {
+ month: 'short',
+ day: 'numeric',
+ }),
+ },
+ highlight: { points: { r: 4 } },
+ }}>
+ {#snippet tooltip()}
+ {
+ return value.toLocaleDateString()
+ }}
+ valueFormatter={(value: Number) => {
+ return value.toString().slice(0, 8)
+ }} />
+ {/snippet}
+
+
+ {:else}
+
+ No transactions in this time range.
+
+ {/if}
{/if}