style(lists): refresh pagination and loading states

This commit is contained in:
2026-04-29 02:05:39 +03:30
parent e4b1dcf3c0
commit 5082dab99e
5 changed files with 240 additions and 89 deletions

View File

@@ -1,5 +1,5 @@
import { useEffect, useState } from "react"
import { Plus, Building2, Loader2, Pencil, Trash2 } from "lucide-react"
import { Plus, Building2, Pencil, Trash2 } from "lucide-react"
import { toast } from "sonner"
import { useWorkspace } from "../context/WorkspaceContext"
import { useAppContext } from "../context/AppContext"
@@ -16,6 +16,7 @@ import CreateClientModal from "../components/CreateClientModal"
import EditClientModal from "../components/EditClientModal"
import DeleteClientModal from "../components/DeleteClientModal"
import FilterBar from "../components/FilterBar"
import { ListPageSkeleton } from "../components/ListPageSkeleton"
import { Button } from "../components/ui/button"
import { Card, CardContent, CardTitle } from "../components/ui/card"
import { Pagination } from "../components/Pagination"
@@ -120,7 +121,8 @@ export default function Clients() {
}
return (
<div className="mx-auto max-w-7xl space-y-5 p-4 md:p-6">
<div className="mx-auto flex min-h-full max-w-7xl flex-col p-4 md:p-6">
<div className="flex flex-1 flex-col gap-5">
<div className="rounded-3xl border border-slate-200 bg-white p-5 shadow-sm dark:border-slate-800 dark:bg-slate-900 sm:p-6">
<div className="flex items-start justify-between gap-4">
<div>
@@ -155,15 +157,11 @@ export default function Clients() {
</div>
{isLoading ? (
<div className="rounded-3xl border border-slate-200 bg-white p-12 shadow-sm dark:border-slate-800 dark:bg-slate-900">
<div className="flex items-center justify-center text-slate-500 dark:text-slate-400">
<Loader2 className="h-8 w-8 animate-spin" />
</div>
</div>
<ListPageSkeleton variant="standard-grid" />
) : (
<div className="space-y-6">
<div className="flex flex-1 flex-col gap-6">
{clients.length === 0 ? (
<div className="rounded-3xl border-2 border-dashed border-slate-200 bg-white p-12 text-center shadow-sm dark:border-slate-800 dark:bg-slate-900">
<div className="flex flex-1 rounded-3xl border-2 border-dashed border-slate-200 bg-white p-12 text-center shadow-sm dark:border-slate-800 dark:bg-slate-900">
<Building2 className="mx-auto mb-3 h-12 w-12 text-slate-300 dark:text-slate-700" />
<h3 className="text-lg font-medium text-slate-900 dark:text-white">{t.clients.noClients}</h3>
<p className="mt-1 text-slate-500 dark:text-slate-400">
@@ -246,6 +244,7 @@ export default function Clients() {
)}
</div>
)}
</div>
{canCreateClient && (
<CreateClientModal