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.

fix(ui): replace ambiguous score labels and add categories to sidebar

spacesdriveffbfc69a9e4a
diff --git a/frontend/src/features/analytics/overview/Overview.jsx b/frontend/src/features/analytics/overview/Overview.jsx
index c7fe3d7..658092a 100644
--- a/frontend/src/features/analytics/overview/Overview.jsx
+++ b/frontend/src/features/analytics/overview/Overview.jsx
@@ -503,14 +503,9 @@ export default function Overview() {
<Tag className="h-3.5 w-3.5 text-purple-500" />
</div>
<span className="flex-1 text-sm font-medium truncate">{stat.category}</span>
- <div className="text-right">
- {stat.ytCount > 0 && (
- <p className="text-[10px] text-red-500 tabular-nums leading-none">{fmtNum(stat.ytViews)} views</p>
- )}
- {stat.rdCount > 0 && (
- <p className="text-[10px] text-orange-500 tabular-nums leading-none mt-0.5">{fmtNum(stat.rdScore)} score</p>
- )}
- </div>
+ <Badge variant="outline" className="text-xs border-purple-200 bg-purple-50 text-purple-700 dark:border-purple-900 dark:bg-purple-950 dark:text-purple-400 shrink-0">
+ Category
+ </Badge>
</button>
))}
</div>
diff --git a/frontend/src/features/analytics/tracked/TrackedCategory.jsx b/frontend/src/features/analytics/tracked/TrackedCategory.jsx
index 830b1e5..243ca38 100644
--- a/frontend/src/features/analytics/tracked/TrackedCategory.jsx
+++ b/frontend/src/features/analytics/tracked/TrackedCategory.jsx
@@ -210,7 +210,7 @@ export default function TrackedCategory() {
/>
<StatCard
icon={<Flame />}
- label="Total Score"
+ label="Reddit Score"
value={rdItems.length > 0 ? fmtNum(rdStats.score) : '-'}
subtitle={rdItems.length > 0 ? `avg ${fmtNum(rdStats.avgScore)} per post` : 'no Reddit posts'}
gradient="orange"
@@ -407,9 +407,9 @@ export default function TrackedCategory() {
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
<StatCard
icon={<Flame />}
- label="Total Score"
+ label="Net Upvotes"
value={fmtNum(rdStats.score)}
- subtitle={`avg ${fmtNum(rdStats.avgScore)} per post`}
+ subtitle="upvotes minus downvotes"
gradient="orange"
/>
<StatCard
@@ -428,7 +428,7 @@ export default function TrackedCategory() {
/>
<StatCard
icon={<BarChart2 />}
- label="Avg Score"
+ label="Avg Net Upvotes"
value={fmtNum(rdStats.avgScore)}
subtitle={`${rdItems.length} post${rdItems.length !== 1 ? 's' : ''} tracked`}
gradient="purple"
diff --git a/frontend/src/layout/Sidebar.jsx b/frontend/src/layout/Sidebar.jsx
index 3ea036b..18f82af 100644
--- a/frontend/src/layout/Sidebar.jsx
+++ b/frontend/src/layout/Sidebar.jsx
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { useState, useEffect } from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import {
Sidebar, SidebarContent, SidebarFooter, SidebarGroup,
@@ -8,10 +8,11 @@ import {
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
import {
LayoutDashboard, PlaySquare, Scissors, Camera,
- Upload, Users, Settings, Flame, Bookmark,
+ Upload, Users, Settings, Flame, Bookmark, Tag,
} from 'lucide-react';
import { useAppContext } from '../context/AppContext';
+import { api } from '../services/api';
const NAV_GROUPS = [
{
@@ -45,6 +46,18 @@ export default function AppSidebar() {
const location = useLocation();
const { accounts } = useAppContext();
+ const [categories, setCategories] = useState([]);
+
+ useEffect(() => {
+ api.getTrackedContent()
+ .then(data => {
+ const all = Array.isArray(data) ? data : [];
+ const cats = [...new Set(all.map(p => p.category).filter(Boolean))].sort();
+ setCategories(cats);
+ })
+ .catch(() => {});
+ }, []);
+
const isActive = (path) => {
if (path === '/') return location.pathname === '/';
return location.pathname.startsWith(path);
@@ -136,6 +149,31 @@ export default function AppSidebar() {
</SidebarMenu>
</SidebarGroup>
)}
+
+ {/* Categories quick list */}
+ {categories.length > 0 && (
+ <SidebarGroup>
+ <SidebarSeparator />
+ <SidebarGroupLabel>Categories</SidebarGroupLabel>
+ <SidebarMenu>
+ {categories.map((cat) => {
+ const path = `/tracked-content/category/${encodeURIComponent(cat)}`;
+ return (
+ <SidebarMenuItem key={cat}>
+ <SidebarMenuButton
+ isActive={location.pathname === path}
+ onClick={() => navigate(path)}
+ tooltip={cat}
+ >
+ <Tag className="size-4 text-purple-500 flex-shrink-0" />
+ <span className="truncate text-sm">{cat}</span>
+ </SidebarMenuButton>
+ </SidebarMenuItem>
+ );
+ })}
+ </SidebarMenu>
+ </SidebarGroup>
+ )}
</SidebarContent>
{/* Footer */}