diff --git a/app/Models/Plugin.php b/app/Models/Plugin.php index 382751d..8f0ec75 100644 --- a/app/Models/Plugin.php +++ b/app/Models/Plugin.php @@ -343,12 +343,22 @@ class Plugin extends Model } if ($standalone) { - return view('trmnl-layouts.single', [ - 'colorDepth' => $device?->deviceModel?->color_depth, - 'deviceVariant' => $device?->deviceModel?->name ?? 'og', - 'scaleLevel' => $device?->deviceModel?->scale_level, - 'slot' => $renderedContent, - ])->render(); + if ($size === 'full') { + return view('trmnl-layouts.single', [ + 'colorDepth' => $device?->deviceModel?->color_depth, + 'deviceVariant' => $device?->deviceModel?->name ?? 'og', + 'scaleLevel' => $device?->deviceModel?->scale_level, + 'slot' => $renderedContent, + ])->render(); + } else { + return view('trmnl-layouts.mashup', [ + 'mashupLayout' => $this->getPreviewMashupLayoutForSize($size), + 'colorDepth' => $device?->deviceModel?->color_depth, + 'deviceVariant' => $device?->deviceModel?->name ?? 'og', + 'scaleLevel' => $device?->deviceModel?->scale_level, + 'slot' => $renderedContent, + ])->render(); + } } return $renderedContent; @@ -386,4 +396,13 @@ class Plugin extends Model { return $this->configuration[$key] ?? $default; } + + public function getPreviewMashupLayoutForSize(string $size): string + { + return match ($size) { + 'half_vertical' => '1Lx1R', + 'quadrant' => '2x2', + default => '1Tx1B', + }; + } }