|
7 | 7 | AmountSats, |
8 | 8 | FancyCard, |
9 | 9 | Indicator, |
10 | | - InfoBox |
| 10 | + InfoBox, |
| 11 | + VStack |
11 | 12 | } from "~/components"; |
12 | 13 | import { useI18n } from "~/i18n/context"; |
13 | 14 | import { useMegaStore } from "~/state/megaStore"; |
@@ -68,109 +69,127 @@ export function BalanceBox(props: { loading?: boolean; small?: boolean }) { |
68 | 69 | </Show> |
69 | 70 | </Match> |
70 | 71 | <Match when={true}> |
71 | | - <FancyCard> |
72 | | - {/* <button onClick={() => setMinimized(true)}>Minimize</button> */} |
73 | | - <Show when={!props.loading} fallback={<LoadingShimmer />}> |
74 | | - <Switch> |
75 | | - <Match when={state.safe_mode}> |
76 | | - <div class="flex flex-col gap-1"> |
77 | | - <InfoBox accent="red"> |
78 | | - {i18n.t("common.error_safe_mode")} |
79 | | - </InfoBox> |
80 | | - </div> |
81 | | - </Match> |
82 | | - <Match when={true}> |
| 72 | + <VStack> |
| 73 | + <FancyCard title="Lightning"> |
| 74 | + {/* <button onClick={() => setMinimized(true)}>Minimize</button> */} |
| 75 | + <Show |
| 76 | + when={!props.loading} |
| 77 | + fallback={<LoadingShimmer />} |
| 78 | + > |
| 79 | + <Switch> |
| 80 | + <Match when={state.safe_mode}> |
| 81 | + <div class="flex flex-col gap-1"> |
| 82 | + <InfoBox accent="red"> |
| 83 | + {i18n.t("common.error_safe_mode")} |
| 84 | + </InfoBox> |
| 85 | + </div> |
| 86 | + </Match> |
| 87 | + <Match when={true}> |
| 88 | + <div class="flex flex-col gap-1"> |
| 89 | + <div class="text-2xl"> |
| 90 | + <AmountSats |
| 91 | + amountSats={ |
| 92 | + state.balance?.lightning || |
| 93 | + 0 |
| 94 | + } |
| 95 | + icon="lightning" |
| 96 | + denominationSize="lg" |
| 97 | + /> |
| 98 | + </div> |
| 99 | + <div class="text-lg text-white/70"> |
| 100 | + <AmountFiat |
| 101 | + amountSats={ |
| 102 | + state.balance?.lightning || |
| 103 | + 0 |
| 104 | + } |
| 105 | + denominationSize="sm" |
| 106 | + /> |
| 107 | + </div> |
| 108 | + </div> |
| 109 | + </Match> |
| 110 | + </Switch> |
| 111 | + </Show> |
| 112 | + </FancyCard> |
| 113 | + <Show when={state.federations && state.federations.length}> |
| 114 | + <FancyCard title="Fedimint"> |
| 115 | + <Show |
| 116 | + when={!props.loading} |
| 117 | + fallback={<LoadingShimmer />} |
| 118 | + > |
| 119 | + <hr class="my-2 border-m-grey-750" /> |
83 | 120 | <div class="flex flex-col gap-1"> |
84 | 121 | <div class="text-2xl"> |
85 | 122 | <AmountSats |
86 | 123 | amountSats={ |
87 | | - state.balance?.lightning || 0 |
| 124 | + state.balance?.federation || 0 |
88 | 125 | } |
89 | | - icon="lightning" |
| 126 | + icon="community" |
90 | 127 | denominationSize="lg" |
91 | 128 | /> |
92 | 129 | </div> |
93 | 130 | <div class="text-lg text-white/70"> |
94 | 131 | <AmountFiat |
95 | 132 | amountSats={ |
96 | | - state.balance?.lightning || 0 |
| 133 | + state.balance?.federation || 0n |
97 | 134 | } |
98 | 135 | denominationSize="sm" |
99 | 136 | /> |
100 | 137 | </div> |
101 | 138 | </div> |
102 | | - </Match> |
103 | | - </Switch> |
| 139 | + </Show> |
| 140 | + </FancyCard> |
104 | 141 | </Show> |
105 | | - <Show when={state.federations && state.federations.length}> |
| 142 | + <FancyCard title="On-chain"> |
| 143 | + {/* <hr class="my-2 border-m-grey-750" /> */} |
106 | 144 | <Show |
107 | 145 | when={!props.loading} |
108 | 146 | fallback={<LoadingShimmer />} |
109 | 147 | > |
110 | | - <hr class="my-2 border-m-grey-750" /> |
111 | | - <div class="flex flex-col gap-1"> |
112 | | - <div class="text-2xl"> |
113 | | - <AmountSats |
114 | | - amountSats={ |
115 | | - state.balance?.federation || 0 |
116 | | - } |
117 | | - icon="community" |
118 | | - denominationSize="lg" |
119 | | - /> |
| 148 | + <div class="flex justify-between"> |
| 149 | + <div class="flex flex-col gap-1"> |
| 150 | + <div class="text-2xl"> |
| 151 | + <AmountSats |
| 152 | + amountSats={totalOnchain()} |
| 153 | + icon="chain" |
| 154 | + denominationSize="lg" |
| 155 | + /> |
| 156 | + </div> |
| 157 | + <div class="text-lg text-white/70"> |
| 158 | + <AmountFiat |
| 159 | + amountSats={totalOnchain()} |
| 160 | + denominationSize="sm" |
| 161 | + /> |
| 162 | + </div> |
120 | 163 | </div> |
121 | | - <div class="text-lg text-white/70"> |
122 | | - <AmountFiat |
123 | | - amountSats={ |
124 | | - state.balance?.federation || 0n |
125 | | - } |
126 | | - denominationSize="sm" |
127 | | - /> |
| 164 | + <div class="flex flex-col items-end justify-between gap-1"> |
| 165 | + <Show |
| 166 | + when={state.balance?.unconfirmed != 0n} |
| 167 | + > |
| 168 | + <Indicator> |
| 169 | + {i18n.t("common.pending")} |
| 170 | + </Indicator> |
| 171 | + </Show> |
| 172 | + <Show |
| 173 | + when={state.balance?.unconfirmed === 0n} |
| 174 | + > |
| 175 | + <div /> |
| 176 | + </Show> |
| 177 | + <Show when={usableOnchain() > 0n}> |
| 178 | + <div class="self-end justify-self-end"> |
| 179 | + <A href="/swap" class={STYLE}> |
| 180 | + <img |
| 181 | + src={shuffle} |
| 182 | + alt="swap" |
| 183 | + class="h-6 w-6" |
| 184 | + /> |
| 185 | + </A> |
| 186 | + </div> |
| 187 | + </Show> |
128 | 188 | </div> |
129 | 189 | </div> |
130 | 190 | </Show> |
131 | | - </Show> |
132 | | - <hr class="my-2 border-m-grey-750" /> |
133 | | - <Show when={!props.loading} fallback={<LoadingShimmer />}> |
134 | | - <div class="flex justify-between"> |
135 | | - <div class="flex flex-col gap-1"> |
136 | | - <div class="text-2xl"> |
137 | | - <AmountSats |
138 | | - amountSats={totalOnchain()} |
139 | | - icon="chain" |
140 | | - denominationSize="lg" |
141 | | - /> |
142 | | - </div> |
143 | | - <div class="text-lg text-white/70"> |
144 | | - <AmountFiat |
145 | | - amountSats={totalOnchain()} |
146 | | - denominationSize="sm" |
147 | | - /> |
148 | | - </div> |
149 | | - </div> |
150 | | - <div class="flex flex-col items-end justify-between gap-1"> |
151 | | - <Show when={state.balance?.unconfirmed != 0n}> |
152 | | - <Indicator> |
153 | | - {i18n.t("common.pending")} |
154 | | - </Indicator> |
155 | | - </Show> |
156 | | - <Show when={state.balance?.unconfirmed === 0n}> |
157 | | - <div /> |
158 | | - </Show> |
159 | | - <Show when={usableOnchain() > 0n}> |
160 | | - <div class="self-end justify-self-end"> |
161 | | - <A href="/swap" class={STYLE}> |
162 | | - <img |
163 | | - src={shuffle} |
164 | | - alt="swap" |
165 | | - class="h-6 w-6" |
166 | | - /> |
167 | | - </A> |
168 | | - </div> |
169 | | - </Show> |
170 | | - </div> |
171 | | - </div> |
172 | | - </Show> |
173 | | - </FancyCard> |
| 191 | + </FancyCard> |
| 192 | + </VStack> |
174 | 193 | </Match> |
175 | 194 | </Switch> |
176 | 195 | ); |
|
0 commit comments