Add app loader and skeleton states

This commit is contained in:
Chris Scott committed 2026-01-15 19:03:25 -05:00
1 parent 7ba2cf2328
commit 2ba959ac0b
5 files changed
+78 -15

No files matched your search

@@ -10,7 +10,6 @@ import {
import { GitBranch, Check, Plus, GitCommit, Loader2 } from "lucide-react";
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { listBranches, switchBranch, GitAuthError } from "@/api/repos";
import { useGitStatus } from "@/api/git";
import { AddBranchWorkspaceDialog } from "@/components/repo/AddBranchWorkspaceDialog";
import { GitChangesSheet } from "@/components/file-browser/GitChangesSheet";
import { showToast } from "@/lib/toast";
@@ -29,7 +28,6 @@ export function BranchSwitcher({ repoId, currentBranch, isWorktree, repoUrl, rep
const [addBranchOpen, setAddBranchOpen] = useState(false);
const [gitChangesOpen, setGitChangesOpen] = useState(false);
const queryClient = useQueryClient();
const { data: gitStatus } = useGitStatus(repoId);
const { data: branches, isLoading: branchesLoading, refetch: refetchBranches } = useQuery({
queryKey: ["branches", repoId],
@@ -100,11 +98,6 @@ export function BranchSwitcher({ repoId, currentBranch, isWorktree, repoUrl, rep
<div className="flex items-center gap-2 w-full">
<GitCommit className="w-3 h-3" />
<span className="flex-1">View Changes</span>
{gitStatus?.hasChanges && (
<span className="text-xs text-yellow-500">
{gitStatus.files.length}
</span>
)}
</div>
</DropdownMenuItem>
</>
@@ -117,11 +110,6 @@ export function BranchSwitcher({ repoId, currentBranch, isWorktree, repoUrl, rep
<div className="flex items-center gap-2 w-full">
<GitCommit className="w-3 h-3" />
<span className="flex-1">View Changes</span>
{gitStatus?.hasChanges && (
<span className="text-xs text-yellow-500">
{gitStatus.files.length}
</span>
)}
</div>
</DropdownMenuItem>
{repoUrl && (
@@ -0,0 +1,22 @@
export function RepoCardSkeleton() {
return (
<div className="relative border rounded-xl overflow-hidden border-border bg-card w-full">
<div className="p-2">
<div className="flex items-start gap-3 mb-1">
<div className="w-5 h-5 bg-muted animate-pulse rounded" />
<div className="h-5 bg-muted animate-pulse rounded w-32" />
</div>
<div className="flex items-center gap-2 text-sm">
<div className="flex flex-1 items-center gap-3">
<div className="h-4 bg-muted animate-pulse rounded w-20" />
</div>
<div className="flex items-center gap-1 shrink-0">
<div className="h-8 w-8 bg-muted animate-pulse rounded" />
<div className="h-8 w-8 bg-muted animate-pulse rounded" />
<div className="h-8 w-8 bg-muted animate-pulse rounded" />
</div>
</div>
</div>
</div>
)
}
+17 -3
View File
@@ -6,9 +6,10 @@ import { CSS } from "@dnd-kit/utilities"
import { listRepos, deleteRepo, updateRepoOrder } from "@/api/repos"
import { DeleteDialog } from "@/components/ui/delete-dialog"
import { ListToolbar } from "@/components/ui/list-toolbar"
import { Loader2, GitBranch, Search, GripVertical } from "lucide-react"
import { GitBranch, Search, GripVertical } from "lucide-react"
import type { Repo } from "@/api/types"
import { RepoCard } from "./RepoCard"
import { RepoCardSkeleton } from "./RepoCardSkeleton"
function SortableRepoCard({
repo,
@@ -147,8 +148,21 @@ export function RepoList() {
if (isLoading && !repos) {
return (
<div className="flex items-center justify-center p-8">
<Loader2 className="w-6 h-6 animate-spin" />
<div className="px-0 md:p-4 h-full flex flex-col">
<div className="px-2 md:px-0">
<div className="h-10 bg-muted/50 animate-pulse rounded w-full" />
</div>
<div className="mx-2 md:mx-0 flex-1 min-h-0">
<div className="h-full overflow-y-auto pt-4 pb-2 md:pb-0">
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-2 gap-3 md:gap-4 w-full">
{Array.from({ length: 6 }).map((_, i) => (
<div key={i} className="pl-8">
<RepoCardSkeleton />
</div>
))}
</div>
</div>
</div>
</div>
)
}