Skip to content

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

Enhance Sidebar and LiveUserCount component layout and styling

Bill Yang1463bc60cd0a
diff --git a/client/src/app/[site]/components/Sidebar/LiveUserCount.tsx b/client/src/app/[site]/components/Sidebar/LiveUserCount.tsx
index 88b5db134..0793e732e 100644
--- a/client/src/app/[site]/components/Sidebar/LiveUserCount.tsx
+++ b/client/src/app/[site]/components/Sidebar/LiveUserCount.tsx
@@ -10,7 +10,7 @@ export default function LiveUserCount() {
const { data } = useGetLiveUsercount(5);
return (
- <div className="flex items-center gap-2 text-base text-neutral-200 cursor-default">
+ <div className="flex items-center gap-2 text-base text-neutral-200 ml-3 mb-1">
{/* <div className="flex items-center gap-2 text-base text-neutral-200 cursor-default bg-neutral-800/50 rounded-lg px-2 py-1 border border-neutral-750"> */}
<div className="flex justify-center">
<span className="relative flex h-3 w-3">
@@ -21,13 +21,15 @@ export default function LiveUserCount() {
<Tooltip>
<TooltipTrigger>
- {
- <NumberFlow
- respectMotionPreference={false}
- value={data?.count ?? 0}
- />
- }
- <span className="text-sm text-neutral-400 ml-1">users online</span>
+ <span className="text-sm text-neutral-400 ml-1">
+ {
+ <NumberFlow
+ respectMotionPreference={false}
+ value={data?.count ?? 0}
+ />
+ }
+ <span className="ml-1">users online</span>
+ </span>
</TooltipTrigger>
<TooltipContent>
<p>Users online in past 5 minutes</p>
diff --git a/client/src/app/[site]/components/Sidebar/Sidebar.tsx b/client/src/app/[site]/components/Sidebar/Sidebar.tsx
index 0ec9b0519..58f59d6bc 100644
--- a/client/src/app/[site]/components/Sidebar/Sidebar.tsx
+++ b/client/src/app/[site]/components/Sidebar/Sidebar.tsx
@@ -2,6 +2,8 @@
import {
ChartBarDecreasing,
ChartLine,
+ LayoutDashboard,
+ LayoutGrid,
Radio,
Settings,
User,
@@ -39,17 +41,15 @@ export function Sidebar() {
{site && (
<div className="p-3 border-b border-neutral-800 flex flex-col gap-2">
<SiteSelector />
- {/* <div className="flex items-center gap-2">
- <LiveUserCount />
- </div> */}
</div>
)}
- <div className="flex flex-col space-y-1 p-3 mt-1">
+ <div className="flex flex-col space-y-1 p-3 ">
+ <LiveUserCount />
<SidebarLink
label="Main"
active={isActiveTab("main")}
href={getTabPath("main")}
- icon={<ChartLine className="w-4 h-4" />}
+ icon={<LayoutDashboard className="w-4 h-4" />}
/>
<SidebarLink
label="Sessions"
@@ -67,7 +67,7 @@ export function Sidebar() {
label="Retention"
active={isActiveTab("retention")}
href={getTabPath("retention")}
- icon={<ChartBarDecreasing className="w-4 h-4" />}
+ icon={<LayoutGrid className="w-4 h-4" />}
/>
<SidebarLink
label="Reports"
@@ -78,7 +78,7 @@ export function Sidebar() {
<SiteSettings
siteId={site?.siteId ?? 0}
trigger={
- <div className="px-3 py-2.5 rounded-lg transition-colors w-full text-neutral-200 hover:text-white hover:bg-neutral-800/50">
+ <div className="px-3 py-2 rounded-lg transition-colors w-full text-neutral-200 hover:text-white hover:bg-neutral-800/50">
<div className="flex items-center gap-2">
<Settings className="h-4 w-4" />
<span className="text-sm">Settings</span>
@@ -106,7 +106,7 @@ function SidebarLink({
return (
<Link href={href} className="focus:outline-none">
<div
- className={`px-3 py-2.5 rounded-lg transition-colors w-full ${
+ className={`px-3 py-2 rounded-lg transition-colors w-full ${
active
? "bg-neutral-800 text-white"
: "text-neutral-200 hover:text-white hover:bg-neutral-800/50"
diff --git a/client/src/app/[site]/components/SubHeader/DateSelector.tsx b/client/src/app/[site]/components/SubHeader/DateSelector.tsx
index a1e0b20f3..605e581f9 100644
--- a/client/src/app/[site]/components/SubHeader/DateSelector.tsx
+++ b/client/src/app/[site]/components/SubHeader/DateSelector.tsx
@@ -10,6 +10,7 @@ import {
import { Time, useStore } from "@/lib/store";
import { DateTime } from "luxon";
import { CustomDateRangePicker } from "./CustomDateRangePicker";
+import { Calendar, Calendar1 } from "lucide-react";
const getLabel = (time: Time) => {
if (time.mode === "range") {
@@ -70,7 +71,10 @@ export function DateSelector() {
return (
<DropdownMenu>
- <DropdownMenuTrigger>{getLabel(time)}</DropdownMenuTrigger>
+ <DropdownMenuTrigger>
+ <Calendar className="w-4 h-4" />
+ {getLabel(time)}
+ </DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem
onClick={() =>
diff --git a/client/src/app/[site]/components/SubHeader/Filters/NewFilterButton.tsx b/client/src/app/[site]/components/SubHeader/Filters/NewFilterButton.tsx
index f38782797..8ac3dc001 100644
--- a/client/src/app/[site]/components/SubHeader/Filters/NewFilterButton.tsx
+++ b/client/src/app/[site]/components/SubHeader/Filters/NewFilterButton.tsx
@@ -1,5 +1,5 @@
"use client";
-import { Plus } from "lucide-react";
+import { ListFilterPlus, Plus } from "lucide-react";
import { Button } from "../../../../../components/ui/button";
import {
DropdownMenu,
@@ -140,7 +140,7 @@ export function NewFilterButton() {
className="px-3"
onClick={() => setOpen(true)}
>
- <Plus />
+ <ListFilterPlus className="w-4 h-4" />
Filter
</Button>
</DropdownMenuTrigger>
diff --git a/client/src/app/[site]/retention/RetentionChart.tsx b/client/src/app/[site]/retention/RetentionChart.tsx
index d7433c846..fc7f4050a 100644
--- a/client/src/app/[site]/retention/RetentionChart.tsx
+++ b/client/src/app/[site]/retention/RetentionChart.tsx
@@ -138,7 +138,7 @@ export function RetentionChart({ data, isLoading, mode }: RetentionChartProps) {
<ResponsiveLine
data={chartData}
theme={nivoTheme}
- margin={{ top: 20, right: 90, bottom: 30, left: 40 }}
+ margin={{ top: 20, right: 120, bottom: 30, left: 40 }}
xScale={{
type: "linear",
min: 0,
diff --git a/client/src/app/[site]/retention/page.tsx b/client/src/app/[site]/retention/page.tsx
index 863e8d174..59b9d4df9 100644
--- a/client/src/app/[site]/retention/page.tsx
+++ b/client/src/app/[site]/retention/page.tsx
@@ -308,7 +308,7 @@ export default function RetentionPage() {
: [];
return (
- <div className="pt-4">
+ <div className="pt-1">
{/* Single Card containing both chart and grid */}
<Card>
<CardHeader className="flex flex-row items-center justify-between pb-2">
@@ -337,7 +337,7 @@ export default function RetentionPage() {
style={{
gridTemplateColumns: `minmax(120px, auto) repeat(${
data.maxPeriods + 1
- }, minmax(90px, auto))`,
+ }, minmax(80px, auto))`,
}}
>
{/* Header Row */}
@@ -357,8 +357,8 @@ export default function RetentionPage() {
{cohortKeys.map((cohortPeriod) => (
<Fragment key={cohortPeriod}>
{/* Cohort Info Cell */}
- <div className="p-3 bg-neutral-900 text-sm sticky left-0 z-10 border-r border-neutral-800">
- <div className="font-medium whitespace-nowrap text-neutral-100">
+ <div className="py-2 px-2 bg-neutral-900 text-sm sticky left-0 z-10 border-r border-neutral-800">
+ <div className="whitespace-nowrap text-neutral-100">
{formatDate(cohortPeriod)}
</div>
<div className="text-xs text-neutral-300 mt-1 whitespace-nowrap">
@@ -374,7 +374,7 @@ export default function RetentionPage() {
return (
<div
key={`${cohortPeriod}-period-${index}`}
- className="m-[2px] p-3 text-center flex items-center justify-center font-medium transition-colors duration-150 bg-neutral-900 rounded-md"
+ className="m-[2px] text-center flex items-center justify-center font-medium transition-colors duration-150 bg-neutral-900 rounded-md"
style={{
backgroundColor,
color: textColor,