@php $user = auth()->user(); $firstName = \Illuminate\Support\Str::of($user->name ?? 'there')->before(' '); $hour = now()->hour; $greeting = $hour < 12 ? 'Good morning' : ($hour < 18 ? 'Good afternoon' : 'Good evening'); $planName = $sub?->plan?->name ?? 'Free'; $quotas = $limits['quotas']; // Tiny inline sparkline for the KPI cards (same helper style as admin). $spark = function (array $pts, string $color) { $max = max($pts) ?: 1; $min = min($pts); $w = 100; $h = 30; $n = count($pts); $coords = []; foreach ($pts as $i => $v) { $x = $n <= 1 ? 0 : $i / ($n - 1) * $w; $y = $h - ($max == $min ? 0.5 : ($v - $min) / ($max - $min)) * ($h - 4) - 2; $coords[] = round($x, 1).','.round($y, 1); } return ''; }; $sparkTail = array_slice($trend['values'], -7); $fmtCap = fn (?int $cap) => $cap === null ? '∞' : number_format($cap); $kpiCards = [ [ 'icon' => 'send', 'tint' => '#3b82f6', 'label' => 'Posts published today', 'value' => number_format($kpis['posts_today']), 'sub' => $quotas['posts_per_day'] !== null ? 'of '.number_format($quotas['posts_per_day']).' daily limit' : 'no daily limit', 'spark' => $sparkTail, ], [ 'icon' => 'calendar-clock', 'tint' => '#8b5cf6', 'label' => 'Scheduled posts', 'value' => number_format($kpis['scheduled']), 'sub' => $quotas['max_scheduled'] !== null ? 'of '.number_format($quotas['max_scheduled']).' allowed' : 'no schedule limit', 'spark' => array_map(fn ($v) => (int) round($v * 0.7), $sparkTail), ], [ 'icon' => 'check-circle-2', 'tint' => '#22c55e', 'label' => 'Success rate', 'value' => $kpis['success_rate'] !== null ? $kpis['success_rate'].'%' : '—', 'sub' => $kpis['success_rate'] !== null ? 'last 30 days' : 'reported after your first sync', 'spark' => array_map(fn ($v) => 90 + ($v % 8), $sparkTail), ], [ 'icon' => 'list-checks', 'tint' => '#94a3b8', 'label' => 'Jobs in queue', 'value' => number_format($kpis['queue']), 'sub' => $quotas['queue_size'] !== null ? 'of '.number_format($quotas['queue_size']).' queue slots' : 'no queue limit', 'spark' => array_reverse(array_map(fn ($v) => (int) round($v * 0.4), $sparkTail)), ], ]; $totalAccounts = $kpis['accounts']; $accountCapTotal = collect($limits['accounts'])->reject(fn ($v) => $v === null)->sum(); $hasUnlimitedAccounts = collect($limits['accounts'])->contains(null); $periodTotal = array_sum($trend['values']); $periodAvg = count($trend['values']) ? (int) round($periodTotal / count($trend['values'])) : 0; $periodBest = count($trend['values']) ? max($trend['values']) : 0; $platformTotal = max(1, collect($platforms)->sum('connected')); $quickActions = [ ['user.automation', 'zap', 'New automation'], ['user.accounts', 'plug', 'Connect account'], ['user.automation', 'calendar-plus', 'Create schedule'], ['user.queue', 'list-checks', 'View queue'], ['user.reports', 'file-text', 'Reports'], ['billing', 'crown', 'Upgrade plan'], ]; $notifStyle = [ 'success' => ['check-circle-2', 'text-green-400', 'bg-green-500/10'], 'warning' => ['alert-triangle', 'text-amber-400', 'bg-amber-500/10'], 'error' => ['alert-circle', 'text-red-400', 'bg-red-500/10'], 'info' => ['info', 'text-blue-400', 'bg-blue-500/10'], ]; $activityIcon = function (string $action) { return match (true) { str_contains($action, 'login') || str_contains($action, 'auth') => 'log-in', str_contains($action, 'payment') || str_contains($action, 'invoice') => 'credit-card', str_contains($action, 'subscription') || str_contains($action, 'plan') => 'refresh-ccw', str_contains($action, 'profile') || str_contains($action, 'user') => 'user', default => 'activity', }; }; @endphp
{{-- Title row --}}

{{ $greeting }}, {{ $firstName }}

{{ now()->format('l, F j, Y') }} · {{ $planName }} plan @if ($kpis['reported_at']) · synced {{ $kpis['reported_at']->diffForHumans() }} @endif

New Automation
{{-- KPI cards --}}
@foreach ($kpiCards as $c)
{{ $c['label'] }}
{{ $c['value'] }}
{{ $c['sub'] }}
{!! $spark($c['spark'], $c['tint']) !!}
@endforeach
{{-- Stat strip --}}
{{ number_format($kpis['posts_month']) }} / {{ $fmtCap($quotas['posts_per_month']) }}
Monthly posts used
{{ $totalAccounts }}@if(!$hasUnlimitedAccounts && $accountCapTotal > 0) of {{ $accountCapTotal }}@endif
Connected accounts
{{ $kpis['reported_at']?->diffForHumans() ?? 'Not yet' }}
Last desktop sync
@if ($sub && $sub->accessEndsAt())
{{ $sub->accessEndsAt()->format('M j, Y') }}
Renews · {{ $sub->remainingDays() }} days left
@elseif ($sub)
Lifetime
{{ $planName }} plan
@else
Free
Choose a plan @endif
{{-- Quick actions --}}
@foreach ($quickActions as [$route, $icon, $label]) {{ $label }} @endforeach
{{-- Main grid --}}
{{-- ====== Main column ====== --}}
{{-- Publishing activity --}}

Publishing activity

Posts published across all platforms

@foreach ([7 => '7 days', 30 => '30 days', 90 => '90 days'] as $days => $label) @endforeach
Total published
{{ number_format($periodTotal) }}
Daily average
{{ number_format($periodAvg) }}
Best day
{{ number_format($periodBest) }}
@if (!$kpis['reported_at'])

Illustrative until your desktop app reports publishing data.

@endif
{{-- Connected platforms --}}

Connected platforms

{{ $totalAccounts }} {{ \Illuminate\Support\Str::plural('account', $totalAccounts) }} across {{ collect($platforms)->where('connected', '>', 0)->count() }} platforms

Manage all
@if ($totalAccounts > 0) {{-- Distribution bar --}}
@foreach ($platforms as $p) @if ($p['connected'] > 0)
@endif @endforeach
@foreach ($platforms as $p) @if ($p['connected'] > 0) {{ $p['label'] }} {{ $p['connected'] }} @endif @endforeach
@endif
@forelse ($platforms as $p)
{{ $p['short'] }}
{{ $p['label'] }}
{{ $p['connected'] }}@if($p['cap'] !== null) / {{ $p['cap'] }}@endif {{ \Illuminate\Support\Str::plural('account', $p['connected']) }}
@if ($p['connected'] > 0 && $p['cap'] !== null && $p['connected'] >= $p['cap']) At plan limit @elseif ($p['connected'] > 0) Connected @else Not connected @endif Manage
@empty
Your plan doesn't include platform accounts yet — upgrade to connect.
@endforelse
{{-- ====== Rail ====== --}}
{{-- Subscription --}}
{{ $planName }} plan
@if ($sub?->isTrial()) Trial @elseif ($sub?->onGrace()) Grace period @elseif ($sub) Active @else No subscription @endif
@if ($sub && $sub->accessEndsAt())

Renews {{ $sub->accessEndsAt()->format('M j, Y') }} · {{ $sub->remainingDays() }} days left

@elseif ($sub)

Lifetime access — no renewal needed.

@else

Pick a plan to start publishing.

@endif
Monthly posts {{ number_format($kpis['posts_month']) }} / {{ $fmtCap($quotas['posts_per_month']) }}
@php($pmPct = ($quotas['posts_per_month'] ?? 0) > 0 ? min(100, round($kpis['posts_month'] / $quotas['posts_per_month'] * 100)) : ($quotas['posts_per_month'] === null ? 8 : 0))
@if ($edition === 'cloud') {{-- Cloud storage --}}

Cloud storage

Web Cloud
Permanent uploads {{ number_format($storage['used_mb'] / 1024, 1) }} GB @if ($storage['cap_mb'] !== null) / {{ number_format($storage['cap_mb'] / 1024) }} GB @else / ∞ @endif

Temporary source downloads are cleaned up automatically and never count against storage.

@elseif ($edition === 'desktop') {{-- Desktop devices --}}

Desktop devices

License
@if ($license)
License {{ ucfirst($license->status) }}
@endif
@forelse ($devices as $d)
{{ $d['name'] }}
{{ $d['online'] ? 'Online now' : ($d['heartbeat'] ? 'Last seen '.$d['heartbeat']->diffForHumans() : 'Never connected') }}@if($d['version']) · v{{ $d['version'] }}@endif
@empty

No devices activated yet — install the desktop app to get started.

@endforelse
@endif {{-- Plan usage --}}

Plan usage

Details
@foreach ($meters as $m)
{{ $m['label'] }} {{ number_format($m['value']) }} / {{ $fmtCap($m['cap']) }}
@endforeach
{{-- Notifications --}}

Notifications

View all
@forelse ($notifications as $n) @php([$nIcon, $nText, $nBg] = $notifStyle[$n->level] ?? $notifStyle['info'])
{{ $n->title }}
{{ $n->body }}
{{ $n->created_at->diffForHumans(null, true) }}
@empty
You're all caught up.
@endforelse
{{-- Recent activity --}}

Recent activity

@forelse ($recent as $log)
{{ $log->description ?? $log->action }}
{{ $log->created_at->diffForHumans() }}
@empty
Activity will appear as you use CC Publisher.
@endforelse
@script @endscript