Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Update ldrs dependency and enhance loading indicators

Bill Yang76ac82dcae3a
diff --git a/client/package-lock.json b/client/package-lock.json
index 56e703f04..c766c6fd2 100644
--- a/client/package-lock.json
+++ b/client/package-lock.json
@@ -50,7 +50,7 @@
"deps": "^1.0.0",
"geojson": "^0.5.0",
"jotai": "^2.12.1",
- "ldrs": "^1.0.2",
+ "ldrs": "^1.1.6",
"leaflet": "^1.9.4",
"lodash": "^4.17.21",
"lucide-react": "^0.487.0",
@@ -6555,9 +6555,9 @@
}
},
"node_modules/ldrs": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/ldrs/-/ldrs-1.0.2.tgz",
- "integrity": "sha512-sYJmivdkIiHrUEqTrEWccBoLdaENpzbzkABI5rk8rRxTXrg9i2xVuDvUUuhOhJY3RmQyaoxs046pM1DCRdcIpg=="
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/ldrs/-/ldrs-1.1.6.tgz",
+ "integrity": "sha512-cyFUYjmhjHaEnFXcZFeNg/jfDYUuzdf7sj71uqQeUoniFzcifSe3zxCf3qWqGD4R49wtAFTrHOpqPyCuzMik9g=="
},
"node_modules/leaflet": {
"version": "1.9.4",
diff --git a/client/package.json b/client/package.json
index 5c58d836a..ec380da4a 100644
--- a/client/package.json
+++ b/client/package.json
@@ -51,7 +51,7 @@
"deps": "^1.0.0",
"geojson": "^0.5.0",
"jotai": "^2.12.1",
- "ldrs": "^1.0.2",
+ "ldrs": "^1.1.6",
"leaflet": "^1.9.4",
"lodash": "^4.17.21",
"lucide-react": "^0.487.0",
diff --git a/client/src/app/[site]/components/shared/StandardSection/StandardSection.tsx b/client/src/app/[site]/components/shared/StandardSection/StandardSection.tsx
index 05b946ffa..d0dad9c4e 100644
--- a/client/src/app/[site]/components/shared/StandardSection/StandardSection.tsx
+++ b/client/src/app/[site]/components/shared/StandardSection/StandardSection.tsx
@@ -7,6 +7,7 @@ import {
} from "../../../../../api/analytics/useSingleCol";
import { FilterParameter } from "../../../../../lib/store";
import { BaseStandardSection } from "./BaseStandardSection";
+import { CardLoader } from "../../../../../components/ui/card";
export function StandardSection({
title,
@@ -49,19 +50,26 @@ export function StandardSection({
}, [previousData, getKey]);
return (
- <BaseStandardSection
- title={title}
- data={data}
- isFetching={isLoading}
- error={error}
- refetch={refetch}
- getKey={getKey}
- getLabel={getLabel}
- getValue={getValue}
- getFilterLabel={getFilterLabel}
- getLink={getLink}
- countLabel={countLabel}
- filterParameter={filterParameter}
- />
+ <>
+ {isLoading && (
+ <div className="absolute top-[-8px] left-0 w-full h-full">
+ <CardLoader />
+ </div>
+ )}
+ <BaseStandardSection
+ title={title}
+ data={data}
+ isFetching={isLoading}
+ error={error}
+ refetch={refetch}
+ getKey={getKey}
+ getLabel={getLabel}
+ getValue={getValue}
+ getFilterLabel={getFilterLabel}
+ getLink={getLink}
+ countLabel={countLabel}
+ filterParameter={filterParameter}
+ />
+ </>
);
}
diff --git a/client/src/app/[site]/main/components/MainSection/MainSection.tsx b/client/src/app/[site]/main/components/MainSection/MainSection.tsx
index fe9e94dbc..025a9ff46 100644
--- a/client/src/app/[site]/main/components/MainSection/MainSection.tsx
+++ b/client/src/app/[site]/main/components/MainSection/MainSection.tsx
@@ -40,10 +40,10 @@ export function MainSection() {
return (
<>
<Card>
- {(isOverviewFetching || isOverviewFetchingPrevious) && <CardLoader />}
<CardContent className="p-0 w-full">
<Overview />
</CardContent>
+ {(isOverviewFetching || isOverviewFetchingPrevious) && <CardLoader />}
</Card>
<Card>
{(isFetching || isPreviousFetching) && <CardLoader />}
diff --git a/client/src/app/layout.tsx b/client/src/app/layout.tsx
index f7b7661ed..14b7a2b1d 100644
--- a/client/src/app/layout.tsx
+++ b/client/src/app/layout.tsx
@@ -83,23 +83,9 @@ export default function RootLayout({
}, [isPending, user, pathname, isCheckingPublic, isPublicSite]);
return (
- <html lang="en" className="h-full dark">
- <body
- className={`${inter.className} h-full bg-background text-foreground`}
- >
+ <html lang="en" className="dark">
+ <body className={`${inter.className} bg-background text-foreground`}>
<Toaster />
- {/* The ldrs are very pretty but it's super annoying to load them
- https://github.com/GriffinJohnston/ldrs/blob/main/framework-guides.md#nextjs */}
- <script
- type="module"
- defer
- src="https://cdn.jsdelivr.net/npm/ldrs/dist/auto/zoomies.js"
- ></script>
- <script
- type="module"
- defer
- src="https://cdn.jsdelivr.net/npm/ldrs/dist/auto/ping.js"
- ></script>
<TooltipProvider>
<QueryProvider>
{pathname === "/login" || pathname === "/signup" ? (
diff --git a/client/src/components/ui/card.tsx b/client/src/components/ui/card.tsx
index de8378a36..eae40baac 100644
--- a/client/src/components/ui/card.tsx
+++ b/client/src/components/ui/card.tsx
@@ -3,7 +3,10 @@
import * as React from "react";
import { cn } from "@/lib/utils";
import { useMeasure } from "@uidotdev/usehooks";
+import { Zoomies } from "ldrs/react";
+import "ldrs/react/Zoomies.css";
+// Default values shown
const Card = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
@@ -27,9 +30,8 @@ const CardLoader = React.forwardRef<
return (
<div ref={ref2} className="mt-[-15px] absolute top-0 left-0 w-full">
- {/* @ts-ignore */}
- <l-zoomies
- size={1000}
+ <Zoomies
+ size={1400}
stroke="3"
bg-opacity="0.1"
speed="1.4"