ui: make notifications separate view
fix: popup if no notifications are set
This commit is contained in:
parent
bbfbd4a105
commit
129a644781
@ -17,10 +17,14 @@ public function testEvent()
|
||||
{
|
||||
$this->dispatch('success', 'Realtime events configured!');
|
||||
}
|
||||
public function disable()
|
||||
public function disableSponsorship()
|
||||
{
|
||||
auth()->user()->update(['is_notification_sponsorship_enabled' => false]);
|
||||
}
|
||||
public function disableNotifications()
|
||||
{
|
||||
auth()->user()->update(['is_notification_notifications_enabled' => false]);
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.layout-popups');
|
||||
|
@ -48,13 +48,15 @@ public function getRecepients($notification)
|
||||
}
|
||||
return explode(',', $recipients);
|
||||
}
|
||||
static public function serverLimitReached() {
|
||||
static public function serverLimitReached()
|
||||
{
|
||||
$serverLimit = Team::serverLimit();
|
||||
$team = currentTeam();
|
||||
$servers = $team->servers->count();
|
||||
return $servers >= $serverLimit;
|
||||
}
|
||||
public function serverOverflow() {
|
||||
public function serverOverflow()
|
||||
{
|
||||
if ($this->serverLimit() < $this->servers->count()) {
|
||||
return true;
|
||||
}
|
||||
@ -170,4 +172,17 @@ public function trialEndedButSubscribed()
|
||||
]);
|
||||
}
|
||||
}
|
||||
public function isAnyNotificationEnabled()
|
||||
{
|
||||
if (isCloud()) {
|
||||
return true;
|
||||
}
|
||||
if (!data_get(auth()->user(), 'is_notification_notifications_enabled')) {
|
||||
return true;
|
||||
}
|
||||
if ($this->smtp_enabled || $this->resend_enabled || $this->discord_enabled || $this->telegram_enabled || $this->use_instance_email_settings) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->boolean('is_notification_notifications_enabled')->default(true);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('is_notification_notifications_enabled');
|
||||
});
|
||||
}
|
||||
};
|
@ -150,7 +150,17 @@ class="{{ request()->is('subscription*') ? 'text-warning icon' : 'icon' }}"
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
<li title="Notifications" class="hover:bg-coolgray-200">
|
||||
<a class="hover:bg-transparent hover:no-underline" href="{{ route('notification.index') }}">
|
||||
<svg class="{{ request()->is('notifications*') ? 'text-warning icon' : 'icon' }}"
|
||||
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path fill="none" stroke="currentColor" stroke-linecap="round"
|
||||
stroke-linejoin="round" stroke-width="2"
|
||||
d="M10 5a2 2 0 1 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3H4a4 4 0 0 0 2-3v-3a7 7 0 0 1 4-6M9 17v1a3 3 0 0 0 6 0v-1" />
|
||||
</svg>
|
||||
Notifications
|
||||
</a>
|
||||
</li>
|
||||
@if (isInstanceAdmin())
|
||||
<li title="Settings" class="hover:bg-coolgray-200">
|
||||
<a class="hover:bg-transparent hover:no-underline" href="/settings">
|
||||
|
25
resources/views/components/notifications/navbar.blade.php
Normal file
25
resources/views/components/notifications/navbar.blade.php
Normal file
@ -0,0 +1,25 @@
|
||||
<div class="pb-6">
|
||||
<div class="flex items-end gap-2">
|
||||
<h1>Team Notifications</h1>
|
||||
</div>
|
||||
<nav class="flex pt-2 pb-10">
|
||||
<ol class="inline-flex items-center">
|
||||
<li>
|
||||
<div class="flex items-center">
|
||||
<span>Currently active team: <span
|
||||
class="text-warning">{{ session('currentTeam.name') }}</span></span>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<nav class="navbar-main">
|
||||
<a class="{{ request()->routeIs('notification.index') ? 'text-white' : '' }}"
|
||||
href="{{ route('notification.index') }}">
|
||||
<button>General</button>
|
||||
</a>
|
||||
<div class="flex-1"></div>
|
||||
<div class="-mt-9">
|
||||
<livewire:switch-team />
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
@ -17,17 +17,14 @@ class="text-warning">{{ session('currentTeam.name') }}</span></span>
|
||||
<a class="{{ request()->routeIs('team.index') ? 'text-white' : '' }}" href="{{ route('team.index') }}">
|
||||
<button>General</button>
|
||||
</a>
|
||||
<a class="{{ request()->routeIs('team.member.index') ? 'text-white' : '' }}" href="{{ route('team.member.index') }}">
|
||||
<a class="{{ request()->routeIs('team.member.index') ? 'text-white' : '' }}"
|
||||
href="{{ route('team.member.index') }}">
|
||||
<button>Members</button>
|
||||
</a>
|
||||
<a class="{{ request()->routeIs('team.storage.index') ? 'text-white' : '' }}"
|
||||
href="{{ route('team.storage.index') }}">
|
||||
<button>S3 Storages</button>
|
||||
</a>
|
||||
<a class="{{ request()->routeIs('team.notification.index') ? 'text-white' : '' }}"
|
||||
href="{{ route('team.notification.index') }}">
|
||||
<button>Notifications</button>
|
||||
</a>
|
||||
<a class="{{ request()->routeIs('team.shared-variables.index') ? 'text-white' : '' }}"
|
||||
href="{{ route('team.shared-variables.index') }}">
|
||||
<button>Shared Variables</button>
|
||||
|
@ -7,7 +7,8 @@ class="underline text-warning">Please
|
||||
consider donating!</a>💜</span>
|
||||
<span>It enables us to keep creating features without paywalls, ensuring our work remains free and
|
||||
open.</span>
|
||||
<x-forms.button class="bg-coolgray-400" wire:click='disable'>Disable This Popup</x-forms.button>
|
||||
<x-forms.button class="bg-coolgray-400" wire:click='disableSponsorship'>Disable This
|
||||
Popup</x-forms.button>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@ -20,4 +21,16 @@ class="text-white underline">/subscription</a> to update your subscription or re
|
||||
</div>
|
||||
</x-banner>
|
||||
@endif
|
||||
@if (!currentTeam()->isAnyNotificationEnabled())
|
||||
<div class="toast">
|
||||
<div class="flex flex-col text-white rounded alert bg-coolgray-200">
|
||||
<span><span class="font-bold text-red-500">WARNING:</span> No notifications enabled.<br><br> It is highly recommended to enable at least
|
||||
one
|
||||
notification channel to receive important alerts.<br>Visit <a href="{{ route('notification.index') }}"
|
||||
class="text-white underline">/notification</a> to enable notifications.</span>
|
||||
<x-forms.button class="bg-coolgray-400" wire:click='disableNotifications'>Disable This
|
||||
Popup</x-forms.button>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div>
|
||||
<x-team.navbar />
|
||||
<x-notifications.navbar />
|
||||
<h2 class="pb-4">Notifications</h2>
|
||||
<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'email' }" class="flex h-full">
|
||||
<div class="flex flex-col gap-4 min-w-fit">
|
||||
|
@ -121,11 +121,13 @@
|
||||
Route::get('/', TagsIndex::class)->name('tags.index');
|
||||
Route::get('/{tag_name}', TagsShow::class)->name('tags.show');
|
||||
});
|
||||
Route::prefix('notifications')->group(function () {
|
||||
Route::get('/', TeamNotificationIndex::class)->name('notification.index');
|
||||
});
|
||||
Route::prefix('team')->group(function () {
|
||||
Route::get('/', TeamIndex::class)->name('team.index');
|
||||
Route::get('/new', TeamCreate::class)->name('team.create');
|
||||
Route::get('/members', TeamMemberIndex::class)->name('team.member.index');
|
||||
Route::get('/notifications', TeamNotificationIndex::class)->name('team.notification.index');
|
||||
Route::get('/shared-variables', TeamSharedVariablesIndex::class)->name('team.shared-variables.index');
|
||||
Route::get('/storages', TeamStorageIndex::class)->name('team.storage.index');
|
||||
Route::get('/storages/new', TeamStorageCreate::class)->name('team.storage.create');
|
||||
|
Loading…
Reference in New Issue
Block a user