|
24 | 24 | import UserCheck from 'lucide-svelte/icons/user-check';
|
25 | 25 | import UserPlus from 'lucide-svelte/icons/user-plus';
|
26 | 26 | import Search from 'lucide-svelte/icons/search';
|
27 |
| - import { goto } from '$app/navigation'; |
28 |
| - import { languageTag } from '$lib/paraglide/runtime'; |
| 27 | + import { goto } from '$lib/utils'; |
29 | 28 | import { cn } from '$lib/utils/style';
|
30 | 29 | import Button from './button/button.svelte';
|
31 | 30 | import Text from './input/text.svelte';
|
|
84 | 83 |
|
85 | 84 | function redirect(account: NameType) {
|
86 | 85 | if (!context.settings.data.preventAccountPageSwitching) {
|
87 |
| - goto(`/${languageTag()}/${network}/account/${account}`); |
| 86 | + goto(`/${network}/account/${account}`); |
88 | 87 | }
|
89 | 88 | }
|
90 | 89 |
|
|
94 | 93 | closeDrawer();
|
95 | 94 | }
|
96 | 95 |
|
97 |
| - function removeSession(session?: Session | SerializedSession) { |
| 96 | + async function removeSession(session?: Session | SerializedSession) { |
98 | 97 | if (session) {
|
99 |
| - context.wharf.logout(session); |
| 98 | + await context.wharf.logout(session); |
| 99 | + if (currentSession) { |
| 100 | + redirect(currentSession.actor); |
| 101 | + } |
100 | 102 | }
|
101 | 103 | }
|
102 | 104 |
|
103 | 105 | async function connectWallet(wallet: WalletPlugin) {
|
104 | 106 | const options: LoginOptions = {
|
105 | 107 | walletPlugin: wallet.id
|
106 | 108 | };
|
107 |
| - if (wallet.id !== 'cleos') { |
| 109 | + if (wallet.id !== 'cleos' && wallet.id !== 'wallet-plugin-multisig') { |
108 | 110 | options.chain = context.network.chain;
|
109 | 111 | }
|
110 | 112 | const session = await context.wharf.login(options);
|
|
207 | 209 | <Button onclick={addAccount} variant="secondary" class="grow-0 text-white">
|
208 | 210 | <div class="flex items-center gap-2">
|
209 | 211 | <UserPlus class="mb-0.5 size-5" />
|
210 |
| - <span>Add Account</span> |
| 212 | + <span>{m.common_add_account()}</span> |
211 | 213 | </div>
|
212 | 214 | </Button>
|
213 | 215 |
|
|
232 | 234 |
|
233 | 235 | <ul class="grid gap-2">
|
234 | 236 | {#each chainSessions as session}
|
235 |
| - {@const isCurrent = currentSession?.actor.toString() === session.actor} |
| 237 | + {@const isCurrent = |
| 238 | + currentSession?.actor.equals(session.actor) && |
| 239 | + currentSession?.permission.equals(session.permission)} |
236 | 240 | <li class="grid grid-cols-[1fr_auto] gap-2">
|
237 | 241 | <button
|
238 | 242 | data-current={isCurrent}
|
|
252 | 256 | {/if}
|
253 | 257 | </div>
|
254 | 258 |
|
255 |
| - <span class="font-medium"> |
256 |
| - {session.actor}@{session.permission} |
257 |
| - </span> |
| 259 | + <div class="text-left font-medium"> |
| 260 | + <div>{session.actor}@{session.permission}</div> |
| 261 | + {#if session.walletPlugin.id === 'wallet-plugin-multisig'} |
| 262 | + <div class="text-xs"> |
| 263 | + ↳ {m.common_account_multisig_using_account({ |
| 264 | + account: session.walletPlugin.data.session.actor |
| 265 | + })} |
| 266 | + </div> |
| 267 | + {/if} |
| 268 | + </div> |
258 | 269 | </button>
|
259 | 270 | <button
|
260 | 271 | onclick={() => removeSession(session)}
|
|
285 | 296 | <hr class="border-mineShaft-900" />
|
286 | 297 |
|
287 | 298 | <header class="grid justify-center gap-2 py-4 text-center">
|
288 |
| - <span class="h4">Login to Unicove</span> |
289 |
| - <span class="text-muted text-sm font-medium">Connect your wallet to login</span> |
| 299 | + <span class="h4">{m.common_login_to_unicove()}</span> |
| 300 | + <span class="text-muted text-sm font-medium">{m.common_connect_wallet_login()}</span> |
290 | 301 | </header>
|
291 | 302 |
|
292 | 303 | {#if context.wharf.sessionKit}
|
293 | 304 | <ul class="grid grid-cols-[auto_1fr_auto]">
|
294 | 305 | {#each context.wharf.sessionKit?.walletPlugins as wallet}
|
295 |
| - <li class="table-row-background table-row-border col-span-full grid grid-cols-subgrid"> |
296 |
| - <button |
297 |
| - class="col-span-full grid grid-cols-subgrid gap-4 px-2 py-4 font-semibold text-white" |
298 |
| - onclick={() => connectWallet(wallet)} |
299 |
| - > |
300 |
| - {#if wallet.metadata.logo} |
301 |
| - <img |
302 |
| - class="size-6" |
303 |
| - src={wallet.metadata.logo.toString()} |
304 |
| - alt={wallet.metadata.name} |
305 |
| - /> |
306 |
| - {:else} |
307 |
| - <Wallet class="size-6" /> |
308 |
| - {/if} |
309 |
| - <span class="text-left">{wallet.metadata.name}</span> |
310 |
| - </button> |
311 |
| - </li> |
| 306 | + {#if wallet.id !== 'wallet-plugin-multisig'} |
| 307 | + <li class="table-row-background table-row-border col-span-full grid grid-cols-subgrid"> |
| 308 | + <button |
| 309 | + class="col-span-full grid grid-cols-subgrid gap-4 px-2 py-4 font-semibold text-white" |
| 310 | + onclick={() => connectWallet(wallet)} |
| 311 | + > |
| 312 | + {#if wallet.metadata.logo} |
| 313 | + <img |
| 314 | + class="size-6" |
| 315 | + src={wallet.metadata.logo.toString()} |
| 316 | + alt={wallet.metadata.name} |
| 317 | + /> |
| 318 | + {:else} |
| 319 | + <Wallet class="size-6" /> |
| 320 | + {/if} |
| 321 | + <span class="text-left">{wallet.metadata.name}</span> |
| 322 | + </button> |
| 323 | + </li> |
| 324 | + {/if} |
312 | 325 | {/each}
|
313 | 326 | </ul>
|
314 | 327 | {/if}
|
315 | 328 | <div class="grid">
|
316 | 329 | <!-- <Button href={`/${network}/signup`} onclick={closeDrawer} variant="primary"> -->
|
317 | 330 | <!-- Create account -->
|
318 | 331 | <!-- </Button> -->
|
319 |
| - <Button class="text-white" onclick={closeAddingAccount} variant="secondary">Cancel</Button> |
| 332 | + <Button class="text-white" onclick={closeAddingAccount} variant="secondary" |
| 333 | + >{m.common_cancel()}</Button |
| 334 | + > |
320 | 335 | </div>
|
321 | 336 | </div>
|
322 | 337 | {/snippet}
|
0 commit comments