🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Refactor MainSection layout and improve component styling
Bill Yang3ff58b2ae372
diff --git a/client/src/app/[site]/main/components/MainSection/BucketSelection.tsx b/client/src/app/[site]/main/components/MainSection/BucketSelection.tsxindex 80d58f7a6..a6ce314f0 100644--- a/client/src/app/[site]/main/components/MainSection/BucketSelection.tsx+++ b/client/src/app/[site]/main/components/MainSection/BucketSelection.tsx@@ -108,8 +108,8 @@ export function BucketSelection() {return (<Select value={bucket} onValueChange={setBucket}>- <SelectTrigger className="w-[120px]" size="sm">- <SelectValue placeholder="Theme" />+ <SelectTrigger className="w-[100px]" size="sm">+ <SelectValue /></SelectTrigger>{getOptions(time)}</Select>diff --git a/client/src/app/[site]/main/components/MainSection/Chart.tsx b/client/src/app/[site]/main/components/MainSection/Chart.tsxindex af0a8483b..566195612 100644--- a/client/src/app/[site]/main/components/MainSection/Chart.tsx+++ b/client/src/app/[site]/main/components/MainSection/Chart.tsx@@ -133,7 +133,7 @@ export function Chart({},]}theme={nivoTheme}- margin={{ top: 20, right: 20, bottom: 20, left: 40 }}+ margin={{ top: 0, right: 15, bottom: 20, left: 40 }}xScale={{type: "time",format: "%Y-%m-%d %H:%M:%S",@@ -184,7 +184,8 @@ export function Chart({enableTouchCrosshair={true}enablePoints={false}useMesh={true}- motionConfig="stiff"+ animate={false}+ // motionConfig="stiff"enableSlices={"x"}colors={["hsl(var(--accent-400))"]}enableArea={true}diff --git a/client/src/app/[site]/main/components/MainSection/MainSection.tsx b/client/src/app/[site]/main/components/MainSection/MainSection.tsxindex 2196563cd..c5fe2232f 100644--- a/client/src/app/[site]/main/components/MainSection/MainSection.tsx+++ b/client/src/app/[site]/main/components/MainSection/MainSection.tsx@@ -33,10 +33,7 @@ export function MainSection() {<Card>{(isOverviewFetching || isOverviewFetchingPrevious) && <CardLoader />}<CardContent className="pt-4 w-full">- <div className="flex justify-between items-center">- <Overview />- <BucketSelection />- </div>+ <Overview /></CardContent></Card><Card>@@ -58,6 +55,9 @@ export function MainSection() {}/></div>+ <div className="absolute top-0 right-[14px]">+ <BucketSelection />+ </div></div></CardContent></Card>diff --git a/client/src/app/[site]/main/components/MainSection/Overview.tsx b/client/src/app/[site]/main/components/MainSection/Overview.tsxindex 0cbba9c6b..8478022fe 100644--- a/client/src/app/[site]/main/components/MainSection/Overview.tsx+++ b/client/src/app/[site]/main/components/MainSection/Overview.tsx@@ -17,32 +17,22 @@ const ChangePercentage = ({if (previous === 0) {if (current === 0) {- return (- <Badge variant="minimal" className="text-xs">- 0%- </Badge>- );+ return <div className="text-sm">0%</div>;}- return (- <Badge className="text-xs" variant="green">- +999%- </Badge>- );+ return <div className="text-sm">+999%</div>;}if (change === 0) {- return (- <Badge variant="minimal" className="text-xs">- 0%- </Badge>- );+ return <div className="text-sm">0%</div>;}return (- <Badge variant={change > 0 ? "green" : "red"} className="text-xs">+ <div+ className={cn("text-sm", change > 0 ? "text-green-400" : "text-red-400")}+ >{change > 0 ? "+" : ""}{change.toFixed(0)}%- </Badge>+ </div>);};@@ -122,7 +112,7 @@ export function Overview() {overviewDataPrevious?.data?.session_duration ?? 0;return (- <div className="flex gap-0 items-center">+ <div className="grid grid-cols-6 gap-0 items-center"><Stattitle="Unique Users"id="users"diff --git a/client/src/app/[site]/main/components/MainSection/PreviousChart.tsx b/client/src/app/[site]/main/components/MainSection/PreviousChart.tsxindex 911f0a26a..f7f3d6e3f 100644--- a/client/src/app/[site]/main/components/MainSection/PreviousChart.tsx+++ b/client/src/app/[site]/main/components/MainSection/PreviousChart.tsx@@ -54,7 +54,7 @@ export function PreviousChart({},]}theme={nivoTheme}- margin={{ top: 20, right: 20, bottom: 20, left: 40 }}+ margin={{ top: 0, right: 15, bottom: 20, left: 40 }}xScale={{type: "time",format: "%Y-%m-%d %H:%M:%S",@@ -102,7 +102,8 @@ export function PreviousChart({enableTouchCrosshair={true}enablePoints={false}useMesh={true}- motionConfig="stiff"+ animate={false}+ // motionConfig="stiff"enableSlices={"x"}colors={["hsl(var(--neutral-700))"]}/>