Migrate to HTMX (#114)

Dropped Livewire
Added HTMX
Added Blade code lint
Drop Mysql and Redis
Migrate to SQLite
This commit is contained in:
Saeed Vaziry
2024-03-06 17:02:59 +01:00
committed by GitHub
parent 5b2c419e91
commit b2083fc6b2
486 changed files with 8609 additions and 8707 deletions

View File

@ -0,0 +1,5 @@
<x-profile-layout>
<x-slot name="pageTitle">{{ __("Notification Channels") }}</x-slot>
@include("settings.notification-channels.partials.channels-list")
</x-profile-layout>

View File

@ -0,0 +1,114 @@
<div>
<x-primary-button x-data="" x-on:click.prevent="$dispatch('open-modal', 'add-channel')">
{{ __("Add new Channel") }}
</x-primary-button>
<x-modal name="add-channel">
@php
$oldProvider = old("provider", request()->input("provider") ?? "");
@endphp
<form
id="add-channel-form"
hx-post="{{ route("notification-channels.add") }}"
hx-swap="outerHTML"
hx-select="#add-channel-form"
hx-ext="disable-element"
hx-disable-element="#btn-add-channel"
class="p-6"
x-data="{ provider: '{{ $oldProvider }}' }"
>
@csrf
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
{{ __("Add new Channel") }}
</h2>
<div class="mt-6">
<x-input-label for="provider" value="Provider" />
<x-select-input x-model="provider" id="provider" name="provider" class="mt-1 w-full">
<option value="" selected disabled>
{{ __("Select") }}
</option>
@foreach (config("core.notification_channels_providers") as $p)
@if ($p !== "custom")
<option value="{{ $p }}" @if ($oldProvider === $p) selected @endif>
{{ $p }}
</option>
@endif
@endforeach
</x-select-input>
@error("provider")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="label" :value="__('Label')" />
<x-text-input value="{{ old('label') }}" id="label" name="label" type="text" class="mt-1 w-full" />
@error("label")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div x-show="provider === 'email'" class="mt-6">
<x-input-label for="email" :value="__('Email')" />
<x-text-input value="{{ old('email') }}" id="email" name="email" type="text" class="mt-1 w-full" />
@error("email")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div x-show="['slack', 'discord'].includes(provider)" class="mt-6">
<x-input-label for="webhook_url" :value="__('Webhook URL')" />
<x-text-input
value="{{ old('webhook_url') }}"
id="webhook_url"
name="webhook_url"
type="text"
class="mt-1 w-full"
/>
@error("webhook_url")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div x-show="provider === 'telegram'" class="mt-6">
<x-input-label for="bot_token" :value="__('Bot Token')" />
<x-text-input
value="{{ old('bot_token') }}"
id="bot_token"
name="bot_token"
type="text"
class="mt-1 w-full"
/>
@error("bot_token")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div x-show="provider === 'telegram'" class="mt-6">
<x-input-label for="chat_id" :value="__('Chat ID')" />
<x-text-input
value="{{ old('chat_id') }}"
id="chat_id"
name="chat_id"
type="text"
class="mt-1 w-full"
/>
@error("chat_id")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6 flex justify-end">
<x-secondary-button type="button" x-on:click="$dispatch('close')">
{{ __("Cancel") }}
</x-secondary-button>
<x-primary-button id="btn-add-channel" class="ml-3">
{{ __("Add") }}
</x-primary-button>
</div>
</form>
</x-modal>
</div>

View File

@ -0,0 +1,45 @@
<div>
<x-card-header>
<x-slot name="title">{{ __("Notification Channels") }}</x-slot>
<x-slot name="description">
{{ __("Add or modify your notification channels") }}
</x-slot>
<x-slot name="aside">
@include("settings.notification-channels.partials.add-channel")
</x-slot>
</x-card-header>
<div x-data="{ deleteAction: '' }" class="space-y-3">
@if (count($channels) > 0)
@foreach ($channels as $channel)
<x-item-card>
<div class="flex-none text-gray-600 dark:text-gray-300">
@include("settings.notification-channels.partials.icons." . $channel->provider)
</div>
<div class="ml-3 flex flex-grow flex-col items-start justify-center">
<span class="mb-1">{{ $channel->label }}</span>
<span class="text-sm text-gray-400">
<x-datetime :value="$channel->created_at" />
</span>
</div>
<div class="flex items-center">
<div class="inline">
<x-icon-button
x-on:click="deleteAction = '{{ route('notification-channels.delete', $channel->id) }}'; $dispatch('open-modal', 'delete-channel')"
>
<x-heroicon-o-trash class="h-5 w-5" />
</x-icon-button>
</div>
</div>
</x-item-card>
@endforeach
@include("settings.notification-channels.partials.delete-channel")
@else
<x-simple-card>
<div class="text-center">
{{ __("You haven't connected to any channels yet!") }}
</div>
</x-simple-card>
@endif
</div>
</div>

View File

@ -0,0 +1,18 @@
<x-modal name="delete-channel" :show="$errors->isNotEmpty()">
<form id="delete-channel-form" method="post" x-bind:action="deleteAction" class="p-6">
@csrf
@method("delete")
<h2 class="text-lg font-medium">Are you sure that you want to delete this channel?</h2>
<div class="mt-6 flex justify-end">
<x-secondary-button type="button" x-on:click="$dispatch('close')">
{{ __("Cancel") }}
</x-secondary-button>
<x-danger-button class="ml-3">
{{ __("Delete") }}
</x-danger-button>
</div>
</form>
</x-modal>

View File

@ -0,0 +1 @@
<x-bi-discord class="h-10 w-10" />

View File

@ -0,0 +1 @@
<x-bi-envelope class="h-10 w-10" />

View File

@ -0,0 +1 @@
<x-bi-slack class="h-10 w-10" />

View File

@ -0,0 +1 @@
<x-bi-telegram class="h-10 w-10" />