feat(settings): add development sponsorship reminder preview
This commit is contained in:
parent
e514a2d61f
commit
44bb132833
3 changed files with 34 additions and 8 deletions
|
|
@ -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 @@ class="button h-9 justify-center bg-red-600! text-white! ring-1 ring-red-600/25
|
|||
@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"
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -36,3 +36,21 @@
|
|||
->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');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue