Skip to content

Commit 1aa9b1f

Browse files
committed
chore: pages dev section
1 parent fde4402 commit 1aa9b1f

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

src/pages/balances/BalancesPage.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { PropsWithChildren, Suspense } from "react"
77
import { Skeleton } from "@/components/ui/skeleton"
88
import { BalancesResponse, fetchBalances } from "@/lib/api"
99
import { useSuspenseQuery } from "@tanstack/react-query"
10+
import useLocalStorage from "@/hooks/use-local-storage"
1011

1112
function Loader() {
1213
return (
@@ -175,10 +176,26 @@ function PageBody() {
175176
<OtherBalanceChart />
176177
</Card>
177178
</div>
179+
</>
180+
)
181+
}
178182

183+
184+
function DevSection() {
185+
const [devMode] = useLocalStorage("devMode", false)
186+
const { data } = useSuspenseQuery({
187+
queryKey: ["balances"],
188+
queryFn: fetchBalances,
189+
})
190+
191+
return (
192+
<>
193+
{devMode && (
194+
179195
<pre className="text-sm bg-accent text-accent-foreground rounded-lg p-2 my-2">
180196
{JSON.stringify(data, null, 2)}
181197
</pre>
198+
)}
182199
</>
183200
)
184201
}
@@ -191,6 +208,7 @@ export default function BalancesPage() {
191208

192209
<Suspense fallback={<Loader />}>
193210
<PageBody />
211+
<DevSection />
194212
</Suspense>
195213
</>
196214
)

src/pages/quotes/QuotesPage.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { H3 } from "@/components/Headings"
33
import { PageTitle } from "@/components/PageTitle"
44
import { Button } from "@/components/ui/button"
55
import { Skeleton } from "@/components/ui/skeleton"
6+
import useLocalStorage from "@/hooks/use-local-storage"
67
import { fetchAdminQuotePending } from "@/lib/api"
78
import { useSuspenseQuery } from "@tanstack/react-query"
89
import { ViewIcon } from "lucide-react"
@@ -55,13 +56,24 @@ function QuoteListPending() {
5556
)
5657
}
5758

59+
function DevSection() {
60+
const [devMode] = useLocalStorage("devMode", false)
61+
62+
return (
63+
<>
64+
{devMode && (
65+
<QuoteListPendingRaw />
66+
)}
67+
</>
68+
)
69+
}
70+
5871
function PageBody() {
5972
return (
6073
<>
6174
<H3>Pending</H3>
6275
<Suspense fallback={<Loader />}>
6376
<QuoteListPending />
64-
<QuoteListPendingRaw />
6577
</Suspense>
6678
</>
6779
)
@@ -73,6 +85,9 @@ export default function QuotesPage() {
7385
<Breadcrumbs>Quotes</Breadcrumbs>
7486
<PageTitle>Quotes</PageTitle>
7587
<PageBody />
88+
<Suspense>
89+
<DevSection />
90+
</Suspense>
7691
</>
7792
)
7893
}

0 commit comments

Comments
 (0)