fix: mashup preview for Framework v2
Some checks failed
tests / ci (push) Has been cancelled

This commit is contained in:
Benjamin Nussbaum 2025-09-19 17:33:00 +02:00
parent ee9f21a83d
commit e9037ef5d7

View file

@ -343,12 +343,22 @@ class Plugin extends Model
} }
if ($standalone) { if ($standalone) {
if ($size === 'full') {
return view('trmnl-layouts.single', [ return view('trmnl-layouts.single', [
'colorDepth' => $device?->deviceModel?->color_depth, 'colorDepth' => $device?->deviceModel?->color_depth,
'deviceVariant' => $device?->deviceModel?->name ?? 'og', 'deviceVariant' => $device?->deviceModel?->name ?? 'og',
'scaleLevel' => $device?->deviceModel?->scale_level, 'scaleLevel' => $device?->deviceModel?->scale_level,
'slot' => $renderedContent, 'slot' => $renderedContent,
])->render(); ])->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; return $renderedContent;
@ -386,4 +396,13 @@ class Plugin extends Model
{ {
return $this->configuration[$key] ?? $default; return $this->configuration[$key] ?? $default;
} }
public function getPreviewMashupLayoutForSize(string $size): string
{
return match ($size) {
'half_vertical' => '1Lx1R',
'quadrant' => '2x2',
default => '1Tx1B',
};
}
} }