Skip to content

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

Refactor SiteRedirect and enhance Overview component for better data handling

Bill Yang34c2c64d8c55
diff --git a/client/src/app/[site]/main/components/MainSection/Overview.tsx b/client/src/app/[site]/main/components/MainSection/Overview.tsx
index bf49502eb..c183870a5 100644
--- a/client/src/app/[site]/main/components/MainSection/Overview.tsx
+++ b/client/src/app/[site]/main/components/MainSection/Overview.tsx
@@ -70,10 +70,11 @@ const Stat = ({
const { data, isFetching, error } = useGetOverviewBucketed({ site });
- const sparklinesData = data?.data.map((d) => ({
- value: d[id],
- time: d.time,
- }));
+ const sparklinesData =
+ data?.data?.map((d) => ({
+ value: d[id],
+ time: d.time,
+ })) ?? [];
return (
<div
diff --git a/client/src/app/[site]/page.tsx b/client/src/app/[site]/page.tsx
index c43988e85..d0a6b087e 100644
--- a/client/src/app/[site]/page.tsx
+++ b/client/src/app/[site]/page.tsx
@@ -1,7 +1,5 @@
"use client";
-import { useEffect } from "react";
-
// This is a simple fallback page that should never be seen
// All redirects should be handled by the middleware
export default function SiteRedirect() {
diff --git a/client/src/components/TopBar.tsx b/client/src/components/TopBar.tsx
index 328dfc6c3..573fe6277 100644
--- a/client/src/components/TopBar.tsx
+++ b/client/src/components/TopBar.tsx
@@ -19,10 +19,10 @@ export function TopBar() {
const queryClient = useQueryClient();
return (
- <div className="flex py-1 px-3 items-center w-full bg-neutral-950 justify-center border-b border-neutral-750">
+ <div className="flex py-2 px-3 items-center w-full bg-neutral-950 justify-center border-b border-neutral-750">
<div className="flex items-center justify-between flex-1">
<div className="flex items-center space-x-4">
- <Link href="/" className="font-semibold text-base">
+ <Link href="/" className="text-base font-semibold">
🐸 Frogstats
</Link>
</div>
@@ -31,6 +31,7 @@ export function TopBar() {
<DropdownMenuTrigger
className="flex items-center gap-1 text-xs font-medium px-2 py-0"
variant="ghost"
+ size="xs"
>
<User className="w-4 h-4" />
{session.data?.user.name}
@@ -53,7 +54,7 @@ export function TopBar() {
</DropdownMenu>
) : (
<Link href="/signup" legacyBehavior passHref>
- <Button variant="ghost" size="sm">
+ <Button variant="ghost" size="xs">
Sign up
</Button>
</Link>
diff --git a/client/src/components/ui/button.tsx b/client/src/components/ui/button.tsx
index 6c57b47a3..6cf704a9a 100644
--- a/client/src/components/ui/button.tsx
+++ b/client/src/components/ui/button.tsx
@@ -30,6 +30,7 @@ const buttonVariants = cva(
size: {
default: "h-9 px-4 py-2",
sm: "h-8 rounded-md px-3 text-xs",
+ xs: "h-6 rounded-sm px-2 text-xs",
lg: "h-10 rounded-md px-8",
icon: "h-9 w-9",
},