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(ui): add heart icon and enhance popup messaging for sponsorship support

Andras Bacsai3d4162d3dc3c
diff --git a/public/heart.png b/public/heart.png
new file mode 100644
index 0000000000..c44a213016
Binary files /dev/null and b/public/heart.png differ
diff --git a/resources/views/components/popup.blade.php b/resources/views/components/popup.blade.php
index afcb773ebf..ace85425d7 100644
--- a/resources/views/components/popup.blade.php
+++ b/resources/views/components/popup.blade.php
@@ -6,29 +6,30 @@
x-transition:enter-start="translate-y-full" x-transition:enter-end="translate-y-0"
x-transition:leave="transition ease-in duration-300" x-transition:leave-start="translate-y-0"
x-transition:leave-end="translate-y-full" x-init="setTimeout(() => { bannerVisible = true }, bannerVisibleAfter);"
- class="fixed bottom-0 right-0 w-full h-auto duration-300 ease-out sm:px-5 sm:pb-5 w-full z-999"
- x-cloak>
+ class="fixed bottom-0 right-0 w-full h-auto duration-300 ease-out sm:px-5 sm:pb-5 w-full z-999" x-cloak>
<div
- class="flex items-center flex-col justify-between w-full h-full max-w-4xl p-6 mx-auto bg-white border shadow-lg lg:border-t dark:border-coolgray-300 dark:bg-coolgray-100 lg:p-8 lg:flex-row sm:rounded-sm">
+ class="flex lg:items-center flex-col justify-between w-full h-full max-w-4xl p-6 mx-auto bg-white border shadow-lg lg:border-t dark:border-coolgray-300 dark:bg-coolgray-100 lg:p-8 lg:flex-row sm:rounded-sm">
<div
class="flex flex-col items-start h-full pb-6 text-xs lg:items-center lg:flex-row lg:pb-0 lg:pr-6 lg:space-x-5 dark:text-neutral-300">
@if (isset($icon))
- {{ $icon }}
+ <div class="hidden lg:block">
+ {{ $icon }}
+ </div>
@endif
<div class="pt-6 lg:pt-0">
<h4 class="w-full mb-1 text-xl font-bold leading-none -translate-y-1 text-neutral-900 dark:text-white">
{{ $title }}
</h4>
- <p class="">{{ $description }}</span></p>
+ <p>{{ $description }}</span></p>
</div>
</div>
- <button
- @if ($buttonText->attributes->whereStartsWith('@click')->first()) @click="bannerVisible=false;{{ $buttonText->attributes->get('@click') }}"
+ <button
+ @if ($buttonText->attributes->whereStartsWith('@click')->first()) @click="bannerVisible=false;{{ $buttonText->attributes->get('@click') }}"
@else
@click="bannerVisible=false;" @endif
- class="w-full px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-200 rounded-md bg-neutral-100 hover:bg-neutral-200 dark:bg-coolgray-200 lg:w-auto dark:text-neutral-200 dark:hover:bg-coolgray-300 focus:shadow-outline focus:outline-hidden">
- {{ $buttonText }}
- </button>
+ class="w-full px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-200 rounded-md bg-neutral-100 hover:bg-neutral-200 dark:bg-coolgray-200 lg:w-auto dark:text-neutral-200 dark:hover:bg-coolgray-300 focus:shadow-outline focus:outline-hidden">
+ {{ $buttonText }}
+ </button>
</div>
</div>
diff --git a/resources/views/livewire/layout-popups.blade.php b/resources/views/livewire/layout-popups.blade.php
index c639b4627c..5fc17bdde0 100644
--- a/resources/views/livewire/layout-popups.blade.php
+++ b/resources/views/livewire/layout-popups.blade.php
@@ -4,9 +4,11 @@
notification: true,
realtime: false,
},
+ isDevelopment: {{ isDev() ? 'true' : 'false' }},
init() {
- this.popups.sponsorship = localStorage.getItem('popupSponsorship') !== 'false';
- this.popups.notification = localStorage.getItem('popupNotification') !== 'false';
+ console.log(this.isDevelopment);
+ this.popups.sponsorship = this.shouldShowMonthlyPopup('popupSponsorship');
+ this.popups.notification = this.shouldShowMonthlyPopup('popupNotification');
this.popups.realtime = localStorage.getItem('popupRealtime');
let checkNumber = 1;
@@ -31,6 +33,35 @@
}
}, 2000);
}
+ },
+ shouldShowMonthlyPopup(storageKey) {
+ const disabledTimestamp = localStorage.getItem(storageKey);
+
+ // If never disabled, show the popup
+ if (!disabledTimestamp || disabledTimestamp === 'false') {
+ return true;
+ }
+
+ // If disabled timestamp is not a valid number, show the popup
+ const disabledTime = parseInt(disabledTimestamp);
+ if (isNaN(disabledTime)) {
+ return true;
+ }
+
+ const now = new Date();
+ const disabledDate = new Date(disabledTime);
+
+ {{-- if (this.isDevelopment) {
+ // In development: check if 10 seconds have passed
+ const timeDifference = now.getTime() - disabledDate.getTime();
+ const tenSecondsInMs = 10 * 1000;
+ return timeDifference >= tenSecondsInMs;
+ } else { --}}
+ // In production: check if we're in a different month or year
+ const isDifferentMonth = now.getMonth() !== disabledDate.getMonth() ||
+ now.getFullYear() !== disabledDate.getFullYear();
+ return isDifferentMonth;
+ {{-- } --}}
}
}">
@auth
@@ -59,20 +90,23 @@
<span x-show="popups.sponsorship">
<x-popup>
<x-slot:title>
- Love Coolify as we do?
+ Would you like to help us to make more cool things?
</x-slot:title>
<x-slot:icon>
- <img src="https://cdn-icons-png.flaticon.com/512/8236/8236748.png"
- class="w-8 h-8 sm:w-12 sm:h-12 lg:w-16 lg:h-16">
+ <img src="{{ asset('heart.png') }}" class="w-8 h-8 sm:w-12 sm:h-12 lg:w-16 lg:h-16">
</x-slot:icon>
<x-slot:description>
- <span>Please
- consider donating on <a href="https://github.com/sponsors/coollabsio"
- class="text-xs underline dark:text-white">GitHub</a> or <a
- href="https://opencollective.com/coollabsio"
- class="text-xs underline dark:text-white">OpenCollective</a>.<br><br></span>
- <span>It enables us to keep creating features without paywalls, ensuring our work remains free and
- open.</span>
+ <div class="text-md dark:text-white">
+ <span>We are already profitable, but we would like to scale even further.</span>
+ <br><span>Please
+ consider donating on one (or both) of the following platforms.<br /><br /> <a
+ href="https://github.com/sponsors/coollabsio"
+ class="underline text-lg font-bold dark:text-white">GitHub
+ Sponsors</a> (registration required) <br /><br />
+ <a href="https://opencollective.com/coollabsio/donate?interval=month&amount=10&name=&legalName=&email="
+ class="underline text-lg font-bold dark:text-white">OpenCollective</a> (no registration
+ required).</span>
+ </div>
</x-slot:description>
<x-slot:button-text @click="disableSponsorship()">
Disable This Popup
@@ -128,11 +162,13 @@
@endif
<script>
function disableSponsorship() {
- localStorage.setItem('popupSponsorship', false);
+ // Store current timestamp instead of just 'false'
+ localStorage.setItem('popupSponsorship', Date.now().toString());
}
function disableNotification() {
- localStorage.setItem('popupNotification', false);
+ // Store current timestamp instead of just 'false'
+ localStorage.setItem('popupNotification', Date.now().toString());
}
function disableRealtime() {