Skip to content

Commit b594c4e

Browse files
committed
chore: loader on quotes page
1 parent c282424 commit b594c4e

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

src/pages/quotes/QuotesPage.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Skeleton } from "@/components/ui/skeleton"
66
import { listPendingQuotesOptions } from "@/generated/client/@tanstack/react-query.gen"
77
import useLocalStorage from "@/hooks/use-local-storage"
88
import { useSuspenseQuery } from "@tanstack/react-query"
9-
import { ViewIcon } from "lucide-react"
9+
import { LoaderIcon } from "lucide-react"
1010
import { Suspense } from "react"
1111
import { Link, useNavigate } from "react-router"
1212

@@ -35,24 +35,39 @@ function QuoteListPendingRaw() {
3535
function QuoteListPending() {
3636
const navigate = useNavigate()
3737

38-
const { data } = useSuspenseQuery({
38+
const { data, isFetching } = useSuspenseQuery({
3939
...listPendingQuotesOptions({}),
4040
})
4141

4242
return (
4343
<>
44+
<H3>
45+
<span className="flex items-center gap-1">
46+
<span>Pending</span>
47+
<span>{isFetching && <LoaderIcon className="stroke-1 animate-spin" />}</span>
48+
</span>
49+
</H3>
50+
4451
<div className="flex flex-col gap-1">
4552
{data.quotes.map((it, index) => {
4653
return (
4754
<div key={index} className="flex gap-1 items-center text-sm">
48-
<Link to={"/quotes/:id".replace(":id", it)}>{it}</Link>
55+
{isFetching ? (
56+
<>{it}</>
57+
) : (
58+
<>
59+
<Link to={"/quotes/:id".replace(":id", it)}>{it}</Link>
60+
</>
61+
)}
62+
4963
<Button
5064
size="sm"
65+
disabled={isFetching}
5166
onClick={() => {
5267
void navigate("/quotes/:id".replace(":id", it))
5368
}}
5469
>
55-
<ViewIcon />
70+
View
5671
</Button>
5772
</div>
5873
)
@@ -71,7 +86,6 @@ function DevSection() {
7186
function PageBody() {
7287
return (
7388
<>
74-
<H3>Pending</H3>
7589
<Suspense fallback={<Loader />}>
7690
<QuoteListPending />
7791
</Suspense>

0 commit comments

Comments
 (0)