mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-14 07:27:47 +00:00
feat: enhanced device support when rendering mashups
This commit is contained in:
parent
19a8bb18cc
commit
ee9f21a83d
2 changed files with 8 additions and 2 deletions
|
|
@ -135,10 +135,13 @@ class PlaylistItem extends Model
|
||||||
/**
|
/**
|
||||||
* Render all plugins with appropriate layout
|
* Render all plugins with appropriate layout
|
||||||
*/
|
*/
|
||||||
public function render(): string
|
public function render(?Device $device = null): string
|
||||||
{
|
{
|
||||||
if (! $this->isMashup()) {
|
if (! $this->isMashup()) {
|
||||||
return view('trmnl-layouts.single', [
|
return view('trmnl-layouts.single', [
|
||||||
|
'colorDepth' => $device?->deviceModel?->color_depth,
|
||||||
|
'deviceVariant' => $device?->deviceModel?->name ?? 'og',
|
||||||
|
'scaleLevel' => $device?->deviceModel?->scale_level,
|
||||||
'slot' => $this->plugin instanceof Plugin
|
'slot' => $this->plugin instanceof Plugin
|
||||||
? $this->plugin->render('full', false)
|
? $this->plugin->render('full', false)
|
||||||
: throw new Exception('Invalid plugin instance'),
|
: throw new Exception('Invalid plugin instance'),
|
||||||
|
|
@ -160,6 +163,9 @@ class PlaylistItem extends Model
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('trmnl-layouts.mashup', [
|
return view('trmnl-layouts.mashup', [
|
||||||
|
'colorDepth' => $device?->deviceModel?->color_depth,
|
||||||
|
'deviceVariant' => $device?->deviceModel?->name ?? 'og',
|
||||||
|
'scaleLevel' => $device?->deviceModel?->scale_level,
|
||||||
'mashupLayout' => $this->getMashupLayoutType(),
|
'mashupLayout' => $this->getMashupLayoutType(),
|
||||||
'slot' => implode('', $pluginMarkups),
|
'slot' => implode('', $pluginMarkups),
|
||||||
])->render();
|
])->render();
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ Route::get('/display', function (Request $request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$markup = $playlistItem->render();
|
$markup = $playlistItem->render(device: $device);
|
||||||
GenerateScreenJob::dispatchSync($device->id, null, $markup);
|
GenerateScreenJob::dispatchSync($device->id, null, $markup);
|
||||||
|
|
||||||
$device->refresh();
|
$device->refresh();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue