refactor: remove Review tab, make UI state client-side, fix Jakarta time in analytics

- Remove Review tab completely (was redundant with Messages flagged view)
- UI state now client-side only (localStorage) — no server API calls for tab/channel/guild selection
- Fixes dashboard crash when server is down — now loads fully client-side
- Live panel still uses server API for voice/media operations (only what needs it)
- Analytics hourly chart labels now show Jakarta time (WIB/UTC+7) instead of UTC
- Analytics formatTimeAgo uses Jakarta time reference
- Reduced tabs to 3: Live, Messages, Analytics
- Removed unused uiState API imports and server-side state fetching

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-05-30 16:31:27 +07:00
co-authored by Claude Opus 4.8
parent 9019e24263
commit c7abe39728
6 changed files with 46 additions and 45 deletions
@@ -499,7 +499,12 @@ function HourlyChart({ hourly, loading }: { hourly: HourlyBucket[] | undefined;
}
const maxCount = Math.max(...hourly.map((b) => b.count), 1);
const labels = hourly.map((b) => b.hour.slice(11, 16));
// Convert UTC hour buckets to Jakarta time (UTC+7)
const labels = hourly.map((b) => {
const utcHour = parseInt(b.hour.slice(11, 13), 10);
const jakartaHour = (utcHour + 7) % 24;
return `${String(jakartaHour).padStart(2, "0")}:00`;
});
return (
<div ref={containerRef} className="space-y-3">
@@ -553,7 +558,7 @@ function HourlyChart({ hourly, loading }: { hourly: HourlyBucket[] | undefined;
</div>
{/* Hover tooltip */}
<div className="absolute -top-10 left-1/2 z-20 -translate-x-1/2 whitespace-nowrap rounded-lg bg-popover px-2.5 py-1.5 text-xs font-medium text-popover-foreground opacity-0 shadow-lg transition-opacity group-hover:opacity-100 pointer-events-none">
{bucket.hour.slice(11, 16)} {bucket.count} msgs
{labels[hourly.indexOf(bucket)]} {bucket.count} msgs
</div>
</motion.div>
);
@@ -987,7 +992,9 @@ function pct(part: number, total: number): number {
}
function formatTimeAgo(ts: number): string {
const diff = Date.now() - ts;
// Use Jakarta time as reference for "ago" calculations
const jakartaNow = new Date(new Date().toLocaleString("en-US", { timeZone: "Asia/Jakarta" }));
const diff = jakartaNow.getTime() - ts;
const minutes = Math.floor(diff / 60000);
if (minutes < 1) return "baru saja";
if (minutes < 60) return `${minutes}m lalu`;