refactor: consolidate loading/error states and extract instance actions hook

Frontend:
- Create reusable DataStates components (LoadingState, ErrorState, EmptyState)
- Refactor 12 pages to use shared state components instead of inline JSX
- Extract useInstanceActions hook to eliminate session action duplication
- Update dashboard and sessions pages to use shared hook

OpenSpec:
- Archive completed mobile-app-usability change (44/44 tasks)
- Archive completed add-config-profiles change (15/15 tasks)

Quality: TypeScript check passes, production build succeeds
This commit is contained in:
Alex Blank
2026-05-25 22:50:18 +02:00
parent 4c216dd1ca
commit ab79080f0b
31 changed files with 258 additions and 266 deletions
+4 -11
View File
@@ -10,6 +10,7 @@ import {
type ProjectCreateInput,
type ProjectUpdateInput,
} from "../api/projects";
import { EmptyState, ErrorState, LoadingState } from "../components/data-states";
import { Icon } from "../components/icon";
import { useAsyncData } from "../hooks/use-async-data";
import type { Project } from "../types";
@@ -101,19 +102,11 @@ export const ProjectsPage = () => {
</button>
</div>
{status === "loading" && <p className="muted">Loading projects...</p>}
{status === "loading" && <LoadingState message="Loading projects..." />}
{status === "error" && (
<div className="card stack">
<p>Failed to load projects</p>
<button className="secondary-button" onClick={() => reload()} type="button">
<Icon name="refresh" size="sm" />
Retry
</button>
</div>
)}
{status === "error" && <ErrorState message="Failed to load projects" onRetry={reload} />}
{isEmpty && <p className="muted">No projects yet. Create your first project above.</p>}
{isEmpty && <EmptyState message="No projects yet. Create your first project above." />}
{status === "ready" && safeProjects.length > 0 && (
<div className="project-list">