Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9c8c016
fix(docker): exclude worktrees + agent dirs from build context
LucasSantana-Dev May 13, 2026
e542c24
fix(docker): real bot healthcheck via Redis TCP PING
LucasSantana-Dev May 13, 2026
004a69e
fix(docker): add development stage for dev compose
LucasSantana-Dev May 13, 2026
60a2b42
chore(docker): non-root nginx (UID 101) + healthchecks
LucasSantana-Dev May 13, 2026
a0bce94
chore(docker): add resource limits + env_file fallback
LucasSantana-Dev May 13, 2026
b048a85
chore(docker): pin webhook base to almir/webhook:2.8.3
LucasSantana-Dev May 13, 2026
76b54b0
chore(docker): consolidate stages, venv yt-dlp, align frontend dev to…
LucasSantana-Dev May 13, 2026
6cd4533
docs(docker): ADR for chore/docker-overhaul
LucasSantana-Dev May 13, 2026
4479ac3
Merge branch 'release/v2.11.0' into chore/docker-overhaul
LucasSantana-Dev May 14, 2026
334fcb8
fix(docker): address CodeRabbit findings on #848
LucasSantana-Dev May 14, 2026
1e67c48
ci(docker): add yt-dlp smoke test to bot image build
LucasSantana-Dev May 14, 2026
3607704
feat(frontend): redesign landing page with ui-expert four-gate workflow
LucasSantana-Dev May 15, 2026
09812e9
Merge remote-tracking branch 'origin/release/v2.11.0' into chore/dock…
LucasSantana-Dev May 15, 2026
05da676
ui(dashboard): asymmetric KPI + Linear-style quick actions
LucasSantana-Dev May 15, 2026
1006424
test(dashboard): update playedBy fallback assertion to 'Unknown'
LucasSantana-Dev May 15, 2026
43f3c7d
Merge branch 'release/v2.11.0' into chore/docker-overhaul
LucasSantana-Dev May 15, 2026
56f2c82
fix(ui): address CodeRabbit findings on #856
LucasSantana-Dev May 15, 2026
7793bac
test(dashboard): add CompactStat branch coverage
LucasSantana-Dev May 15, 2026
e6a51e4
test(dashboard): use 0 instead of undefined for memberCount fixture
LucasSantana-Dev May 15, 2026
c240911
test(dashboard): expand quick-action + hero KPI coverage
LucasSantana-Dev May 15, 2026
7d1511b
test(dashboard): cover timeAgo() branches across all ranges
LucasSantana-Dev May 15, 2026
8834a8e
test(dashboard): cover reduced-motion + missing case fields branches
LucasSantana-Dev May 15, 2026
8cb6f37
test(landing): cover stats fetch error path + zero-count branch
LucasSantana-Dev May 15, 2026
1a3a1d8
test(landing): use waitFor + try/finally for deterministic async cleanup
LucasSantana-Dev May 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ x-common-app-env: &common-app-env
SPOTIFY_LINK_SECRET: ${SPOTIFY_LINK_SECRET:-}
WEBAPP_REDIRECT_URI: ${WEBAPP_REDIRECT_URI:-}
WEBAPP_SESSION_SECRET: ${WEBAPP_SESSION_SECRET:-}

services:
postgres:
<<: *large-svc
Expand Down
88 changes: 86 additions & 2 deletions packages/frontend/src/pages/DashboardOverview.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,50 @@ describe('DashboardOverview', () => {
expect(screen.getByText('150')).toBeInTheDocument()
})

test('shows zero member count when guild memberCount is missing', () => {
mockGuildStoreFn({ ...mockGuild, memberCount: 0 })
setupQueryHookMocks(
mockStats,
{ cases: mockCases },
mockTracks,
mockLeaderboard,
mockStarboardEntries,
)
renderPage()
expect(screen.getByText('Total Members')).toBeInTheDocument()
expect(screen.getByText('0')).toBeInTheDocument()
})

test('renders KPI compact stats with icons for each tone', () => {
mockGuildStoreFn(mockGuild)
setupQueryHookMocks(
{ ...mockStats, activeCases: 7, totalCases: 142, casesByType: { ...mockStats.casesByType, warn: 64 } },
{ cases: mockCases },
mockTracks,
mockLeaderboard,
mockStarboardEntries,
)
renderPage()
expect(screen.getByText('7')).toBeInTheDocument()
expect(screen.getByText('142')).toBeInTheDocument()
// 64 appears both in the Auto-Mod CompactStat and the Cases-by-Type tile grid.
expect(screen.getAllByText('64').length).toBeGreaterThanOrEqual(1)
})

test('uses fallback 0 for KPI compact stats when stats missing', () => {
mockGuildStoreFn(mockGuild)
setupQueryHookMocks(
undefined,
{ cases: mockCases },
mockTracks,
mockLeaderboard,
mockStarboardEntries,
)
renderPage()
const zeros = screen.getAllByText('0')
expect(zeros.length).toBeGreaterThanOrEqual(3)
})

test('renders header with guild name', () => {
mockGuildStoreFn(mockGuild)
setupQueryHookMocks(
Expand Down Expand Up @@ -283,6 +327,46 @@ describe('DashboardOverview', () => {
expect(screen.getByText('Custom Commands')).toBeInTheDocument()
})

test('renders every quick action row with title and description', () => {
mockGuildStoreFn(mockGuild)
setupQueryHookMocks(
mockStats,
{ cases: mockCases },
mockTracks,
mockLeaderboard,
mockStarboardEntries,
)
renderPage()
const quickActionLabels = [
['Moderation Cases', 'Review warnings, mutes, kicks, and bans.'],
['Auto-Moderation', 'Tune filters and anti-spam automation.'],
['Server Logs', 'Audit events and moderation activity.'],
['Custom Commands', 'Manage scripted server shortcuts.'],
['Music Player', 'View queue, playback, and track history.'],
['Levels & XP', 'Configure XP, level rewards, and leaderboards.'],
['Starboard', 'Manage community highlights.'],
] as const
for (const [title, description] of quickActionLabels) {
expect(screen.getByText(title)).toBeInTheDocument()
expect(screen.getByText(description)).toBeInTheDocument()
}
})

test('renders hero KPI total members context line', () => {
mockGuildStoreFn(mockGuild)
setupQueryHookMocks(
mockStats,
{ cases: mockCases },
mockTracks,
mockLeaderboard,
mockStarboardEntries,
)
renderPage()
expect(
screen.getByText(/Active members across Test Guild/),
).toBeInTheDocument()
})

test('renders cases by type breakdown when stats available', () => {
mockGuildStoreFn(mockGuild)
setupQueryHookMocks(
Expand Down Expand Up @@ -312,7 +396,7 @@ describe('DashboardOverview', () => {
expect(screen.getByText('Another Track')).toBeInTheDocument()
})

test('renders placeholder dash when playedBy is missing', () => {
test('renders fallback label when playedBy is missing', () => {
mockGuildStoreFn(mockGuild)
setupQueryHookMocks(
mockStats,
Expand All @@ -322,7 +406,7 @@ describe('DashboardOverview', () => {
mockStarboardEntries,
)
renderPage()
expect(screen.getByText('—')).toBeInTheDocument()
expect(screen.getByText('Unknown')).toBeInTheDocument()
})

test('renders empty music state when no tracks are returned', () => {
Expand Down
197 changes: 146 additions & 51 deletions packages/frontend/src/pages/DashboardOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import SectionHeader from '@/components/ui/SectionHeader'
import EmptyState from '@/components/ui/EmptyState'
import StatTile from '@/components/ui/StatTile'
import ActionPanel from '@/components/ui/ActionPanel'
import { useGuildStore } from '@/stores/guildStore'
import { hasModuleAccess } from '@/lib/rbac'
import { cn } from '@/lib/utils'
Expand Down Expand Up @@ -71,6 +70,67 @@
return new Date(dateStr).toLocaleDateString()
}

type CompactStatTone = 'brand' | 'accent' | 'success' | 'warning' | 'neutral'

const compactToneClass: Record<CompactStatTone, string> = {
brand: 'bg-lucky-brand/15 text-lucky-brand',
accent: 'bg-lucky-brand/15 text-lucky-brand',
success: 'bg-lucky-success/15 text-lucky-success',
warning: 'bg-lucky-warning/15 text-lucky-warning',
neutral: 'bg-lucky-bg-active text-lucky-text-tertiary',
}

function CompactStat({
label,
value,
icon,
tone = 'neutral',
delta,
}: {
label: string
value: string | number
icon?: ReactElement
tone?: CompactStatTone
delta?: number
}) {

Check warning on line 95 in packages/frontend/src/pages/DashboardOverview.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=LucasSantana-Dev_Lucky&issues=AZ4pjOUzgYpe4Bv-L5AF&open=AZ4pjOUzgYpe4Bv-L5AF&pullRequest=856
return (
<div className='flex items-center justify-between gap-3 px-4 py-3'>
<div className='flex items-center gap-2.5 min-w-0'>
{icon && (
<span
className={cn(
'flex h-7 w-7 shrink-0 items-center justify-center rounded-md',
compactToneClass[tone],
)}
aria-hidden='true'
>
{icon}
</span>
)}
<p className='type-meta truncate text-lucky-text-tertiary'>{label}</p>
</div>
<div className='flex items-center gap-2'>
{delta !== undefined && (
<span
className={cn(
'rounded-full px-1.5 py-0.5 text-[10px] font-medium',
delta >= 0
? 'bg-lucky-success/10 text-lucky-success'
: 'bg-lucky-error/10 text-lucky-error',
)}
>
{delta >= 0 ? '+' : ''}
{delta}%
</span>
)}
<p className='font-[var(--font-lucky-display)] text-lg font-semibold text-lucky-text-primary tabular-nums'>
{typeof value === 'number' ? value.toLocaleString() : value}
</p>
</div>
</div>
)
}

function CaseRow({ case: c, index }: { case: ModerationCase; index: number }) {
const ActionIcon = ACTION_ICONS[c.type] || Shield
const prefersReducedMotion = useReducedMotion()
Expand Down Expand Up @@ -219,42 +279,61 @@
eyebrow='Server analytics'
/>

<div className='grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4'>
<div className='grid grid-cols-1 gap-4 lg:grid-cols-[2fr_1fr]'>
{loading ? (
Array.from({ length: 4 }).map((_, index) => (
<div key={index} className='surface-panel p-5'>
<Skeleton className='mb-3 h-4 w-20' />
<Skeleton className='mb-2 h-8 w-16' />
<Skeleton className='h-3 w-28' />
<>
<div className='surface-panel flex flex-col justify-between gap-6 p-6'>
<Skeleton className='h-4 w-28' />
<Skeleton className='h-12 w-32' />
<Skeleton className='h-4 w-44' />
</div>
<div className='surface-panel divide-y divide-lucky-border/40'>
{Array.from({ length: 3 }).map((_, i) => (
<div key={i} className='flex items-center justify-between px-4 py-3'>

Check warning on line 292 in packages/frontend/src/pages/DashboardOverview.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not use Array index in keys

See more on https://sonarcloud.io/project/issues?id=LucasSantana-Dev_Lucky&issues=AZ4pjOUzgYpe4Bv-L5AG&open=AZ4pjOUzgYpe4Bv-L5AG&pullRequest=856
<Skeleton className='h-3 w-24' />
<Skeleton className='h-5 w-12' />
</div>
))}
</div>
))
</>
) : (
<>
<StatTile
label='Total Members'
value={selectedGuild.memberCount ?? '—'}
icon={<Users className='h-4 w-4' />}
tone='brand'
/>
<StatTile
label='Active Cases'
value={stats?.activeCases || 0}
delta={stats?.recentCases ? 12 : undefined}
icon={<Shield className='h-4 w-4' />}
tone='accent'
/>
<StatTile
label='Total Cases'
value={stats?.totalCases || 0}
icon={<MessageSquare className='h-4 w-4' />}
tone='neutral'
/>
<StatTile
label='Auto-Mod Actions'
value={stats?.casesByType?.warn || 0}
icon={<ShieldAlert className='h-4 w-4' />}
tone='warning'
/>
<article className='surface-panel flex flex-col justify-between gap-6 p-6'>
<div className='flex items-center justify-between gap-3'>
<p className='type-meta text-lucky-text-tertiary'>Total Members</p>
<span className='rounded-lg bg-lucky-brand/15 p-2.5 text-lucky-brand'>
<Users className='h-4 w-4' aria-hidden='true' />
</span>
</div>
<p className='font-[var(--font-lucky-display)] text-5xl font-semibold leading-none tracking-tight text-lucky-text-strong'>
{typeof selectedGuild.memberCount === 'number'
? selectedGuild.memberCount.toLocaleString()
: '0'}
</p>
<p className='type-body-sm text-lucky-text-tertiary'>
Active members across {selectedGuild.name}
</p>
</article>
<div className='surface-panel divide-y divide-lucky-border/40'>
<CompactStat
label='Active Cases'
value={stats?.activeCases || 0}
icon={<Shield className='h-3.5 w-3.5' />}
tone='accent'
/>
<CompactStat
label='Total Cases'
value={stats?.totalCases || 0}
icon={<MessageSquare className='h-3.5 w-3.5' />}
tone='neutral'
/>
<CompactStat
label='Auto-Mod Actions'
value={stats?.casesByType?.warn || 0}
icon={<ShieldAlert className='h-3.5 w-3.5' />}
tone='warning'
/>
</div>
</>
)}
</div>
Expand Down Expand Up @@ -323,30 +402,46 @@
</motion.section>

<motion.section
className='space-y-4'
className='space-y-3'
initial={prefersReducedMotion ? false : { opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.3, delay: prefersReducedMotion ? 0 : 0.3 }}
aria-labelledby='quick-actions-heading'
>
<h2 className='type-title text-lucky-text-primary'>
<h2
id='quick-actions-heading'
className='type-title text-lucky-text-primary'
>
Quick Actions
</h2>
{visibleQuickActions.map((action) => (
<ActionPanel
key={action.href}
title={action.title}
description={action.description}
icon={action.icon}
action={
<Link
to={action.href}
className='type-body-sm rounded-lg border border-lucky-border px-3 py-1.5 text-lucky-text-secondary hover:text-lucky-text-primary'
<nav className='surface-panel divide-y divide-lucky-border/40 overflow-hidden'>
{visibleQuickActions.map((action) => (
<Link
key={action.href}
to={action.href}
className='group flex items-center gap-3 px-4 py-2.5 transition-colors hover:bg-lucky-bg-tertiary/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-lucky-brand/60'
>
<span
className='flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-lucky-bg-tertiary text-lucky-text-secondary transition-colors group-hover:bg-lucky-brand/15 group-hover:text-lucky-brand'
aria-hidden='true'
>
Open
</Link>
}
/>
))}
{action.icon}
</span>
<div className='min-w-0 flex-1'>
<p className='type-body-sm font-medium text-lucky-text-primary'>
{action.title}
</p>
<p className='truncate text-xs text-lucky-text-tertiary'>
{action.description}
</p>
</div>
<ArrowRight
className='h-3.5 w-3.5 shrink-0 text-lucky-text-tertiary opacity-0 transition-opacity group-hover:opacity-100'
aria-hidden='true'
/>
</Link>
))}
</nav>
</motion.section>
</div>

Expand Down Expand Up @@ -413,7 +508,7 @@
</p>
</div>
<p className='type-body-sm text-lucky-text-secondary'>
{track.playedBy || '—'}
{track.playedBy || 'Unknown'}
</p>
<p className='text-xs text-lucky-text-tertiary text-right'>
{timeAgo(
Expand Down
Loading
Loading