@@ -7,53 +7,41 @@ import Card from "$lib/components/ui/Card.svelte"
7
7
import Label from " $lib/components/ui/Label.svelte"
8
8
import { cn } from " $lib/utils"
9
9
10
- // Get all token errors from the store
11
- const tokenErrors = $derived (
12
- Array .from (tokensStore .error .entries ())
13
- .filter (([_ , error ]) => Option .isSome (error ))
14
- .map (([chainId , error ]) => ({
15
- chainId ,
16
- error: error .value
17
- }))
18
- )
19
-
20
- const totalErrors = $derived ((Option .isSome (chains .error ) ? 1 : 0 ) + tokenErrors .length )
10
+ import { totalErrorCount , tokenErrors } from " $lib/stores/app-errors.svelte"
21
11
22
12
let isExpanded = $state (false )
23
13
</script >
24
14
25
- {#if totalErrors > 0 }
26
- <Card divided class =" m-6 mb-0" >
27
- <button
28
- class =" w-full px-4 py-2 flex items-center justify-between"
29
- onclick ={() => isExpanded = ! isExpanded }
30
- >
31
- <span class =" font-semibold text-red-500" >
32
- {totalErrors } Error{totalErrors > 1 ? " s" : " " }
33
- </span >
34
- <span class ={cn (
35
- " transition-transform text-red-500" ,
36
- isExpanded ? " rotate-180" : " "
37
- )}>
38
- ↓
39
- </span >
40
- </button >
15
+ {#if totalErrorCount () > 0 }
16
+ <button
17
+ class =" w-full px-4 py-2 flex items-center justify-between"
18
+ onclick ={() => isExpanded = ! isExpanded }
19
+ >
20
+ <span class =" font-semibold text-red-500" >
21
+ {totalErrorCount ()} Error{totalErrorCount () > 1 ? " s" : " " }
22
+ </span >
23
+ <span class ={cn (
24
+ " transition-transform text-red-500" ,
25
+ isExpanded ? " rotate-180" : " "
26
+ )}>
27
+ ↓
28
+ </span >
29
+ </button >
41
30
42
- {#if isExpanded }
43
- <div class =" max-h-96 overflow-y-auto p-4 flex flex-col gap-4" >
44
- {#if Option .isSome (chains .error )}
45
- <div >
46
- <Label >Chain Info Service</Label >
47
- <ErrorComponent error ={chains .error .value }/>
48
- </div >
49
- {/if }
50
- {#each tokenErrors as { chainId, error }}
51
- <div >
52
- <Label class ="mb-2" >Token Info Fetcher for Chain {chainId }</Label >
53
- <ErrorComponent error ={error }/>
54
- </div >
55
- {/each }
56
- </div >
57
- {/if }
58
- </Card >
31
+ {#if isExpanded }
32
+ <div class =" max-h-96 overflow-y-auto p-4 flex flex-col gap-4" >
33
+ {#if Option .isSome (chains .error )}
34
+ <div >
35
+ <Label >Chain Info Service</Label >
36
+ <ErrorComponent error ={chains .error .value }/>
37
+ </div >
38
+ {/if }
39
+ {#each tokenErrors as { chainId, error }}
40
+ <div >
41
+ <Label class ="mb-2" >Token Info Fetcher for Chain {chainId }</Label >
42
+ <ErrorComponent error ={error }/>
43
+ </div >
44
+ {/each }
45
+ </div >
46
+ {/if }
59
47
{/if }
0 commit comments