diff --git a/packages/dapp-svelte-wallet/ui/lib/ListCard.svelte b/packages/dapp-svelte-wallet/ui/lib/ListCard.svelte index 05c52e1c459..bb9658dc4d1 100644 --- a/packages/dapp-svelte-wallet/ui/lib/ListCard.svelte +++ b/packages/dapp-svelte-wallet/ui/lib/ListCard.svelte @@ -11,14 +11,19 @@ export let expandIcon = 'arrow_right'; - let expanded = []; + // true iff new items should start expanded + export let expandDefault = false; - const toggle = item => { - // console.log('toggle', item); - if (expanded.includes(item)) { - expanded = expanded.filter(it => item !== it); + let expandState = []; + + $: isExpanded = id => expandState.includes(id) !== expandDefault; + + const toggle = id => { + console.log('toggle', id, expandState.includes(id)); + if (expandState.includes(id)) { + expandState = expandState.filter(it => id !== it); } else { - expanded = [...expanded, item]; + expandState = [...expandState, id]; } }; @@ -43,7 +48,7 @@
toggle(item.id)}>
- {expandIcon} + {expandIcon} {item.text}
@@ -52,7 +57,7 @@
- {#if expanded.includes(item.id)} + {#if isExpanded(item.id)}
diff --git a/packages/dapp-svelte-wallet/ui/src/Dapps.svelte b/packages/dapp-svelte-wallet/ui/src/Dapps.svelte index 40f76ae4a91..7a3dea57d54 100644 --- a/packages/dapp-svelte-wallet/ui/src/Dapps.svelte +++ b/packages/dapp-svelte-wallet/ui/src/Dapps.svelte @@ -6,7 +6,7 @@ import { dapps } from './store'; - +
diff --git a/packages/dapp-svelte-wallet/ui/src/Payments.svelte b/packages/dapp-svelte-wallet/ui/src/Payments.svelte index 7d79dcc588e..839629cafbf 100644 --- a/packages/dapp-svelte-wallet/ui/src/Payments.svelte +++ b/packages/dapp-svelte-wallet/ui/src/Payments.svelte @@ -2,7 +2,7 @@ import ListItems from "../lib/ListItems.svelte"; import Amount from "./Amount.svelte"; import Payment from './Payment.svelte'; - + import { payments } from './store'; import ListCard from "../lib/ListCard.svelte"; import Card from "smelte/src/components/Card"; @@ -10,7 +10,7 @@ import Card from "smelte/src/components/Card"; $: paymentItems = $payments.filter(pmt => pmt.status !== 'deposited'); - +
diff --git a/packages/dapp-svelte-wallet/ui/src/Transactions.svelte b/packages/dapp-svelte-wallet/ui/src/Transactions.svelte index 402b84ffc20..599a002c0c4 100644 --- a/packages/dapp-svelte-wallet/ui/src/Transactions.svelte +++ b/packages/dapp-svelte-wallet/ui/src/Transactions.svelte @@ -7,7 +7,7 @@ - status === undefined || status === 'pending')}> + status === undefined || status === 'pending')} expandDefault={true}>