Skip to content

Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.

feat(reddit): explain the upvote rate column

spacesdrive3d562388cf9c
diff --git a/frontend/src/components/ColumnHint.jsx b/frontend/src/components/ColumnHint.jsx
new file mode 100644
index 0000000..c8bce28
--- /dev/null
+++ b/frontend/src/components/ColumnHint.jsx
@@ -0,0 +1,19 @@
+import { Info } from 'lucide-react';
+import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
+
+// A table header label with an info button that explains what the column measures.
+export default function ColumnHint({ label, hint }) {
+ return (
+ <span className="inline-flex items-center justify-end gap-1">
+ {label}
+ <Tooltip>
+ <TooltipTrigger
+ render={<button type="button" aria-label={`About ${label}`} className="rounded-full text-ink-faint transition-colors hover:text-ink focus-visible:outline-2 focus-visible:outline-ring" />}
+ >
+ <Info className="size-3.5" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-64 text-left">{hint}</TooltipContent>
+ </Tooltip>
+ </span>
+ );
+}
diff --git a/frontend/src/features/analytics/reddit/RedditAnalytics.jsx b/frontend/src/features/analytics/reddit/RedditAnalytics.jsx
index 024281f..1ef6b51 100644
--- a/frontend/src/features/analytics/reddit/RedditAnalytics.jsx
+++ b/frontend/src/features/analytics/reddit/RedditAnalytics.jsx
@@ -22,6 +22,7 @@ import { api } from '../../../services/api';
import { fmtNum, fmtNumFull, fmtDate, timeAgo } from '../../../utils/formatters';
import { MEDIA_TYPE_LABELS } from './redditPostUtils';
import { cn } from '@/lib/utils';
+import ColumnHint from '@/components/ColumnHint';
const MEDIA_TYPE_ORDER = ['text', 'image', 'video', 'link'];
@@ -302,7 +303,7 @@ export default function RedditAnalytics() {
<TableHead>Post</TableHead>
<TableHead className="text-right">Karma</TableHead>
<TableHead className="text-right">Comments</TableHead>
- <TableHead className="text-right">Upvoted</TableHead>
+ <TableHead className="text-right"><ColumnHint label="Upvote rate" hint="Share of votes on the post that are upvotes. 96% means 96 of every 100 votes were up." /></TableHead>
<TableHead className="text-right">Posted</TableHead>
<TableHead className="w-10"><span className="sr-only">Open</span></TableHead>
</TableRow>
diff --git a/frontend/src/features/analytics/reddit/redditPostTable.jsx b/frontend/src/features/analytics/reddit/redditPostTable.jsx
index 15817b4..328e052 100644
--- a/frontend/src/features/analytics/reddit/redditPostTable.jsx
+++ b/frontend/src/features/analytics/reddit/redditPostTable.jsx
@@ -11,6 +11,7 @@ import { EmptyState } from '@/components/StateViews';
import { AccountAvatar } from '@/components/platform';
import { MEDIA_TYPE_LABELS, REDDIT_SORT_OPTIONS } from './redditPostUtils';
import { fmtNum, fmtDate } from '../../../utils/formatters';
+import ColumnHint from '@/components/ColumnHint';
const MEDIA_TYPE_ICONS = { image: Image, video: Video, link: Link2, text: FileText };
@@ -74,7 +75,7 @@ export function RedditPostTable({ posts, showAccount = false, accountsById = {}
<TableHead className="w-24">Type</TableHead>
<TableHead className="w-24 text-right">Karma</TableHead>
<TableHead className="w-24 text-right">Comments</TableHead>
- <TableHead className="w-24 text-right">Upvoted</TableHead>
+ <TableHead className="w-32 text-right"><ColumnHint label="Upvote rate" hint="Share of votes on the post that are upvotes. 96% means 96 of every 100 votes were up." /></TableHead>
<TableHead className="w-28 text-right">Posted</TableHead>
<TableHead className="w-10"><span className="sr-only">Open</span></TableHead>
</TableRow>
diff --git a/frontend/src/features/analytics/tracked/TrackedCategory.jsx b/frontend/src/features/analytics/tracked/TrackedCategory.jsx
index d4c6e13..28d0f27 100644
--- a/frontend/src/features/analytics/tracked/TrackedCategory.jsx
+++ b/frontend/src/features/analytics/tracked/TrackedCategory.jsx
@@ -18,6 +18,7 @@ import { useAppContext } from '../../../context/AppContext';
import { api } from '../../../services/api';
import { fmtNum, fmtNumFull, fmtDate } from '../../../utils/formatters';
import { trackedViews, hasTrackedViews, isRedditItem } from '../../../utils/trackedContent';
+import ColumnHint from '@/components/ColumnHint';
// fmtNum abbreviates only at 1000 and above, so the full value is redundant below that
function showsFullValue(n) {
@@ -229,7 +230,7 @@ export default function TrackedCategory() {
<TableHead>Post</TableHead>
<TableHead className="w-28 text-right">Karma</TableHead>
<TableHead className="w-24 text-right">Views</TableHead>
- <TableHead className="w-20 text-right">Upvoted</TableHead>
+ <TableHead className="w-32 text-right"><ColumnHint label="Upvote rate" hint="Share of votes on a Reddit post that are upvotes. Shows a dash for YouTube videos and for posts under 10 karma, where the ratio is not meaningful." /></TableHead>
<TableHead className="w-24 text-right">Comments</TableHead>
<TableHead className="w-28 text-right">Fetched</TableHead>
<TableHead className="w-10"><span className="sr-only">Open</span></TableHead>
diff --git a/frontend/src/features/analytics/tracked/TrackedContent.jsx b/frontend/src/features/analytics/tracked/TrackedContent.jsx
index 4924cb5..85b6e24 100644
--- a/frontend/src/features/analytics/tracked/TrackedContent.jsx
+++ b/frontend/src/features/analytics/tracked/TrackedContent.jsx
@@ -31,6 +31,7 @@ import {
trackedViews, hasTrackedViews, detectContentType, isRedditItem, trackedEngagement, trackedComments,
} from '../../../utils/trackedContent';
import { cn } from '@/lib/utils';
+import ColumnHint from '@/components/ColumnHint';
const MAX_IMAGE_BYTES = 10 * 1024 * 1024;
@@ -449,7 +450,7 @@ export default function TrackedContent() {
<TableHead className="w-24 text-right">Views</TableHead>
<TableHead className="w-28 text-right">Likes or karma</TableHead>
<TableHead className="w-24 text-right">Comments</TableHead>
- <TableHead className="w-20 text-right">Upvoted</TableHead>
+ <TableHead className="w-32 text-right"><ColumnHint label="Upvote rate" hint="Share of votes on a Reddit post that are upvotes. Shows a dash for YouTube videos and for posts under 10 karma, where the ratio is not meaningful." /></TableHead>
<TableHead className="w-28 text-right">Fetched</TableHead>
<TableHead className="w-32"><span className="sr-only">Actions</span></TableHead>
</TableRow>