Skip to content

refactor(dashboard): extract shared ResourceTable - #132

Merged
Shine-neko merged 1 commit into
mainfrom
feat/dashboard-resource-table
Jul 25, 2026
Merged

refactor(dashboard): extract shared ResourceTable#132
Shine-neko merged 1 commit into
mainfrom
feat/dashboard-resource-table

Conversation

@Shine-neko

Copy link
Copy Markdown
Contributor

The listing pages each reimplement the same shell: page header with refresh marker, load-and-poll lifecycle, error banner, empty state, table skeleton. src/lib/ held no components at all, so every page carried its own copy.

This adds ResourceTable.svelte and migrates the providers page onto it as the first consumer.

Changes

  • New $lib/ResourceTable.svelte: header (optional Refresh + "updated …"), load/poll lifecycle, error and empty states, table skeleton. Callers pass columns and a row snippet, plus an optional beforeTable snippet for anything page-specific between header and table (providers uses it for its stat cards).
  • Providers migrated: 276 lines down to ~140 of page-specific code.

No visual change

The component carries the primitives (.page-header, .card, .alert, .empty, .btn-secondary, …) because this dashboard keeps them in each page's <style> rather than in app.css.

Verified by diffing the compiled CSS before and after, comparing the page scope and the component scope together: zero declarations lost or altered for the providers page.

Notes

Cell rules stay with the page — the row snippet is compiled into the caller, so its <td>s carry the page's scope, not the component's. The one exception is the last-row border, which needs tbody :global(tr:last-child td) to reach into the snippet; a scoped selector there matches nothing and is pruned (the compiler reports it as unused CSS).

Checks

svelte-check (0 errors), biome check and build pass, with no unused-CSS warnings. Not exercised against a running server.

@Shine-neko
Shine-neko merged commit 5758d0e into main Jul 25, 2026
3 checks passed
@Shine-neko
Shine-neko deleted the feat/dashboard-resource-table branch July 25, 2026 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant