diff --git a/app/assets/images/bg-grid.png b/app/assets/images/bg-grid.png new file mode 100644 index 00000000..86742d7d Binary files /dev/null and b/app/assets/images/bg-grid.png differ diff --git a/app/assets/images/logo-squircle.svg b/app/assets/images/logo-squircle.svg new file mode 100644 index 00000000..9a8aa75c --- /dev/null +++ b/app/assets/images/logo-squircle.svg @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e947bb37..c5145b17 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,9 +2,6 @@ class ApplicationController < ActionController::Base include Localize, AutoSync, Authentication, Invitable, SelfHostable, StoreLocation include Pagy::Backend - # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. - allow_browser versions: :modern - private def with_sidebar diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 29dba43d..b3981939 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -1,5 +1,6 @@ class PagesController < ApplicationController - layout :with_sidebar + skip_before_action :authenticate_user!, only: %i[early_access] + layout :with_sidebar, except: %i[early_access] include Filterable @@ -37,6 +38,11 @@ class PagesController < ApplicationController def feedback end - def invites + def early_access + redirect_to root_path if self_hosted? + + @invite_codes_count = InviteCode.count + @invite_code = InviteCode.order("RANDOM()").limit(1).first + render layout: false end end diff --git a/app/views/pages/early_access.html.erb b/app/views/pages/early_access.html.erb new file mode 100644 index 00000000..eb77e5c2 --- /dev/null +++ b/app/views/pages/early_access.html.erb @@ -0,0 +1,56 @@ + + + + <%= content_for(:title) || "🔒 Maybe Early Access" %> + + <%= csrf_meta_tags %> + <%= csp_meta_tag %> + + <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %> + <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> + + <%= javascript_importmap_tags %> + <%= hotwire_livereload_tags if Rails.env.development? %> + <%= turbo_refreshes_with method: :morph, scroll: :preserve %> + + + + + + + + + <%= yield :head %> + + + ');"> +
+
+ <%= image_tag "logo-squircle.svg", alt: "Maybe Logo", class: "w-16 h-16 sm:w-18 sm:h-18 mx-auto mb-6 sm:mb-8" %> +

Maybe Early Access

+ <% if @invite_codes_count > 0 %> +

There <%= @invite_codes_count == 1 ? "is" : "are" %> <%= @invite_codes_count %> invite <%= "code".pluralize(@invite_codes_count) %> remaining.

+
+

Your invite code is <%= @invite_code.token %>

+

<%= link_to "Sign up with this code", new_registration_path(invite: @invite_code.token), class: "block w-full bg-white text-black py-2 px-3 rounded-md no-underline text-sm sm:text-base hover:bg-gray-200 transition duration-150" %>

+
+ +

You may need to refresh the page to get a new invite code if someone else claimed it before you.

+ +

+ <%= link_to early_access_path, class: "w-full block text-center justify-center inline-flex items-center text-white hover:bg-gray-800 p-2 rounded-md text-base transition duration-150", data: { turbo_method: :get } do %> + <%= lucide_icon "refresh-cw", class: "w-4 h-4 sm:w-5 sm:h-5 mr-2 text-gray-400" %> + Refresh page + <% end %> +

+ <% else %> +

Sorry, there are no invite codes remaining. Join our <%= link_to "Discord server", "https://link.maybe.co/discord", target: "_blank", class: "text-white hover:text-gray-300" %> to get notified when new invite codes are available.

+

<%= link_to "Join Discord server", "https://link.maybe.co/discord", target: "_blank", class: "bg-white text-black px-3 py-2 rounded-md no-underline text-base hover:bg-gray-200 transition duration-150" %>

+ <% end %> +
+
+ + + diff --git a/app/views/registrations/new.html.erb b/app/views/registrations/new.html.erb index a5ec1103..653c7f76 100644 --- a/app/views/registrations/new.html.erb +++ b/app/views/registrations/new.html.erb @@ -14,7 +14,7 @@ <%= form.password_field :password, autocomplete: "new-password", required: "required", label: true %> <%= form.password_field :password_confirmation, autocomplete: "new-password", required: "required", label: true %> <% if invite_code_required? %> - <%= form.password_field :invite_code, required: "required", label: true %> + <%= form.text_field :invite_code, required: "required", label: true, value: params[:invite] %> <% end %> <%= form.submit %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index df6b857c..d6ec8b7c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,6 +3,7 @@ Rails.application.routes.draw do get "changelog", to: "pages#changelog" get "feedback", to: "pages#feedback" + get "early-access", to: "pages#early_access" resource :registration resources :sessions, only: %i[new create destroy]