From 295b2e45bdc75a166d0a5e5fe926bd99bf2ab612 Mon Sep 17 00:00:00 2001 From: Benjamin Nussbaum Date: Mon, 10 Mar 2025 15:31:09 +0100 Subject: [PATCH] feat: select device to calculate device_id url parameter --- resources/views/flux/icon/braces.blade.php | 42 +++++++++++++++++++ .../views/livewire/plugins/api.blade.php | 22 +++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 resources/views/flux/icon/braces.blade.php diff --git a/resources/views/flux/icon/braces.blade.php b/resources/views/flux/icon/braces.blade.php new file mode 100644 index 0000000..17ff172 --- /dev/null +++ b/resources/views/flux/icon/braces.blade.php @@ -0,0 +1,42 @@ +{{-- Credit: Lucide (https://lucide.dev) --}} + +@props([ + 'variant' => 'outline', +]) + +@php +if ($variant === 'solid') { + throw new \Exception('The "solid" variant is not supported in Lucide.'); +} + +$classes = Flux::classes('shrink-0') + ->add(match($variant) { + 'outline' => '[:where(&)]:size-6', + 'solid' => '[:where(&)]:size-6', + 'mini' => '[:where(&)]:size-5', + 'micro' => '[:where(&)]:size-4', + }); + +$strokeWidth = match ($variant) { + 'outline' => 2, + 'mini' => 2.25, + 'micro' => 2.5, +}; +@endphp + +class($classes) }} + data-flux-icon + xmlns="http://www.w3.org/2000/svg" + viewBox="0 0 24 24" + fill="none" + stroke="currentColor" + stroke-width="{{ $strokeWidth }}" + stroke-linecap="round" + stroke-linejoin="round" + aria-hidden="true" + data-slot="icon" +> + + + diff --git a/resources/views/livewire/plugins/api.blade.php b/resources/views/livewire/plugins/api.blade.php index febb8a4..4384de6 100644 --- a/resources/views/livewire/plugins/api.blade.php +++ b/resources/views/livewire/plugins/api.blade.php @@ -1,9 +1,13 @@ createToken('api-token', ['update-screen']); } $this->token = $token->plainTextToken; + + $this->devices = auth()->user()->devices?->pluck('id', 'name'); + $this->selected_device = $this->devices->first(); } public function regenerateToken() @@ -29,10 +36,23 @@ new class extends Component {

API

+ +
+ @if(isset($devices)) + + @foreach($devices as $id => $name) + + {{ $id }} + + @endforeach + + @endif +
+

POST - {{route('display.update')}}?device_id= + {{ route('display.update') }}?device_id={{ $selected_device }}

Headers