🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Refactor SiteCard and Home components for improved layout and functionality
Bill Yangb8d27d02ab60
diff --git a/client/src/app/page.tsx b/client/src/app/page.tsxindex 389e35eca..6bf1b3903 100644--- a/client/src/app/page.tsx+++ b/client/src/app/page.tsx@@ -91,7 +91,7 @@ export default function Home() {</div></div>{hasNoOrganizations && <NoOrganization />}- <div className="flex flex-col gap-4">+ <div className="flex flex-col gap-2">{sites?.sites?.map(site => {return <SiteCard key={site.siteId} siteId={site.siteId} domain={site.domain} />;})}diff --git a/client/src/components/SiteCard.tsx b/client/src/components/SiteCard.tsxindex 192712c34..aa033cfc9 100644--- a/client/src/components/SiteCard.tsx+++ b/client/src/components/SiteCard.tsx@@ -1,3 +1,4 @@+import { Settings } from "lucide-react";import Link from "next/link";import { useRef } from "react";import { useGetOverview } from "../api/analytics/hooks/useGetOverview";@@ -8,6 +9,7 @@ import { useStore } from "../lib/store";import { formatter } from "../lib/utils";import { Favicon } from "./Favicon";import { SiteSessionChart } from "./SiteSessionChart";+import { SiteSettings } from "./SiteSettings/SiteSettings";import { Skeleton } from "./ui/skeleton";interface SiteCardProps {@@ -64,7 +66,7 @@ export function SiteCard({ siteId, domain }: SiteCardProps) {<Link href={`/${siteId}`}><divref={ref}- className="flex flex-col md:flex-row md:justify-between gap-3 rounded-lg bg-white dark:bg-neutral-900/70 px-4 py-3 border border-neutral-100 dark:border-neutral-850 transition-all duration-300 hover:translate-y-[-2px] w-full"+ className="flex flex-col md:flex-row md:justify-between gap-3 rounded-lg bg-white dark:bg-neutral-900/70 px-3 py-2 border border-neutral-100 dark:border-neutral-850 transition-all duration-300 hover:translate-y-[-2px] w-full">{showSkeleton ? (<>@@ -91,6 +93,16 @@ export function SiteCard({ siteId, domain }: SiteCardProps) {<div className="flex gap-2 items-center"><Favicon domain={domain} className="w-6 h-6" /><span className="text-lg font-medium truncate group-hover:underline transition-all">{domain}</span>+ <div onClick={(e) => e.preventDefault()}>+ <SiteSettings+ siteId={siteId}+ trigger={+ <button className="p-1 rounded hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-colors">+ <Settings className="h-4 w-4 text-neutral-500" />+ </button>+ }+ />+ </div></div><div className="flex flex-col sm:flex-row gap-2 sm:gap-4 items-start sm:items-center justify-between"><div className="relative rounded-md w-[200px] h-[50px]">