From 9746756a4469faa2d1b4a4de177065d292d016c2 Mon Sep 17 00:00:00 2001 From: Javier Feliz Date: Sun, 27 Jul 2025 16:57:02 -0400 Subject: [PATCH] App icons and editing --- .github/workflows/build.yml | 4 +- app/Livewire/AppContainer.php | 58 ++++++ app/Livewire/AppInfoModal.php | 57 ++++++ app/Models/Application.php | 5 + .../2025_07_27_194829_add_icons_to_apps.php | 28 +++ public/img/authentikate-logo-2.svg | 1 + public/img/logo.svg | 54 ++++++ .../views/components/app-logo-icon.blade.php | 38 +++- resources/views/components/app-logo.blade.php | 9 +- .../components/layouts/app/header.blade.php | 180 ++++++++---------- resources/views/dashboard.blade.php | 13 +- .../views/livewire/app-container.blade.php | 34 ++++ .../views/livewire/app-info-modal.blade.php | 39 ++++ .../livewire/forms/new-application.blade.php | 16 +- 14 files changed, 403 insertions(+), 133 deletions(-) create mode 100644 app/Livewire/AppContainer.php create mode 100644 app/Livewire/AppInfoModal.php create mode 100644 database/migrations/2025_07_27_194829_add_icons_to_apps.php create mode 100644 public/img/authentikate-logo-2.svg create mode 100644 public/img/logo.svg create mode 100644 resources/views/livewire/app-container.blade.php create mode 100644 resources/views/livewire/app-info-modal.blade.php diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7e7a755..4844ff3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,5 +48,5 @@ jobs: file: ${{ github.workspace }}/Dockerfile push: true tags: | - gitgud.foo/thegrind/flowtodo:latest - gitgud.foo/thegrind/flowtodo:${{ github.event.release.tag_name }} \ No newline at end of file + gitgud.foo/thegrind/authentikate:latest + gitgud.foo/thegrind/authentikate:${{ github.event.release.tag_name }} \ No newline at end of file diff --git a/app/Livewire/AppContainer.php b/app/Livewire/AppContainer.php new file mode 100644 index 0000000..b857dc7 --- /dev/null +++ b/app/Livewire/AppContainer.php @@ -0,0 +1,58 @@ +loadApps(); + } + + public function loadApps() + { + $this->apps = Application::orderBy('id')->get(); + } + + #[On('app-updated')] + public function handleAppUpdated($id) + { + $new = Application::find($id); + $this->apps = $this->apps->map(fn($app) => $app->id == $id ? $new : $app); + } + + public function confirmDelete($id) + { + $this->confirmDeleteApp = $this->apps->where('id', $id)->first(); + Flux::modal('delete-app-confirm')->show(); + } + + public function deleteApp() + { + $this->confirmDeleteApp->delete(); + $deletedId = $this->confirmDeleteApp->id; + $this->confirmDeleteApp = null; + $this->apps = $this->apps->filter(fn($app) => $app->id != $deletedId); + Flux::modal('delete-app-confirm')->close(); + } + + public function cancelDelete() + { + $this->confirmDeleteApp = null; + Flux::modal('delete-app-confirm')->close(); + } + + public function render() + { + return view('livewire.app-container'); + } +} diff --git a/app/Livewire/AppInfoModal.php b/app/Livewire/AppInfoModal.php new file mode 100644 index 0000000..c36795e --- /dev/null +++ b/app/Livewire/AppInfoModal.php @@ -0,0 +1,57 @@ +loadApp(4); + } + + public function updated($prop) + { + if ($prop == "query") { + if (empty($this->query)) { + return null; + } + $s = str($this->query)->kebab()->toString(); + $icon = "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/{$s}.webp"; + $this->icon = $icon; + } + } + + #[On('appinfo')] + public function loadApp($id) + { + $this->app = Application::find($id); + $this->name = $this->app->name; + $this->icon = $this->app->getIconUrl(); + } + + public function save() + { + $this->app->update([ + 'name' => $this->name, + 'icon' => $this->icon, + ]); + + $this->dispatch('app-updated', ['id' => $this->app->id]); + } + + public function render() + { + return view('livewire.app-info-modal'); + } +} diff --git a/app/Models/Application.php b/app/Models/Application.php index 44d058f..6673f38 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -7,4 +7,9 @@ use Illuminate\Database\Eloquent\Model; class Application extends Model { protected $guarded = ['id']; + + public function getIconUrl() + { + return $this->icon; + } } diff --git a/database/migrations/2025_07_27_194829_add_icons_to_apps.php b/database/migrations/2025_07_27_194829_add_icons_to_apps.php new file mode 100644 index 0000000..e3ee215 --- /dev/null +++ b/database/migrations/2025_07_27_194829_add_icons_to_apps.php @@ -0,0 +1,28 @@ +string('icon')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('applications', function (Blueprint $table) { + $table->dropColumn('icon'); + }); + } +}; diff --git a/public/img/authentikate-logo-2.svg b/public/img/authentikate-logo-2.svg new file mode 100644 index 0000000..204f47b --- /dev/null +++ b/public/img/authentikate-logo-2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/logo.svg b/public/img/logo.svg new file mode 100644 index 0000000..9d8339e --- /dev/null +++ b/public/img/logo.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/resources/views/components/app-logo-icon.blade.php b/resources/views/components/app-logo-icon.blade.php index 0adc3a2..8ed1108 100644 --- a/resources/views/components/app-logo-icon.blade.php +++ b/resources/views/components/app-logo-icon.blade.php @@ -1,8 +1,30 @@ - - - +{{-- +fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" {{ $attributes }} +--}} + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/views/components/app-logo.blade.php b/resources/views/components/app-logo.blade.php index 2ccc081..66aa2d9 100644 --- a/resources/views/components/app-logo.blade.php +++ b/resources/views/components/app-logo.blade.php @@ -1,6 +1,7 @@ -
- +
+
- Laravel Starter Kit -
+ {{ config('app.name') }} +
\ No newline at end of file diff --git a/resources/views/components/layouts/app/header.blade.php b/resources/views/components/layouts/app/header.blade.php index f017f67..4150d82 100644 --- a/resources/views/components/layouts/app/header.blade.php +++ b/resources/views/components/layouts/app/header.blade.php @@ -1,124 +1,102 @@ - - @include('partials.head') - - - - - - - + + @include('partials.head') + - - - {{ __('Dashboard') }} - - + + + - + + + - - - - - - - - - - - + + + {{ __('Apps') }} + + - - - + - - -
-
- - - {{ auth()->user()->initials() }} - + + + + + + + + + + + + + + +
+
+ + + {{ auth()->user()->initials() }} + -
- {{ auth()->user()->name }} - {{ auth()->user()->email }} -
+
+ {{ auth()->user()->name }} + {{ auth()->user()->email }}
- +
+
- + - - {{ __('Settings') }} - + + {{ __('Settings') }} + + - + -
- @csrf - - {{ __('Log Out') }} - -
-
-
- +
+ @csrf + + {{ __('Log Out') }} + +
+ + + - - - + + + - - - + + + - - - - {{ __('Dashboard') }} - - - - - - - - - {{ __('Repository') }} + + + + {{ __('Dashboard') }} + + - - {{ __('Documentation') }} - - - + + - {{ $slot }} + {{ $slot }} - @fluxScripts - - + @fluxScripts + + + \ No newline at end of file diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 11cc17f..b514e53 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -1,14 +1,5 @@ -
- -
- @foreach (App\Models\Application::all() as $app) -
- {{ $app->name}} - Client ID: {{ $app->client_id }} - Secret: {{ $app->client_secret }} -
- @endforeach -
+
+
\ No newline at end of file diff --git a/resources/views/livewire/app-container.blade.php b/resources/views/livewire/app-container.blade.php new file mode 100644 index 0000000..a5b35d5 --- /dev/null +++ b/resources/views/livewire/app-container.blade.php @@ -0,0 +1,34 @@ +
+
+ + New App + +
+
+ @foreach ($apps as $app) +
+
+ + + + +
+ + {{ $app->name}} +
+ @endforeach +
+ + @if ($confirmDeleteApp) + Delete {{$confirmDeleteApp->name}}? +
+ Delete + Cancel +
+ @endif +
+ + +
\ No newline at end of file diff --git a/resources/views/livewire/app-info-modal.blade.php b/resources/views/livewire/app-info-modal.blade.php new file mode 100644 index 0000000..fd0b4aa --- /dev/null +++ b/resources/views/livewire/app-info-modal.blade.php @@ -0,0 +1,39 @@ + + @if (empty($app)) + I'm not sure how you got here, but no app is loaded + @else +
+
+
+ + {{$app->name}} +
+
+ Edit +
+
+
+ + +
+ +
+ Save + + Cancel + +
+ +
+ + + + + + + + +
+ @endif +
\ No newline at end of file diff --git a/resources/views/livewire/forms/new-application.blade.php b/resources/views/livewire/forms/new-application.blade.php index e44a923..0492739 100644 --- a/resources/views/livewire/forms/new-application.blade.php +++ b/resources/views/livewire/forms/new-application.blade.php @@ -1,7 +1,9 @@ -
- Add an app - - - - Create - \ No newline at end of file + +
+ Add an app + + + + Create + +
\ No newline at end of file