Skip to content

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

Update button styles and improve chart component rendering logic

Bill Yangba52b872ed68
diff --git a/client/src/app/[site]/components/SubHeader/SubHeader.tsx b/client/src/app/[site]/components/SubHeader/SubHeader.tsx
index ce4cc24dc..27875baca 100644
--- a/client/src/app/[site]/components/SubHeader/SubHeader.tsx
+++ b/client/src/app/[site]/components/SubHeader/SubHeader.tsx
@@ -54,7 +54,7 @@ export function SubHeader({ availableFilters }: { availableFilters?: FilterParam
<DateSelector time={time} setTime={setTime} />
<div className="flex items-center">
<Button
- variant="outline"
+ variant="secondary"
size="icon"
onClick={goBack}
disabled={time.mode === "past-minutes"}
@@ -63,7 +63,7 @@ export function SubHeader({ availableFilters }: { availableFilters?: FilterParam
<ChevronLeft />
</Button>
<Button
- variant="outline"
+ variant="secondary"
size="icon"
onClick={goForward}
disabled={!canGoForward(time)}
diff --git a/client/src/app/[site]/main/components/MainSection/Chart.tsx b/client/src/app/[site]/main/components/MainSection/Chart.tsx
index 78fe068a9..3da127aa7 100644
--- a/client/src/app/[site]/main/components/MainSection/Chart.tsx
+++ b/client/src/app/[site]/main/components/MainSection/Chart.tsx
@@ -318,19 +318,21 @@ export function Chart({
const previousTime = slice.points[0].data.previousTime as DateTime;
const diff = currentY - previousY;
- const diffPercentage = previousY ? (diff / previousY) * 100 : 9999;
+ const diffPercentage = previousY ? (diff / previousY) * 100 : null;
return (
<div className="text-sm bg-neutral-850 p-2 rounded-md border border-neutral-750">
- <div
- className="text-lg font-medium"
- style={{
- color: diffPercentage > 0 ? "hsl(var(--green-400))" : "hsl(var(--red-400))",
- }}
- >
- {diffPercentage > 0 ? "+" : ""}
- {diffPercentage.toFixed(2)}%
- </div>
+ {diffPercentage !== null && (
+ <div
+ className="text-lg font-medium"
+ style={{
+ color: diffPercentage > 0 ? "hsl(var(--green-400))" : "hsl(var(--red-400))",
+ }}
+ >
+ {diffPercentage > 0 ? "+" : ""}
+ {diffPercentage.toFixed(2)}%
+ </div>
+ )}
<div className="flex justify-between text-sm w-40">
<div>{formatChartDateTime(currentTime, bucket)}</div>
diff --git a/client/src/components/ui/button.tsx b/client/src/components/ui/button.tsx
index 8e75b07c6..d2beff657 100644
--- a/client/src/components/ui/button.tsx
+++ b/client/src/components/ui/button.tsx
@@ -12,7 +12,7 @@ const buttonVariants = cva(
default:
"bg-neutral-50 text-neutral-950 border border-neutral-200 shadow hover:bg-neutral-900/90 dark:bg-neutral-850 dark:border-neutral-750 dark:text-neutral-50 dark:hover:bg-neutral-800/90 dark:hover:border-neutral-650",
secondary:
- "bg-neutral-100 text-neutral-900 shadow-sm hover:bg-neutral-100/80 dark:bg-neutral-50 dark:text-neutral-800 dark:hover:bg-neutral-50/90",
+ "bg-neutral-900 border border-neutral-800 shadow-sm hover:bg-neutral-800/80 hover:border-neutral-700",
accent:
"bg-neutral-500 text-neutral-900 shadow-sm hover:bg-neutral-500/80 dark:bg-accent-600 dark:text-neutral-50 dark:hover:bg-accent-600/90",
success: