chore: pint

This commit is contained in:
Benjamin Nussbaum 2026-01-15 09:01:59 +01:00
parent a15645ad88
commit d19a079b8a
30 changed files with 295 additions and 188 deletions

View file

@ -4,7 +4,7 @@
'heading' => null,
])
<?php if ($expandable && $heading): ?>
<?php if ($expandable && $heading) { ?>
<ui-disclosure
{{ $attributes->class('group/disclosure') }}
@ -30,7 +30,7 @@
</div>
</ui-disclosure>
<?php elseif ($heading): ?>
<?php } elseif ($heading) { ?>
<div {{ $attributes->class('block space-y-[2px]') }}>
<div class="px-1 py-2">
@ -42,10 +42,10 @@
</div>
</div>
<?php else: ?>
<?php } else { ?>
<div {{ $attributes->class('block space-y-[2px]') }}>
{{ $slot }}
</div>
<?php endif; ?>
<?php } ?>

View file

@ -5,7 +5,8 @@ use Illuminate\Validation\ValidationException;
use Livewire\Attributes\Layout;
use Livewire\Component;
new #[Layout('layouts.auth')] class extends Component {
new #[Layout('layouts.auth')] class extends Component
{
public string $password = '';
/**

View file

@ -4,7 +4,8 @@ use Illuminate\Support\Facades\Password;
use Livewire\Attributes\Layout;
use Livewire\Component;
new #[Layout('layouts.auth')] class extends Component {
new #[Layout('layouts.auth')] class extends Component
{
public string $email = '';
/**

View file

@ -10,7 +10,8 @@ use Livewire\Attributes\Layout;
use Livewire\Attributes\Validate;
use Livewire\Component;
new #[Layout('layouts.auth')] class extends Component {
new #[Layout('layouts.auth')] class extends Component
{
#[Validate('required|string|email')]
public string $email = '';

View file

@ -8,10 +8,14 @@ use Illuminate\Validation\Rules;
use Livewire\Attributes\Layout;
use Livewire\Component;
new #[Layout('layouts.auth')] class extends Component {
new #[Layout('layouts.auth')] class extends Component
{
public string $name = '';
public string $email = '';
public string $password = '';
public string $password_confirmation = '';
/**

View file

@ -10,11 +10,15 @@ use Livewire\Attributes\Layout;
use Livewire\Attributes\Locked;
use Livewire\Component;
new #[Layout('layouts.auth')] class extends Component {
new #[Layout('layouts.auth')] class extends Component
{
#[Locked]
public string $token = '';
public string $email = '';
public string $password = '';
public string $password_confirmation = '';
/**
@ -56,7 +60,7 @@ new #[Layout('layouts.auth')] class extends Component {
// If the password was successfully reset, we will redirect the user back to
// the application's home authenticated view. If there is an error we can
// redirect them back to where they came from with their error message.
if ($status != Password::PasswordReset) {
if ($status !== Password::PasswordReset) {
$this->addError('email', __($status));
return;

View file

@ -6,7 +6,8 @@ use Illuminate\Support\Facades\Session;
use Livewire\Attributes\Layout;
use Livewire\Component;
new #[Layout('layouts.auth')] class extends Component {
new #[Layout('layouts.auth')] class extends Component
{
/**
* Send an email verification notification to the user.
*/

View file

@ -122,7 +122,7 @@ class extends Component
public function loadMore(): void
{
$this->page++;
++$this->page;
$term = mb_trim($this->search);
if ($term === '' || mb_strlen($term) < 2) {

View file

@ -1,17 +1,23 @@
<?php
use Livewire\Component;
use Livewire\Attributes\Modelable;
use Livewire\Component;
new class extends Component
{
#[Modelable]
public $model = '';
public $language = 'html';
public $theme = 'auto';
public $readonly = false;
public $placeholder = '';
public $height = '200px';
public $id = '';
public function mount($language = 'html', $theme = 'auto', $readonly = false, $placeholder = '', $height = '200px', $id = '')
@ -24,7 +30,6 @@ new class extends Component
$this->id = $id;
}
public function toJSON()
{
return json_encode([

View file

@ -2,7 +2,8 @@
use Livewire\Component;
new class extends Component {
new class extends Component
{
public function mount()
{
return view('livewire.device-dashboard', ['devices' => auth()->user()->devices()->paginate(10)]);

View file

@ -7,33 +7,50 @@ use App\Models\Playlist;
use App\Models\PlaylistItem;
use Livewire\Component;
new class extends Component {
new class extends Component
{
public $device;
public $name;
public $api_key;
public $friendly_id;
public $mac_address;
public $default_refresh_interval;
public $width;
public $height;
public $rotate;
public $image_format;
public $device_model_id;
// Sleep mode and special function
public $sleep_mode_enabled = false;
public $sleep_mode_from;
public $sleep_mode_to;
public $special_function;
// Playlist properties
public $playlists;
public $playlist_name;
public $selected_weekdays = null;
public $active_from;
public $active_until;
public $refresh_time = null;
// Device model properties
@ -41,10 +58,12 @@ new class extends Component {
// Firmware properties
public $firmwares;
public $selected_firmware_id;
public $download_firmware;
public function mount(\App\Models\Device $device)
public function mount(App\Models\Device $device)
{
abort_unless(auth()->user()->devices->contains($device), 403);
@ -65,10 +84,11 @@ new class extends Component {
$this->deviceModels = DeviceModel::orderBy('label')->get()->sortBy(function ($deviceModel) {
// Put TRMNL models at the top, then sort alphabetically within each group
$isTrmnl = str_starts_with($deviceModel->label, 'TRMNL');
return $isTrmnl ? '0'.$deviceModel->label : '1'.$deviceModel->label;
});
$this->playlists = $device->playlists()->with('items.plugin')->orderBy('created_at')->get();
$this->firmwares = \App\Models\Firmware::orderBy('latest', 'desc')->orderBy('created_at', 'desc')->get();
$this->firmwares = Firmware::orderBy('latest', 'desc')->orderBy('created_at', 'desc')->get();
$this->selected_firmware_id = $this->firmwares->where('latest', true)->first()?->id;
$this->sleep_mode_enabled = $device->sleep_mode_enabled ?? false;
$this->sleep_mode_from = optional($device->sleep_mode_from)->format('H:i');
@ -80,7 +100,7 @@ new class extends Component {
]);
}
public function deleteDevice(\App\Models\Device $device)
public function deleteDevice(App\Models\Device $device)
{
abort_unless(auth()->user()->devices->contains($device), 403);
$device->delete();
@ -93,6 +113,7 @@ new class extends Component {
// Convert empty string to null for custom selection
if (empty($this->device_model_id)) {
$this->device_model_id = null;
return;
}
@ -292,7 +313,6 @@ new class extends Component {
'selected_firmware_id' => 'required|exists:firmware,id',
]);
if ($this->download_firmware) {
FirmwareDownloadJob::dispatchSync(Firmware::find($this->selected_firmware_id));
}

View file

@ -1,11 +1,12 @@
<?php
use App\Models\Device;
use App\Models\DeviceLog;
use Livewire\Component;
new class extends Component {
new class extends Component
{
public Device $device;
public $logs;
public function mount(Device $device)

View file

@ -4,8 +4,8 @@ use App\Models\Device;
use App\Models\DeviceModel;
use Livewire\Component;
new class extends Component {
new class extends Component
{
public $devices;
public $showDeviceForm = false;
@ -23,7 +23,9 @@ new class extends Component {
public $is_mirror = false;
public $mirror_device_id = null;
public $device_model_id = null;
public $deviceModels;
public ?int $pause_duration;
@ -42,8 +44,10 @@ new class extends Component {
$this->deviceModels = DeviceModel::orderBy('label')->get()->sortBy(function ($deviceModel) {
// Put TRMNL models at the top, then sort alphabetically within each group
$isTrmnl = str_starts_with($deviceModel->label, 'TRMNL');
return $isTrmnl ? '0'.$deviceModel->label : '1'.$deviceModel->label;
});
return view('livewire.devices.manage');
}
@ -81,7 +85,7 @@ new class extends Component {
]);
$this->reset();
\Flux::modal('create-device')->close();
Flux::modal('create-device')->close();
$this->devices = auth()->user()->devices;
session()->flash('message', 'Device created successfully.');
@ -108,7 +112,7 @@ new class extends Component {
$pauseUntil = now()->addMinutes($this->pause_duration);
$device->update(['pause_until' => $pauseUntil]);
$this->reset('pause_duration');
\Flux::modal('pause-device-' . $deviceId)->close();
Flux::modal('pause-device-'.$deviceId)->close();
$this->devices = auth()->user()->devices;
session()->flash('message', 'Device paused until '.$pauseUntil->format('H:i'));
}

View file

@ -1,24 +1,30 @@
<?php
use App\Models\Device;
use App\Models\Playlist;
use App\Models\PlaylistItem;
use Livewire\Component;
new class extends Component {
new class extends Component
{
public $devices;
public $playlists;
// Playlist form properties
public $playlist_name;
public $selected_weekdays = null;
public $active_from;
public $active_until;
public $refresh_time = null;
public function mount()
{
$this->devices = auth()->user()->devices()->with(['playlists.items.plugin'])->get();
return view('livewire.playlists.index');
}

View file

@ -1,12 +1,13 @@
<?php
use Livewire\Component;
use Illuminate\Support\Collection;
new class extends Component {
new class extends Component
{
public $token;
public $devices;
public $selected_device;
public function mount(): void

View file

@ -1,20 +1,24 @@
<?php
use App\Models\Plugin;
use Livewire\Component;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Http;
use Livewire\Component;
/*
* This component contains the configuation modal
*/
new class extends Component {
new class extends Component
{
public Plugin $plugin;
public array $configuration_template = [];
public array $configuration = []; // holds config data
public array $multiValues = []; // UI boxes for multi_string
public array $xhrSelectOptions = [];
public array $searchQueries = [];
// ------------------------------------This section contains one-off functions for the form------------------------------------------------
@ -51,10 +55,11 @@ new class extends Component {
* Triggered by @close on the modal to discard any typed but unsaved changes
*/
public int $resetIndex = 0; // Add this property
public function resetForm(): void
{
$this->loadData();
$this->resetIndex++; // Increment to force DOM refresh
++$this->resetIndex; // Increment to force DOM refresh
}
public function saveConfiguration()
@ -131,7 +136,7 @@ new class extends Component {
if ($query !== null) {
$requestData = [
'function' => $fieldKey,
'query' => $query
'query' => $query,
];
}
@ -144,7 +149,7 @@ new class extends Component {
} else {
$this->xhrSelectOptions[$fieldKey] = [];
}
} catch (\Exception $e) {
} catch (Exception $e) {
$this->xhrSelectOptions[$fieldKey] = [];
}
}

View file

@ -3,14 +3,22 @@
use App\Models\Plugin;
use Livewire\Component;
new class extends Component {
new class extends Component
{
public Plugin $plugin;
public string $name;
public array $checked_devices = [];
public array $device_playlists = [];
public array $device_playlist_names = [];
public array $device_weekdays = [];
public array $device_active_from = [];
public array $device_active_until = [];
public function mount(): void
@ -38,7 +46,6 @@ new class extends Component {
$this->plugin->update(['name' => $this->name]);
}
public function addToPlaylist()
{
$this->validate([
@ -48,12 +55,14 @@ new class extends Component {
foreach ($this->checked_devices as $deviceId) {
if (! isset($this->device_playlists[$deviceId]) || empty($this->device_playlists[$deviceId])) {
$this->addError('device_playlists.'.$deviceId, 'Please select a playlist for each device.');
return;
}
if ($this->device_playlists[$deviceId] === 'new') {
if (! isset($this->device_playlist_names[$deviceId]) || empty($this->device_playlist_names[$deviceId])) {
$this->addError('device_playlist_names.'.$deviceId, 'Playlist name is required when creating a new playlist.');
return;
}
}
@ -63,7 +72,7 @@ new class extends Component {
$playlist = null;
if ($this->device_playlists[$deviceId] === 'new') {
$playlist = \App\Models\Playlist::create([
$playlist = App\Models\Playlist::create([
'device_id' => $deviceId,
'name' => $this->device_playlist_names[$deviceId],
'weekdays' => ! empty($this->device_weekdays[$deviceId] ?? null) ? $this->device_weekdays[$deviceId] : null,
@ -71,7 +80,7 @@ new class extends Component {
'active_until' => $this->device_active_until[$deviceId] ?? null,
]);
} else {
$playlist = \App\Models\Playlist::findOrFail($this->device_playlists[$deviceId]);
$playlist = App\Models\Playlist::findOrFail($this->device_playlists[$deviceId]);
}
$maxOrder = $playlist->items()->max('order') ?? 0;
@ -96,7 +105,7 @@ new class extends Component {
public function getDevicePlaylists($deviceId)
{
return \App\Models\Playlist::where('device_id', $deviceId)->get();
return App\Models\Playlist::where('device_id', $deviceId)->get();
}
public function hasAnyPlaylistSelected(): bool
@ -106,6 +115,7 @@ new class extends Component {
return true;
}
}
return false;
}
@ -125,7 +135,7 @@ new class extends Component {
$extensions = ['png', 'bmp'];
foreach ($extensions as $ext) {
$path = 'images/generated/'.$this->plugin->current_image.'.'.$ext;
if (\Illuminate\Support\Facades\Storage::disk('public')->exists($path)) {
if (Illuminate\Support\Facades\Storage::disk('public')->exists($path)) {
return $path;
}
}

View file

@ -1,11 +1,13 @@
<?php
use App\Models\Plugin;
use Livewire\Component;
use Illuminate\Support\Str;
use Livewire\Component;
new class extends Component {
new class extends Component
{
public string $name = '';
public array $instances = [];
protected $rules = [

View file

@ -2,32 +2,38 @@
use App\Console\Commands\ExampleRecipesSeederCommand;
use App\Services\PluginImportService;
use Illuminate\Support\Str;
use Livewire\Component;
use Livewire\WithFileUploads;
use Illuminate\Support\Str;
new class extends Component {
new class extends Component
{
use WithFileUploads;
public string $name;
public int $data_stale_minutes = 60;
public string $data_strategy = "polling";
public string $data_strategy = 'polling';
public string $polling_url;
public string $polling_verb = "get";
public string $polling_verb = 'get';
public $polling_header;
public $polling_body;
public array $plugins;
public $zipFile;
public string $sortBy = 'date_asc';
public array $native_plugins = [
'markup' =>
['name' => 'Markup', 'flux_icon_name' => 'code-bracket', 'detail_view_route' => 'plugins.markup'],
'api' =>
['name' => 'API', 'flux_icon_name' => 'braces', 'detail_view_route' => 'plugins.api'],
'image-webhook' =>
['name' => 'Image Webhook', 'flux_icon_name' => 'photo', 'detail_view_route' => 'plugins.image-webhook'],
'markup' => ['name' => 'Markup', 'flux_icon_name' => 'code-bracket', 'detail_view_route' => 'plugins.markup'],
'api' => ['name' => 'API', 'flux_icon_name' => 'braces', 'detail_view_route' => 'plugins.api'],
'image-webhook' => ['name' => 'Image Webhook', 'flux_icon_name' => 'photo', 'detail_view_route' => 'plugins.image-webhook'],
];
protected $rules = [
@ -75,6 +81,7 @@ new class extends Component {
usort($pluginsToSort, function ($a, $b) {
$aDate = $a['created_at'] ?? '1970-01-01';
$bDate = $b['created_at'] ?? '1970-01-01';
return strcmp($bDate, $aDate);
});
break;
@ -83,6 +90,7 @@ new class extends Component {
usort($pluginsToSort, function ($a, $b) {
$aDate = $a['created_at'] ?? '1970-01-01';
$bDate = $b['created_at'] ?? '1970-01-01';
return strcmp($aDate, $bDate);
});
break;
@ -113,7 +121,7 @@ new class extends Component {
abort_unless(auth()->user() !== null, 403);
$this->validate();
\App\Models\Plugin::create([
App\Models\Plugin::create([
'uuid' => Str::uuid(),
'user_id' => auth()->id(),
'name' => $this->name,
@ -137,7 +145,6 @@ new class extends Component {
$this->refreshPlugins();
}
public function importZip(PluginImportService $pluginImportService): void
{
abort_unless(auth()->user() !== null, 403);
@ -153,11 +160,10 @@ new class extends Component {
$this->reset(['zipFile']);
Flux::modal('import-zip')->close();
} catch (\Exception $e) {
} catch (Exception $e) {
$this->addError('zipFile', 'Error installing plugin: '.$e->getMessage());
}
}
};
?>

View file

@ -4,12 +4,14 @@ use App\Jobs\GenerateScreenJob;
use Illuminate\Support\Collection;
use Livewire\Component;
new class extends Component {
new class extends Component
{
public string $blade_code = '';
public bool $isLoading = false;
public Collection $devices;
public array $checked_devices;
public function mount()
@ -17,14 +19,13 @@ new class extends Component {
$this->devices = auth()->user()->devices->pluck('id', 'name');
}
public function submit()
{
$this->isLoading = true;
$this->validate([
'checked_devices' => 'required|array',
'blade_code' => 'required|string'
'blade_code' => 'required|string',
]);
// only devices that are owned by the user
@ -35,7 +36,7 @@ new class extends Component {
foreach ($this->checked_devices as $device) {
GenerateScreenJob::dispatchSync($device, null, $rendered);
}
} catch (\Exception $e) {
} catch (Exception $e) {
$this->addError('generate_screen', $e->getMessage());
}
@ -66,7 +67,7 @@ new class extends Component {
public function renderHelloWorld(): string
{
return <<<HTML
return <<<'HTML'
<x-trmnl::screen>
<x-trmnl::view>
<x-trmnl::layout>
@ -84,7 +85,7 @@ HTML;
public function renderQuote(): string
{
return <<<HTML
return <<<'HTML'
<x-trmnl::screen>
<x-trmnl::view>
<x-trmnl::layout>
@ -102,7 +103,7 @@ HTML;
public function renderTrainMonitor()
{
return <<<HTML
return <<<'HTML'
<x-trmnl::screen>
<x-trmnl::view>
<x-trmnl::layout>
@ -136,7 +137,7 @@ HTML;
public function renderHomeAssistant()
{
return <<<HTML
return <<<'HTML'
<x-trmnl::screen>
<x-trmnl::view>
<x-trmnl::layout class="layout--col gap--space-between">
@ -162,8 +163,6 @@ HTML;
HTML;
}
};
?>

View file

@ -1,44 +1,68 @@
<?php
use App\Models\Device;
use App\Models\Plugin;
use App\Models\DeviceModel;
use Illuminate\Support\Carbon;
use Keepsuit\Liquid\Exceptions\LiquidException;
use Livewire\Component;
use Illuminate\Support\Facades\Blade;
use App\Models\Plugin;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Http;
use Livewire\Attributes\On;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Blade;
use Keepsuit\Liquid\Exceptions\LiquidException;
use Livewire\Attributes\Computed;
use Livewire\Attributes\On;
use Livewire\Component;
new class extends Component {
new class extends Component
{
public Plugin $plugin;
public string|null $markup_code;
public string|null $view_content;
public string|null $markup_language;
public ?string $markup_code;
public ?string $view_content;
public ?string $markup_language;
public string $name;
public bool $no_bleed = false;
public bool $dark_mode = false;
public int $data_stale_minutes;
public string $data_strategy;
public string|null $polling_url;
public ?string $polling_url;
public string $polling_verb;
public string|null $polling_header;
public string|null $polling_body;
public ?string $polling_header;
public ?string $polling_body;
public $data_payload;
public ?Carbon $data_payload_updated_at;
public array $checked_devices = [];
public array $device_playlists = [];
public array $device_playlist_names = [];
public array $device_weekdays = [];
public array $device_active_from = [];
public array $device_active_until = [];
public string $mashup_layout = 'full';
public array $mashup_plugins = [];
public array $configuration_template = [];
public ?int $preview_device_model_id = null;
public string $preview_size = 'full';
public function mount(): void
@ -63,7 +87,7 @@ new class extends Component {
break;
}
}
} catch (\Exception $e) {
} catch (Exception $e) {
$this->view_content = null;
}
} else {
@ -103,7 +127,7 @@ new class extends Component {
$this->validate();
$this->plugin->update([
'render_markup' => $this->markup_code ?? null,
'markup_language' => $this->markup_language ?? null
'markup_language' => $this->markup_language ?? null,
]);
}
@ -162,7 +186,7 @@ new class extends Component {
if (! filter_var($resolvedUrl, FILTER_VALIDATE_URL)) {
$this->addError('polling_url', 'The polling URL must be a valid URL after resolving configuration variables.');
}
} catch (\Exception $e) {
} catch (Exception $e) {
$this->addError('polling_url', 'Error resolving Liquid variables: '.$e->getMessage().$e->getPrevious()?->getMessage());
}
}
@ -177,7 +201,7 @@ new class extends Component {
$this->data_payload = json_encode($this->plugin->data_payload, JSON_PRETTY_PRINT);
$this->data_payload_updated_at = $this->plugin->data_payload_updated_at;
} catch (\Exception $e) {
} catch (Exception $e) {
$this->dispatch('data-update-error', message: $e->getMessage().$e->getPrevious()?->getMessage());
}
}
@ -214,6 +238,7 @@ new class extends Component {
foreach ($this->checked_devices as $deviceId) {
if (! isset($this->device_playlists[$deviceId]) || empty($this->device_playlists[$deviceId])) {
$this->addError('device_playlists.'.$deviceId, 'Please select a playlist for each device.');
return;
}
@ -221,6 +246,7 @@ new class extends Component {
if ($this->device_playlists[$deviceId] === 'new') {
if (! isset($this->device_playlist_names[$deviceId]) || empty($this->device_playlist_names[$deviceId])) {
$this->addError('device_playlist_names.'.$deviceId, 'Playlist name is required when creating a new playlist.');
return;
}
}
@ -231,7 +257,7 @@ new class extends Component {
if ($this->device_playlists[$deviceId] === 'new') {
// Create new playlist
$playlist = \App\Models\Playlist::create([
$playlist = App\Models\Playlist::create([
'device_id' => $deviceId,
'name' => $this->device_playlist_names[$deviceId],
'weekdays' => ! empty($this->device_weekdays[$deviceId] ?? null) ? $this->device_weekdays[$deviceId] : null,
@ -239,7 +265,7 @@ new class extends Component {
'active_until' => $this->device_active_until[$deviceId] ?? null,
]);
} else {
$playlist = \App\Models\Playlist::findOrFail($this->device_playlists[$deviceId]);
$playlist = App\Models\Playlist::findOrFail($this->device_playlists[$deviceId]);
}
// Add plugin to playlist
@ -253,7 +279,7 @@ new class extends Component {
} else {
// Create mashup
$pluginIds = array_merge([$this->plugin->id], array_map('intval', $this->mashup_plugins));
\App\Models\PlaylistItem::createMashup(
App\Models\PlaylistItem::createMashup(
$playlist,
$this->mashup_layout,
$pluginIds,
@ -271,14 +297,14 @@ new class extends Component {
'device_active_from',
'device_active_until',
'mashup_layout',
'mashup_plugins'
'mashup_plugins',
]);
Flux::modal('add-to-playlist')->close();
}
public function getDevicePlaylists($deviceId)
{
return \App\Models\Playlist::where('device_id', $deviceId)->get();
return App\Models\Playlist::where('device_id', $deviceId)->get();
}
public function hasAnyPlaylistSelected(): bool
@ -288,6 +314,7 @@ new class extends Component {
return true;
}
}
return false;
}
@ -315,7 +342,7 @@ new class extends Component {
public function renderLayoutWithTitleBar(): string
{
if ($this->markup_language === 'liquid') {
return <<<HTML
return <<<'HTML'
<div class="view view--{{ size }}">
<div class="layout">
<!-- ADD YOUR CONTENT HERE-->
@ -327,9 +354,9 @@ new class extends Component {
HTML;
}
return <<<HTML
return <<<'HTML'
@props(['size' => 'full'])
<x-trmnl::view size="{{\$size}}">
<x-trmnl::view size="{{$size}}">
<x-trmnl::layout>
<!-- ADD YOUR CONTENT HERE-->
</x-trmnl::layout>
@ -341,7 +368,7 @@ HTML;
public function renderLayoutBlank(): string
{
if ($this->markup_language === 'liquid') {
return <<<HTML
return <<<'HTML'
<div class="view view--{{ size }}">
<div class="layout">
<!-- ADD YOUR CONTENT HERE-->
@ -350,9 +377,9 @@ HTML;
HTML;
}
return <<<HTML
return <<<'HTML'
@props(['size' => 'full'])
<x-trmnl::view size="{{\$size}}">
<x-trmnl::view size="{{$size}}">
<x-trmnl::layout>
<!-- ADD YOUR CONTENT HERE-->
</x-trmnl::layout>
@ -378,12 +405,12 @@ HTML;
$this->dispatch('preview-updated', preview: $previewMarkup);
} catch (LiquidException $e) {
$this->dispatch('preview-error', message: $e->toLiquidErrorMessage());
} catch (\Exception $e) {
} catch (Exception $e) {
$this->dispatch('preview-error', message: $e->getMessage());
}
}
private function createPreviewDevice(): \App\Models\Device
private function createPreviewDevice(): Device
{
$deviceModel = DeviceModel::with(['palette'])->find($this->preview_device_model_id)
?? DeviceModel::with(['palette'])->first();
@ -441,11 +468,10 @@ HTML;
try {
return $this->plugin->resolveLiquidVariables($this->polling_url);
} catch (\Exception $e) {
} catch (Exception $e) {
return 'PARSE_ERROR: '.$e->getMessage();
}
}
}
?>

View file

@ -7,10 +7,14 @@ use Livewire\Component;
/*
* This component contains the TRMNL Plugin Settings modal
*/
new class extends Component {
new class extends Component
{
public Plugin $plugin;
public string|null $trmnlp_id = null;
public string|null $uuid = null;
public ?string $trmnlp_id = null;
public ?string $uuid = null;
public bool $alias = false;
public int $resetIndex = 0;

View file

@ -2,7 +2,8 @@
use Livewire\Component;
new class extends Component {
new class extends Component
{
//
}; ?>

View file

@ -4,7 +4,8 @@ use App\Livewire\Actions\Logout;
use Illuminate\Support\Facades\Auth;
use Livewire\Component;
new class extends Component {
new class extends Component
{
public string $password = '';
/**

View file

@ -6,9 +6,12 @@ use Illuminate\Validation\Rules\Password;
use Illuminate\Validation\ValidationException;
use Livewire\Component;
new class extends Component {
new class extends Component
{
public string $current_password = '';
public string $password = '';
public string $password_confirmation = '';
/**

View file

@ -1,14 +1,11 @@
<?php
use App\Models\User;
use App\Models\Device;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
use Illuminate\Validation\Rule;
use Livewire\Component;
new class extends Component {
new class extends Component
{
public ?int $assign_new_device_id = null;
public ?string $timezone = null;

View file

@ -6,8 +6,10 @@ use Illuminate\Support\Facades\Session;
use Illuminate\Validation\Rule;
use Livewire\Component;
new class extends Component {
new class extends Component
{
public string $name = '';
public string $email = '';
/**
@ -35,7 +37,7 @@ new class extends Component {
'lowercase',
'email',
'max:255',
Rule::unique(User::class)->ignore($user->id)
Rule::unique(User::class)->ignore($user->id),
],
]);

View file

@ -1,5 +1,6 @@
<?php
use Livewire\Component;
new class extends Component {}
?>

View file

@ -22,9 +22,9 @@ test('config modal correctly loads multi_string defaults into UI boxes', functio
'field_type' => 'multi_string',
'name' => 'Reading Days',
'default' => 'alpha,beta',
]]
]],
],
'configuration' => ['tags' => 'alpha,beta']
'configuration' => ['tags' => 'alpha,beta'],
]);
Livewire::test('plugins.config-modal', ['plugin' => $plugin])
@ -45,8 +45,8 @@ test('config modal validates against commas in multi_string boxes', function ():
'keyname' => 'tags',
'field_type' => 'multi_string',
'name' => 'Reading Days',
]]
]
]],
],
]);
Livewire::test('plugins.config-modal', ['plugin' => $plugin])
@ -72,9 +72,9 @@ test('config modal merges multi_string boxes into a single CSV string on save',
'keyname' => 'items',
'field_type' => 'multi_string',
'name' => 'Reading Days',
]]
]],
],
'configuration' => []
'configuration' => [],
]);
Livewire::test('plugins.config-modal', ['plugin' => $plugin])
@ -96,7 +96,7 @@ test('config modal resetForm clears dirty state and increments resetIndex', func
'user_id' => $user->id,
'name' => 'Test Plugin',
'data_strategy' => 'static',
'configuration' => ['simple_key' => 'original_value']
'configuration' => ['simple_key' => 'original_value'],
]);
Livewire::test('plugins.config-modal', ['plugin' => $plugin])
@ -114,7 +114,7 @@ test('config modal dispatches update event for parent warning refresh', function
'uuid' => Str::uuid(),
'user_id' => $user->id,
'name' => 'Test Plugin',
'data_strategy' => 'static'
'data_strategy' => 'static',
]);
Livewire::test('plugins.config-modal', ['plugin' => $plugin])