|
7 | 7 | import DateTime from '$comp/formatters/DateTime.svelte';
|
8 | 8 | import TimeAgo from '$comp/formatters/TimeAgo.svelte';
|
9 | 9 | import { P } from '$comp/typography';
|
| 10 | + import { Skeleton } from '$comp/ui/skeleton'; |
10 | 11 | import * as Table from '$comp/ui/table';
|
11 | 12 | import * as Tabs from '$comp/ui/tabs';
|
12 | 13 | import { getEventQuery } from '$features/events/api.svelte';
|
|
112 | 113 | });
|
113 | 114 | </script>
|
114 | 115 |
|
115 |
| -{#if eventResponse.isLoading} |
116 |
| - <P>Loading...</P> |
117 |
| -{:else if eventResponse.isSuccess} |
118 |
| - <StackCard {changed} id={eventResponse.data.stack_id}></StackCard> |
| 116 | +<StackCard {changed} id={eventResponse.data?.stack_id}></StackCard> |
119 | 117 |
|
120 |
| - <Table.Root class="mt-4"> |
121 |
| - <Table.Body> |
122 |
| - <Table.Row class="group"> |
123 |
| - <Table.Head class="w-40 whitespace-nowrap">Occurred On</Table.Head> |
124 |
| - <Table.Cell class="w-4 pr-0"></Table.Cell> |
125 |
| - <Table.Cell class="flex items-center" |
126 |
| - ><DateTime value={eventResponse.data.date}></DateTime> (<TimeAgo value={eventResponse.data.date}></TimeAgo>)</Table.Cell |
| 118 | +<Table.Root class="mt-4"> |
| 119 | + <Table.Body> |
| 120 | + <Table.Row class="group"> |
| 121 | + <Table.Head class="w-40 whitespace-nowrap">Occurred On</Table.Head> |
| 122 | + <Table.Cell class="w-4 pr-0"></Table.Cell> |
| 123 | + <Table.Cell class="flex items-center" |
| 124 | + >{#if eventResponse.isSuccess} |
| 125 | + <DateTime value={eventResponse.data.date}></DateTime> (<TimeAgo value={eventResponse.data.date}></TimeAgo>) |
| 126 | + {:else} |
| 127 | + <Skeleton class="h-[20px] w-full rounded-full" /> |
| 128 | + {/if}</Table.Cell |
| 129 | + > |
| 130 | + </Table.Row> |
| 131 | + <Table.Row class="group"> |
| 132 | + <Table.Head class="w-40 whitespace-nowrap">Project</Table.Head> |
| 133 | + {#if projectResponse.isSuccess} |
| 134 | + <Table.Cell class="w-4 pr-0 opacity-0 group-hover:opacity-100" |
| 135 | + ><ClickableProjectFilter |
| 136 | + {changed} |
| 137 | + class="mr-0" |
| 138 | + organization={projectResponse.data.organization_id!} |
| 139 | + value={[projectResponse.data.id!]} |
| 140 | + /></Table.Cell |
127 | 141 | >
|
128 |
| - </Table.Row> |
129 |
| - {#if projectResponse.data} |
130 |
| - <Table.Row class="group"> |
131 |
| - <Table.Head class="w-40 whitespace-nowrap">Project</Table.Head> |
132 |
| - <Table.Cell class="w-4 pr-0 opacity-0 group-hover:opacity-100" |
133 |
| - ><ClickableProjectFilter |
134 |
| - {changed} |
135 |
| - class="mr-0" |
136 |
| - organization={projectResponse.data.organization_id!} |
137 |
| - value={[projectResponse.data.id!]} |
138 |
| - /></Table.Cell |
139 |
| - > |
140 |
| - <Table.Cell>{projectResponse.data.name}</Table.Cell> |
141 |
| - </Table.Row> |
| 142 | + <Table.Cell>{projectResponse.data.name}</Table.Cell> |
| 143 | + {:else if projectResponse.isLoading} |
| 144 | + <Table.Cell class="w-4 pr-0"></Table.Cell> |
| 145 | + <Table.Cell class="flex items-center"><Skeleton class="h-[20px] w-full rounded-full" /></Table.Cell> |
142 | 146 | {/if}
|
143 |
| - </Table.Body> |
144 |
| - </Table.Root> |
| 147 | + </Table.Row> |
| 148 | + </Table.Body> |
| 149 | +</Table.Root> |
145 | 150 |
|
| 151 | +{#if eventResponse.isSuccess} |
146 | 152 | <Tabs.Root class="mb-4 mt-4" value={activeTab}>
|
147 | 153 | <Tabs.List class="mb-4 w-full justify-normal">
|
148 | 154 | {#each tabs as tab (tab)}
|
|
171 | 177 | {/each}
|
172 | 178 | </Tabs.Root>
|
173 | 179 | {:else}
|
174 |
| - <ErrorMessage message={eventResponse.error?.errors.general}></ErrorMessage> |
| 180 | + <Skeleton class="h-[30px] w-full rounded-full" /> |
| 181 | + <Table.Root class="mt-4"> |
| 182 | + <Table.Body> |
| 183 | + {#each Array.from({ length: 5 })} |
| 184 | + <Table.Row class="group"> |
| 185 | + <Table.Head class="w-40 whitespace-nowrap"><Skeleton class="h-[20px] w-full rounded-full" /></Table.Head> |
| 186 | + <Table.Cell class="w-4 pr-0"></Table.Cell> |
| 187 | + <Table.Cell class="flex items-center"><Skeleton class="h-[20px] w-full rounded-full" /></Table.Cell> |
| 188 | + </Table.Row> |
| 189 | + {/each} |
| 190 | + </Table.Body> |
| 191 | + </Table.Root> |
175 | 192 | {/if}
|
0 commit comments