@php $brandColor = $settings->brand_color ?: '#2563EB'; $isStory = $imageSize === 'story'; $isSquare = $imageSize === 'square'; $isFacebook = $imageSize === 'facebook'; $isLight = $imageTheme === 'light'; $outcomeTotal = max(1, $report['wins'] + $report['losses'] + $report['breakeven']); $winPercent = round(($report['wins'] / $outcomeTotal) * 100, 1); $lossPercent = round(($report['losses'] / $outcomeTotal) * 100, 1); $lossStop = min(100, $winPercent + $lossPercent); $equityValues = collect($report['equityCurve'])->pluck('value'); $equityMin = (float) $equityValues->min(); $equityMax = (float) $equityValues->max(); $equityRange = max(1, $equityMax - $equityMin); $equityCount = max(1, count($report['equityCurve']) - 1); $equityPoints = collect($report['equityCurve'])->values()->map(function ($point, $index) use ($equityMin, $equityRange, $equityCount) { $x = round(($index / $equityCount) * 100, 2); $y = round(76 - ((((float) $point['value'] - $equityMin) / $equityRange) * 58), 2); return $x.','.$y; })->implode(' '); $sessionMax = max(1, max($report['sessionBreakdown'])); $avatarUrl = $user->profileImageUrl(); $appHost = request()->getSchemeAndHttpHost(); if (str_starts_with($avatarUrl, 'http') && ! str_starts_with($avatarUrl, $appHost)) { $defaultReportAvatar = \App\Models\Avatar::defaultImagePath(); $avatarUrl = str_starts_with($defaultReportAvatar, 'avatars/') ? asset('storage/'.$defaultReportAvatar) : asset($defaultReportAvatar); } $logoPath = $settings->report_logo_path ? asset('storage/'.$settings->report_logo_path) : asset($isLight ? 'images/brand/vizutrade-logo-dark.png' : 'images/brand/vizutrade-logo-light.png'); $panel = $isLight ? 'bg-white/80 text-slate-950 ring-blue-100/80' : 'bg-white/12 text-white ring-white/15'; $softPanel = $isLight ? 'bg-blue-50/85 text-slate-950 ring-blue-100' : 'bg-slate-950/28 text-white ring-white/10'; $label = $isLight ? 'text-blue-700' : 'text-blue-100'; @endphp