feat(settings): add sponsorship popup toggle and corresponding database migration

This commit is contained in:
Andras Bacsai
2025-06-25 15:18:39 +02:00
parent 3d4162d3dc
commit 8abb8b2328
4 changed files with 70 additions and 29 deletions

View File

@@ -68,6 +68,9 @@ class Index extends Component
#[Validate('boolean')]
public bool $disable_two_step_confirmation;
#[Validate('boolean')]
public bool $is_sponsorship_popup_enabled;
public function render()
{
return view('livewire.settings.index');
@@ -96,6 +99,7 @@ class Index extends Component
$this->update_check_frequency = $this->settings->update_check_frequency;
$this->instance_timezone = $this->settings->instance_timezone;
$this->disable_two_step_confirmation = $this->settings->disable_two_step_confirmation;
$this->is_sponsorship_popup_enabled = $this->settings->is_sponsorship_popup_enabled;
}
}
@@ -134,6 +138,7 @@ class Index extends Component
$this->settings->update_check_frequency = $this->update_check_frequency;
$this->settings->disable_two_step_confirmation = $this->disable_two_step_confirmation;
$this->settings->instance_timezone = $this->instance_timezone;
$this->settings->is_sponsorship_popup_enabled = $this->is_sponsorship_popup_enabled;
if ($isSave) {
$this->settings->save();
$this->dispatch('success', 'Settings updated!');

View File

@@ -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('instance_settings', function (Blueprint $table) {
$table->boolean('is_sponsorship_popup_enabled')->default(true);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('instance_settings', function (Blueprint $table) {
$table->dropColumn('is_sponsorship_popup_enabled');
});
}
};

View File

@@ -87,6 +87,7 @@
@endif
</span>
@endauth
@if (instanceSettings()->is_sponsorship_popup_enabled)
<span x-show="popups.sponsorship">
<x-popup>
<x-slot:title>
@@ -113,12 +114,15 @@
</x-slot:button-text>
</x-popup>
</span>
@endif
@if (currentTeam()->subscriptionPastOverDue())
<x-banner :closable=false>
<div><span class="font-bold text-red-500">WARNING:</span> Your subscription is in over-due. If your latest
<div><span class="font-bold text-red-500">WARNING:</span> Your subscription is in over-due. If your
latest
payment is not paid within a week, all automations <span class="font-bold text-red-500">will
be deactivated</span>. Visit <a href="{{ route('subscription.show') }}"
class="underline dark:text-white">/subscription</a> to check your subscription status or pay your
class="underline dark:text-white">/subscription</a> to check your subscription status or pay
your
invoice (or check your email for the invoice).
</div>
</x-banner>

View File

@@ -97,7 +97,7 @@
helper="Allowed IP lists for the API. A comma separated list of IPs. Empty means you allow from everywhere."
placeholder="1.1.1.1,8.8.8.8" />
<h4 class="pt-6">Update</h4>
<div class="text-right md:w-96">
<div class="text-right md:w-96 pb-4">
@if (!is_null(config('constants.coolify.autoupdate', null)))
<div class="text-right md:w-96">
<x-forms.checkbox instantSave helper="AUTOUPDATE is set in .env file, you need to modify it there."
@@ -128,6 +128,10 @@
</div>
<h4 class="py-4">Confirmation Settings</h4>
<div class="md:w-96 ">
<x-forms.checkbox instantSave id="is_sponsorship_popup_enabled" label="Show Sponsorship Popup"
helper="When enabled, sponsorship popups will be shown monthly to users. When disabled, the sponsorship popup will be permanently hidden for all users." />
</div>
@if ($disable_two_step_confirmation)
<div class="md:w-96 pb-4" wire:key="two-step-confirmation-enabled">