refactor(dashboard): extract shared ResourceTable - #132
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.svelteand migrates the providers page onto it as the first consumer.Changes
$lib/ResourceTable.svelte: header (optional Refresh + "updated …"), load/poll lifecycle, error and empty states, table skeleton. Callers pass columns and arowsnippet, plus an optionalbeforeTablesnippet for anything page-specific between header and table (providers uses it for its stat cards).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 inapp.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
rowsnippet 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 needstbody :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 checkandbuildpass, with no unused-CSS warnings. Not exercised against a running server.