|
1 | 1 | <script lang="ts"> |
2 | | - import { Plus } from '@lucide/svelte'; |
| 2 | + import { Plus, Router } from '@lucide/svelte'; |
3 | 3 | import RotateCcw from '@lucide/svelte/icons/rotate-ccw'; |
4 | 4 | import type { SortingState } from '@tanstack/table-core'; |
5 | 5 | import Container from '$lib/components/Container.svelte'; |
|
10 | 10 | import { SemVer } from 'semver'; |
11 | 11 | import { onMount } from 'svelte'; |
12 | 12 | import { type Hub, columns } from './columns'; |
| 13 | + import DataTableActions from './data-table-actions.svelte'; |
| 14 | +
|
| 15 | + let innerWidth = $state<number>(0); |
13 | 16 |
|
14 | 17 | let data = $derived.by<Hub[]>(() => { |
15 | 18 | if (!$OwnHubsStore || !$OnlineHubsStore) return []; |
|
44 | 47 | onMount(refreshOwnHubs); |
45 | 48 | </script> |
46 | 49 |
|
| 50 | +<svelte:window bind:innerWidth /> |
47 | 51 | <Container> |
48 | 52 | <Card.Header class="w-full"> |
49 | 53 | <Card.Title class="flex items-center justify-between space-x-2 text-3xl"> |
|
61 | 65 | </Card.Title> |
62 | 66 | <Card.Description>This is a list of all hubs you own.</Card.Description> |
63 | 67 | </Card.Header> |
64 | | - <div class="w-full"> |
65 | | - <DataTable {data} {columns} {sorting} /> |
| 68 | + <div class="w-full p-6 gap-6 grid"> |
| 69 | + {#if innerWidth < 800} |
| 70 | + {#each data as hub (hub.id)} |
| 71 | + <div class="flex items-center justify-between gap-4"> |
| 72 | + <div class="flex items-center gap-4"> |
| 73 | + <Router class="size-8" /> |
| 74 | + <div class="flex flex-col"> |
| 75 | + <strong>{hub.name}</strong> |
| 76 | + {#if hub.firmware_version} |
| 77 | + <span>{hub.firmware_version}</span> |
| 78 | + {:else} |
| 79 | + <span class="text-red-500">Offline</span> |
| 80 | + {/if} |
| 81 | + </div> |
| 82 | + </div> |
| 83 | + <DataTableActions {hub} /> |
| 84 | + </div> |
| 85 | + {/each} |
| 86 | + {:else} |
| 87 | + <DataTable {data} {columns} {sorting} /> |
| 88 | + {/if} |
66 | 89 | </div> |
67 | 90 | </Container> |
0 commit comments