From b941f3581258af7f3bff1ea48f4380747d7e7d5e Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 14 Aug 2023 14:00:10 +0200 Subject: [PATCH] fix: ui + subscription --- app/Actions/License/CheckResaleLicense.php | 3 + app/Http/Livewire/Settings/Backup.php | 8 +- bootstrap/helpers/subscriptions.php | 4 +- config/coolify.php | 5 +- docker-compose.prod.yml | 5 +- resources/css/app.css | 5 +- resources/views/command-center.blade.php | 6 +- resources/views/components/navbar.blade.php | 82 ++++++------ .../views/components/pricing-plans.blade.php | 117 ++++++++++++++---- .../views/components/server/navbar.blade.php | 2 +- .../components/settings/navbar.blade.php | 2 +- .../views/components/use-magic-bar.blade.php | 4 +- resources/views/dashboard.blade.php | 2 +- resources/views/destination/all.blade.php | 2 +- .../views/livewire/destination/form.blade.php | 4 +- .../new/standalone-docker.blade.php | 2 +- .../views/livewire/server/new/by-ip.blade.php | 2 +- .../views/livewire/server/proxy.blade.php | 2 +- .../livewire/source/github/change.blade.php | 2 +- .../livewire/team/storage/create.blade.php | 2 +- resources/views/private-key/all.blade.php | 2 +- resources/views/private-key/new.blade.php | 2 +- resources/views/profile.blade.php | 9 +- resources/views/project/show.blade.php | 2 +- resources/views/projects.blade.php | 2 +- resources/views/server/all.blade.php | 2 +- resources/views/server/create.blade.php | 2 +- resources/views/source/all.blade.php | 2 +- resources/views/source/new.blade.php | 2 +- resources/views/subscription.blade.php | 2 +- resources/views/team/create.blade.php | 2 +- resources/views/team/show.blade.php | 9 +- 32 files changed, 185 insertions(+), 114 deletions(-) diff --git a/app/Actions/License/CheckResaleLicense.php b/app/Actions/License/CheckResaleLicense.php index 71d1dddaa..e7dcecdb6 100644 --- a/app/Actions/License/CheckResaleLicense.php +++ b/app/Actions/License/CheckResaleLicense.php @@ -14,6 +14,9 @@ public function __invoke() $settings->update([ 'is_resale_license_active' => false, ]); + if (is_dev()) { + return; + } if (!$settings->resale_license) { return; } diff --git a/app/Http/Livewire/Settings/Backup.php b/app/Http/Livewire/Settings/Backup.php index 6d714c93d..fcb105fd4 100644 --- a/app/Http/Livewire/Settings/Backup.php +++ b/app/Http/Livewire/Settings/Backup.php @@ -14,8 +14,8 @@ class Backup extends Component { public InstanceSettings $settings; public $s3s; - public StandalonePostgresql|null $database = null; - public ScheduledDatabaseBackup|null $backup = null; + public StandalonePostgresql|null|array $database = []; + public ScheduledDatabaseBackup|null|array $backup = []; public $executions = []; protected $rules = [ @@ -36,8 +36,8 @@ class Backup extends Component public function mount() { - $this->backup = $this->database->scheduledBackups->first(); - $this->executions = $this->backup->executions; + $this->backup = $this->database?->scheduledBackups->first() ?? []; + $this->executions = $this->backup?->executions ?? []; } public function add_coolify_database() { diff --git a/bootstrap/helpers/subscriptions.php b/bootstrap/helpers/subscriptions.php index 8383bc51b..64cf9b24c 100644 --- a/bootstrap/helpers/subscriptions.php +++ b/bootstrap/helpers/subscriptions.php @@ -2,9 +2,9 @@ use Illuminate\Support\Carbon; -function getSubscriptionLink($id) +function getSubscriptionLink($type) { - $checkout_id = config("coolify.lemon_squeezy_checkout_id_$id"); + $checkout_id = config("coolify.lemon_squeezy_checkout_id_$type"); if (!$checkout_id) { return null; } diff --git a/config/coolify.php b/config/coolify.php index b0ae2ea2d..51536284a 100644 --- a/config/coolify.php +++ b/config/coolify.php @@ -4,9 +4,8 @@ 'self_hosted' => env('SELF_HOSTED', true), 'license_url' => 'https://license.coolify.io', 'lemon_squeezy_webhook_secret' => env('LEMON_SQUEEZY_WEBHOOK_SECRET'), - 'lemon_squeezy_checkout_id_1' => env('LEMON_SQUEEZY_CHECKOUT_ID_1'), - 'lemon_squeezy_checkout_id_2' => env('LEMON_SQUEEZY_CHECKOUT_ID_2'), - 'lemon_squeezy_checkout_id_3' => env('LEMON_SQUEEZY_CHECKOUT_ID_3'), + 'lemon_squeezy_checkout_id_monthly' => env('LEMON_SQUEEZY_CHECKOUT_ID_MONTHLY'), + 'lemon_squeezy_checkout_id_yearly' => env('LEMON_SQUEEZY_CHECKOUT_ID_YEARLY'), 'mux_enabled' => env('MUX_ENABLED', true), 'dev_webhook' => env('SERVEO_URL'), 'base_config_path' => env('BASE_CONFIG_PATH', '/_data/coolify'), diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 73b29c8ef..ae6b74e19 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -34,9 +34,8 @@ services: - PHP_PM_MAX_SPARE_SERVERS=10 - SELF_HOSTED - LEMON_SQUEEZY_WEBHOOK_SECRET - - LEMON_SQUEEZY_CHECKOUT_ID_1 - - LEMON_SQUEEZY_CHECKOUT_ID_2 - - LEMON_SQUEEZY_CHECKOUT_ID_3 + - LEMON_SQUEEZY_CHECKOUT_ID_MONTHLY + - LEMON_SQUEEZY_CHECKOUT_ID_YEARLY ports: - "${APP_PORT:-8000}:80" expose: diff --git a/resources/css/app.css b/resources/css/app.css index e71e6b9cd..b5f58fc74 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -111,5 +111,8 @@ tr td:first-child { } .buyme { - @apply block px-3 py-2 mt-10 text-sm font-semibold leading-6 text-center text-white rounded-md shadow-sm bg-coolgray-200 hover:bg-coolgray-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-coolgray-200; + @apply block px-3 py-2 mt-10 text-sm font-semibold leading-6 text-center text-white rounded-md shadow-sm bg-coolgray-200 hover:bg-coolgray-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-coolgray-200 hover:no-underline; +} +.subtitle { + @apply pt-2 pb-10; } diff --git a/resources/views/command-center.blade.php b/resources/views/command-center.blade.php index cd4ed7baa..33474eac6 100644 --- a/resources/views/command-center.blade.php +++ b/resources/views/command-center.blade.php @@ -1,12 +1,12 @@

Command Center

-
Execute commands on your servers without leaving the browser.
+
Execute commands on your servers without leaving the browser.
@if ($servers->count() > 0) @else
-
No validated servers found.
- +
No servers found. Without a server, you won't be able to do much.
+
@endif
diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php index 2d49017d1..e0fd6e22e 100644 --- a/resources/views/components/navbar.blade.php +++ b/resources/views/components/navbar.blade.php @@ -38,49 +38,48 @@ class="{{ request()->is('project/*') || request()->is('projects') ? 'text-warnin - - +
  • + is('command-center')) href="/command-center" @endif> + + + + + + +
  • +
    @if (auth()->user()->isInstanceAdmin()) -
  • - is('command-center')) href="/command-center" @endif> - - - - - - -
  • - -
  • - is('profile')) href="/profile" @endif> - - - - - - - -
  • -
  • - - - - - - - - - - - -
  • -
    + @endif +
  • + is('profile')) href="/profile" @endif> + + + + + + + +
  • +
  • + + + + + + + + + + + +
  • + @if (auth()->user()->isInstanceAdmin())
  • is('settings')) href="/settings" @endif>
  • @endif -
  • @csrf diff --git a/resources/views/components/pricing-plans.blade.php b/resources/views/components/pricing-plans.blade.php index 222d41145..5ae2cacdd 100644 --- a/resources/views/components/pricing-plans.blade.php +++ b/resources/views/components/pricing-plans.blade.php @@ -19,8 +19,7 @@ class="sr-only">
    -
    Save 20% with the - yearly plan +
    Save 10% annually with the yearly plan.
    @@ -31,18 +30,20 @@ class="sr-only">
    -

    Unlimited Trial

    +

    Unlimited Trial

    - Free + Free - Still Free + Still Free

    -
    Get + (save $?) + Get Started -

    Start self-hosting without limits with our OSS +

    Start self-hosting without limits with our + OSS version.

    • @@ -61,7 +62,7 @@ class="grid max-w-sm grid-cols-1 -mt-16 divide-y divide-coolgray-500 isolate gap d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" /> - You need to take care of everything + Managed by you
    • - If you brave enough, you can do it! + If you brave enough
    • + + + + + + + + All upcoming features +

    Basic

    - $15 + $5 /monthly - $144 + $54 /yearly

    - Subscribe -

    Start self-hosting in the cloud with a single + (save $6) + + Subscribe + Subscribe +

    Start self-hosting in + the cloud + with a + single server.

      @@ -125,7 +146,7 @@ class="grid max-w-sm grid-cols-1 -mt-16 divide-y divide-coolgray-500 isolate gap d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" /> - 30 days of backups + Bring your own S3
    • + + + + + + + + All upcoming features +

    Essential

    - $30 + $29 /monthly - $288 + $319 /yearly

    - Subscribe -

    Scale your business or self-hosting environment.

    + (save $29) + Subscribe + Subscribe +

    Scale your business or self-hosting environment. +

    • Subscribe d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" /> - 30 days of backups + Provided (optional) S3
    • Subscribe Basic Support
    • +
    • + + + + + + + + All upcoming features +

    Growth

    - $60 + $49 /monthly - $576 + $539 /yearly

    - - Subscribe -

    Deploy complex infrastuctures and + (save $69) + Subscribe + Subscribe +

    Deploy complex infrastuctures and manage them easily in one place.

    • @@ -235,7 +286,7 @@ class="buyme">Subscribe d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" /> - 30 days of backups + Provided (optional) S3
    • Subscribe Priority Support
    • +
    • + + + + + + + + All upcoming features +
    diff --git a/resources/views/components/server/navbar.blade.php b/resources/views/components/server/navbar.blade.php index 499568b1a..32691c44d 100644 --- a/resources/views/components/server/navbar.blade.php +++ b/resources/views/components/server/navbar.blade.php @@ -3,7 +3,7 @@

    Server

    -
    {{ data_get($server, 'name') }}
    +
    {{ data_get($server, 'name') }}