Skip to content

Commit cc00b72

Browse files
committed
Start working on mobile hub page
1 parent bd83540 commit cc00b72

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

src/routes/(authenticated)/hubs/+page.svelte

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { Plus } from '@lucide/svelte';
2+
import { Plus, Router } from '@lucide/svelte';
33
import RotateCcw from '@lucide/svelte/icons/rotate-ccw';
44
import type { SortingState } from '@tanstack/table-core';
55
import Container from '$lib/components/Container.svelte';
@@ -10,6 +10,9 @@
1010
import { SemVer } from 'semver';
1111
import { onMount } from 'svelte';
1212
import { type Hub, columns } from './columns';
13+
import DataTableActions from './data-table-actions.svelte';
14+
15+
let innerWidth = $state<number>(0);
1316
1417
let data = $derived.by<Hub[]>(() => {
1518
if (!$OwnHubsStore || !$OnlineHubsStore) return [];
@@ -44,6 +47,7 @@
4447
onMount(refreshOwnHubs);
4548
</script>
4649

50+
<svelte:window bind:innerWidth />
4751
<Container>
4852
<Card.Header class="w-full">
4953
<Card.Title class="flex items-center justify-between space-x-2 text-3xl">
@@ -61,7 +65,26 @@
6165
</Card.Title>
6266
<Card.Description>This is a list of all hubs you own.</Card.Description>
6367
</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}
6689
</div>
6790
</Container>

0 commit comments

Comments
 (0)