mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-03-14 12:23:33 +00:00
feat(#149): add css_name and css_variables to DeviceModel and update related views
This commit is contained in:
parent
89a2edfcbb
commit
d884ac0a58
15 changed files with 285 additions and 26 deletions
|
|
@ -27,6 +27,7 @@ final class DeviceModel extends Model
|
|||
'offset_x' => 'integer',
|
||||
'offset_y' => 'integer',
|
||||
'published_at' => 'datetime',
|
||||
'css_variables' => 'array',
|
||||
];
|
||||
|
||||
public function getColorDepthAttribute(): ?string
|
||||
|
|
|
|||
|
|
@ -140,8 +140,9 @@ class PlaylistItem extends Model
|
|||
if (! $this->isMashup()) {
|
||||
return view('trmnl-layouts.single', [
|
||||
'colorDepth' => $device?->colorDepth(),
|
||||
'deviceVariant' => $device?->deviceVariant() ?? 'og',
|
||||
'deviceVariant' => $device?->deviceModel?->css_name ?? $device?->deviceVariant() ?? 'og',
|
||||
'scaleLevel' => $device?->scaleLevel(),
|
||||
'cssVariables' => $device?->deviceModel?->css_variables,
|
||||
'slot' => $this->plugin instanceof Plugin
|
||||
? $this->plugin->render('full', false, $device)
|
||||
: throw new Exception('Invalid plugin instance'),
|
||||
|
|
@ -162,8 +163,9 @@ class PlaylistItem extends Model
|
|||
|
||||
return view('trmnl-layouts.mashup', [
|
||||
'colorDepth' => $device?->colorDepth(),
|
||||
'deviceVariant' => $device?->deviceVariant() ?? 'og',
|
||||
'deviceVariant' => $device?->deviceModel?->css_name ?? $device?->deviceVariant() ?? 'og',
|
||||
'scaleLevel' => $device?->scaleLevel(),
|
||||
'cssVariables' => $device?->deviceModel?->css_variables,
|
||||
'mashupLayout' => $this->getMashupLayoutType(),
|
||||
'slot' => implode('', $pluginMarkups),
|
||||
])->render();
|
||||
|
|
|
|||
|
|
@ -584,10 +584,11 @@ class Plugin extends Model
|
|||
if ($size === 'full') {
|
||||
return view('trmnl-layouts.single', [
|
||||
'colorDepth' => $device?->colorDepth(),
|
||||
'deviceVariant' => $device?->deviceVariant() ?? 'og',
|
||||
'deviceVariant' => $device?->deviceModel?->css_name ?? $device?->deviceVariant() ?? 'og',
|
||||
'noBleed' => $this->no_bleed,
|
||||
'darkMode' => $this->dark_mode,
|
||||
'scaleLevel' => $device?->scaleLevel(),
|
||||
'cssVariables' => $device?->deviceModel?->css_variables,
|
||||
'slot' => $renderedContent,
|
||||
])->render();
|
||||
}
|
||||
|
|
@ -595,9 +596,10 @@ class Plugin extends Model
|
|||
return view('trmnl-layouts.mashup', [
|
||||
'mashupLayout' => $this->getPreviewMashupLayoutForSize($size),
|
||||
'colorDepth' => $device?->colorDepth(),
|
||||
'deviceVariant' => $device?->deviceVariant() ?? 'og',
|
||||
'deviceVariant' => $device?->deviceModel?->css_name ?? $device?->deviceVariant() ?? 'og',
|
||||
'darkMode' => $this->dark_mode,
|
||||
'scaleLevel' => $device?->scaleLevel(),
|
||||
'cssVariables' => $device?->deviceModel?->css_variables,
|
||||
'slot' => $renderedContent,
|
||||
])->render();
|
||||
|
||||
|
|
@ -617,10 +619,11 @@ class Plugin extends Model
|
|||
if ($size === 'full') {
|
||||
return view('trmnl-layouts.single', [
|
||||
'colorDepth' => $device?->colorDepth(),
|
||||
'deviceVariant' => $device?->deviceVariant() ?? 'og',
|
||||
'deviceVariant' => $device?->deviceModel?->css_name ?? $device?->deviceVariant() ?? 'og',
|
||||
'noBleed' => $this->no_bleed,
|
||||
'darkMode' => $this->dark_mode,
|
||||
'scaleLevel' => $device?->scaleLevel(),
|
||||
'cssVariables' => $device?->deviceModel?->css_variables,
|
||||
'slot' => $renderedView,
|
||||
])->render();
|
||||
}
|
||||
|
|
@ -628,9 +631,10 @@ class Plugin extends Model
|
|||
return view('trmnl-layouts.mashup', [
|
||||
'mashupLayout' => $this->getPreviewMashupLayoutForSize($size),
|
||||
'colorDepth' => $device?->colorDepth(),
|
||||
'deviceVariant' => $device?->deviceVariant() ?? 'og',
|
||||
'deviceVariant' => $device?->deviceModel?->css_name ?? $device?->deviceVariant() ?? 'og',
|
||||
'darkMode' => $this->dark_mode,
|
||||
'scaleLevel' => $device?->scaleLevel(),
|
||||
'cssVariables' => $device?->deviceModel?->css_variables,
|
||||
'slot' => $renderedView,
|
||||
])->render();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue