Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

feat(settings): add development sponsorship reminder preview

Andras Bacsai44bb1328332d
diff --git a/resources/views/livewire/layout-popups.blade.php b/resources/views/livewire/layout-popups.blade.php
index 2e5f6a02db..199774c3c9 100644
--- a/resources/views/livewire/layout-popups.blade.php
+++ b/resources/views/livewire/layout-popups.blade.php
@@ -11,7 +11,7 @@
reminderCollapseAfter: 10000,
isDevelopment: {{ isDev() ? 'true' : 'false' }},
init() {
- this.popups.sponsorship = this.shouldShowMonthlyPopup('popupSponsorship');
+ this.popups.sponsorship = !this.isDevelopment && this.shouldShowMonthlyPopup('popupSponsorship');
this.popups.notification = this.shouldShowMonthlyPopup('popupNotification');
this.popups.realtime = localStorage.getItem('popupRealtime');
@@ -86,7 +86,7 @@
return isDifferentMonth;
{{-- } --}}
}
-}">
+}" @show-sponsorship-reminder.window="popups.sponsorship = true; reminders.sponsorship.compact = false">
@auth
<span x-show="popups.realtime === true">
@if (!isCloud())
@@ -140,11 +140,12 @@
@endif
</span>
@endauth
- @if (instanceSettings()->is_sponsorship_popup_enabled && !isCloud())
+ @if ((isDev() || instanceSettings()->is_sponsorship_popup_enabled) && ! isCloud())
<span x-show="popups.sponsorship">
<x-popup>
<x-slot:customActions>
<div class="relative mx-auto flex w-full flex-col overflow-hidden rounded-2xl border border-neutral-200 bg-white shadow-modal transition-all duration-300 dark:border-white/[0.1] dark:bg-surface"
+ @show-sponsorship-reminder.window="bannerVisible = true"
:class="reminders.sponsorship.compact ? 'max-w-sm gap-3 p-4' : 'max-w-2xl gap-5 p-5 sm:p-6'">
<button type="button" aria-label="Dismiss sponsorship reminder"
class="absolute top-3 right-3 flex size-7 items-center justify-center rounded-full text-neutral-400 transition-colors hover:bg-neutral-100 hover:text-black dark:text-fg-faint dark:hover:bg-white/[0.07] dark:hover:text-fg"
diff --git a/resources/views/livewire/settings/advanced.blade.php b/resources/views/livewire/settings/advanced.blade.php
index d15a1b87ab..94927ba257 100644
--- a/resources/views/livewire/settings/advanced.blade.php
+++ b/resources/views/livewire/settings/advanced.blade.php
@@ -127,11 +127,18 @@
['value' => false, 'label' => 'Enabled'],
['value' => true, 'label' => 'Disabled'],
]" />
- <x-forms.listbox id="is_sponsorship_popup_enabled" label="Sponsorship reminders"
- helper="Show the monthly project sponsorship reminder." onChange="instantSave" :options="[
- ['value' => true, 'label' => 'Enabled'],
- ['value' => false, 'label' => 'Disabled'],
- ]" />
+ <div class="flex flex-col gap-2">
+ <x-forms.listbox id="is_sponsorship_popup_enabled" label="Sponsorship reminders"
+ helper="Show the monthly project sponsorship reminder." onChange="instantSave" :options="[
+ ['value' => true, 'label' => 'Enabled'],
+ ['value' => false, 'label' => 'Disabled'],
+ ]" />
+ @if (isDev())
+ <x-forms.button type="button" @click="$dispatch('show-sponsorship-reminder')">
+ Show sponsorship reminder
+ </x-forms.button>
+ @endif
+ </div>
</div>
</x-application.settings-section>
diff --git a/tests/Feature/LayoutPopupsUiTest.php b/tests/Feature/LayoutPopupsUiTest.php
index 167a23a04f..3744732817 100644
--- a/tests/Feature/LayoutPopupsUiTest.php
+++ b/tests/Feature/LayoutPopupsUiTest.php
@@ -36,3 +36,21 @@ test('non-critical reminders collapse after ten seconds', function () {
->toContain('reminders.sponsorship.compact = true')
->toContain('reminders.notification.compact = true');
});
+
+test('sponsorship reminder is disabled in development', function () {
+ $view = file_get_contents(resource_path('views/livewire/layout-popups.blade.php'));
+
+ expect($view)
+ ->toContain('this.popups.sponsorship = !this.isDevelopment && this.shouldShowMonthlyPopup')
+ ->toContain('@show-sponsorship-reminder.window="popups.sponsorship = true')
+ ->toContain('@show-sponsorship-reminder.window="bannerVisible = true"');
+});
+
+test('advanced settings provides a development-only sponsorship reminder preview', function () {
+ $view = file_get_contents(resource_path('views/livewire/settings/advanced.blade.php'));
+
+ expect($view)
+ ->toContain('@if (isDev())')
+ ->toContain("@click=\"\$dispatch('show-sponsorship-reminder')\"")
+ ->toContain('Show sponsorship reminder');
+});