@php
$platformMeta = \App\Services\UserDashboardMetrics::PLATFORM_META;
$chip = function (string $key) use ($platformMeta) {
[$label, $color, $short] = $platformMeta[$key] ?? [ucfirst($key), '#64748b', strtoupper(substr($key, 0, 2))];
return compact('label', 'color', 'short');
};
$statusChip = [
'connected' => 'bg-green-500/15 text-green-400',
'token_expired' => 'bg-amber-500/15 text-amber-400',
'error' => 'bg-red-500/15 text-red-400',
'disabled' => 'bg-slate-500/15 text-slate-400',
];
$statusLabel = [
'connected' => 'Connected',
'token_expired' => 'Token expired',
'error' => 'Error',
'disabled' => 'Disconnecting…',
];
$roleLabel = ['source' => 'Source', 'destination' => 'Destination', 'both' => 'Source + Destination'];
$reportedTotal = $usage && is_array($usage->accounts) ? array_sum($usage->accounts) : 0;
@endphp
{{-- Title row --}}
Accounts
Every social account connected to CC Publisher — sources you repost from and destinations you publish to.
View platforms
{{-- Desktop-report banner when the mirror is empty but usage reports accounts --}}
@if ($counts['all'] === 0 && $reportedTotal > 0)
Your desktop app reports {{ $reportedTotal }} connected {{ \Illuminate\Support\Str::plural('account', $reportedTotal) }} — the detailed list appears once it syncs account data.
@endif
{{-- Attention banner --}}
@if ($counts['attention'] > 0)
{{ $counts['attention'] }} {{ \Illuminate\Support\Str::plural('account', $counts['attention']) }} {{ $counts['attention'] === 1 ? 'needs' : 'need' }} attention — reconnect in the desktop app to keep publishing.
Review
@endif
{{-- List --}}
{{-- Toolbar --}}
@if ($rows->count())
@foreach ($rows as $a)
@php($p = $chip($a->platform))
{{-- Avatar / platform chip --}}
{{ strtoupper(mb_substr($a->username, 0, 1)) }}
{{ $p['short'] }}
{{-- Handle + meta --}}
{{ '@'.$a->username }}
{{ $roleLabel[$a->role] ?? ucfirst($a->role) }}
{{ $p['label'] }}
@if ($a->display_name)· {{ $a->display_name }} @endif
@if ($a->connected_at)· connected {{ $a->connected_at->diffForHumans() }} @endif
@if ($a->status === 'connected' && $a->token_expires_at && $a->token_expires_at->lt(now()->addWeek()))
· token expires {{ $a->token_expires_at->diffForHumans() }}
@endif
@if ($a->status === 'error' && $a->error)
{{ $a->error }}
@endif
{{-- Status --}}
@if ($a->status === 'connected') @endif
{{ $statusLabel[$a->status] ?? ucfirst($a->status) }}
{{-- Actions --}}
@if (in_array($a->status, ['token_expired', 'error']))
Reconnect in app
@endif
@if ($a->status !== 'disabled')
@endif
@endforeach
@if ($rows->hasPages())
{{ $rows->links('pagination.dark') }}
@endif
@else
@if ($counts['all'] === 0)
No accounts connected
Connect your social accounts in the CC Publisher desktop app — they appear here after its next sync.
Get the desktop app
@else
Nothing matches
No accounts match your search or filter.
@endif
@endif
Connecting and reconnecting accounts happens in the desktop app (it holds the platform tokens). Disconnects made here apply on its next sync.