@props(['active' => 'dashboard']) {{-- Operator-console sidebar (matches ui/dash/dashboard-v3). Shown only when the admin picks the "sidebar" user-dashboard layout. Colour is admin-set (Appearance → Sidebar colour); ALL text/icons/panels auto-adapt to the chosen background's brightness (dark bg → light text, light bg → dark text) via CSS variables, so any colour stays readable. --}} @php $groups = \App\Support\UserNav::groups(); $u = auth()->user(); $ws = $u?->currentWorkspace; $wsName = $ws?->name ?: brand_name(); $wsInitials = \Illuminate\Support\Str::of($wsName)->trim()->limit(2, '')->upper()->__toString(); $planLabel = $ws?->billingPackage()?->pname ?: __('Free'); $walletMoney = \App\Support\FormatSettings::display((int) round(((int) ($u->wallet_credits ?? 0)) * \App\Services\MessageCreditRate::minorPerCredit()) / 100); // Per-workspace white-label logo wins over the platform logo — mirrors the // header (header.blade.php), so a workspace's uploaded logo shows in the // sidebar too, not just the header. $logoUrl = ($ws && $ws->brand_logo_path) ? asset('storage/' . $ws->brand_logo_path) : \App\Support\Brand::logoUrl(\App\Support\Brand::activeTheme()); // White-label tenant domain: locked to one workspace — no switch targets/create. $__lockWs = ($isTenantDomain ?? false); $allWorkspaces = ($u && !$__lockWs) ? $u->workspaces()->orderByDesc('last_active_at')->get() : collect(); $canCreateWorkspace = ($u && !$__lockWs) ? $u->canCreateWorkspace() : false; // Admin-customisable rail colour + auto contrast. $railBg = (string) \App\Models\SystemSetting::get('user_sidebar_color', '') ?: '#06100E'; $__hex = ltrim($railBg, '#'); if (strlen($__hex) === 3) { $__hex = $__hex[0].$__hex[0].$__hex[1].$__hex[1].$__hex[2].$__hex[2]; } $__lum = 0.05; if (strlen($__hex) === 6 && ctype_xdigit($__hex)) { $__r = hexdec(substr($__hex, 0, 2)); $__g = hexdec(substr($__hex, 2, 2)); $__b = hexdec(substr($__hex, 4, 2)); $__lum = (0.299 * $__r + 0.587 * $__g + 0.114 * $__b) / 255; } $light = $__lum > 0.6; // light background → use dark text (auto) // Optional admin overrides. $textColor = (string) \App\Models\SystemSetting::get('user_sidebar_text_color', ''); $accentColor = (string) \App\Models\SystemSetting::get('user_sidebar_accent_color', '') ?: '#25D366'; // hex → "r,g,b" helper for building translucent tokens. $rgb = function (string $hex): string { $h = ltrim($hex, '#'); if (strlen($h) === 3) { $h = $h[0].$h[0].$h[1].$h[1].$h[2].$h[2]; } if (strlen($h) !== 6 || !ctype_xdigit($h)) { return '255,255,255'; } return hexdec(substr($h, 0, 2)) . ',' . hexdec(substr($h, 2, 2)) . ',' . hexdec(substr($h, 4, 2)); }; if ($textColor !== '' && preg_match('/^#[0-9A-Fa-f]{6}$/', $textColor)) { // Explicit text colour → derive the whole scale from it. $t = $rgb($textColor); $vars = [ '--rfg' => "rgba($t,0.72)", '--rfgs' => $textColor, '--rfgm' => "rgba($t,0.5)", '--rcap' => "rgba($t,0.42)", '--rhover' => "rgba($t,0.08)", '--rpanel' => "rgba($t,0.06)", '--rpanelbd' => "rgba($t,0.14)", '--rdot' => "rgba($t,0.07)", '--rscroll' => "rgba($t,0.2)", ]; } else { $vars = [ '--rfg' => $light ? 'rgba(11,31,28,0.68)' : 'rgba(255,255,255,0.62)', '--rfgs' => $light ? '#0B1F1C' : '#FBFAF6', '--rfgm' => $light ? 'rgba(11,31,28,0.5)' : 'rgba(255,255,255,0.45)', '--rcap' => $light ? 'rgba(11,31,28,0.42)' : 'rgba(255,255,255,0.32)', '--rhover' => $light ? 'rgba(0,0,0,0.05)' : 'rgba(255,255,255,0.06)', '--rpanel' => $light ? 'rgba(0,0,0,0.045)' : 'rgba(255,255,255,0.05)', '--rpanelbd' => $light ? 'rgba(0,0,0,0.10)' : 'rgba(255,255,255,0.10)', '--rdot' => $light ? 'rgba(0,0,0,0.05)' : 'rgba(255,255,255,0.06)', '--rscroll' => $light ? 'rgba(0,0,0,0.18)' : 'rgba(255,255,255,0.15)', ]; } $vars['--racc'] = $accentColor; $vars['--racc-tint'] = 'rgba(' . $rgb($accentColor) . ',0.16)'; // A custom background is a fixed inline colour (overrides theme). Without one, // the CSS below drives the background AND the text/panel colours per active // theme, so the rail live-switches light↔dark like the admin sidebar (the app // themes paper/bright/doodle are LIGHT, only `dark` is dark). $hasCustomBg = trim((string) \App\Models\SystemSetting::get('user_sidebar_color', '')) !== ''; $applyInlineText = $hasCustomBg || ($textColor !== '' && preg_match('/^#[0-9A-Fa-f]{6}$/', $textColor)); $styleVars = $hasCustomBg ? ('background:' . $railBg . ';') : ''; foreach ($vars as $k => $v) { // Accent (brand) always applies inline; text/panel vars only when a custom // colour is configured — otherwise the theme CSS below owns them so the // rail adapts to light/dark on its own. if ($k === '--racc' || $k === '--racc-tint' || $applyInlineText) { $styleVars .= $k . ':' . $v . ';'; } } @endphp