1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-08 23:15:24 +02:00

New onboarding, trials, Stripe integration (#2185)
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions

* New onboarding, trials, Stripe integration

* Fix tests

* Lint fixes

* Fix subscription endpoints
This commit is contained in:
Zach Gollwitzer 2025-05-01 16:47:14 -04:00 committed by GitHub
parent 79b4a3769b
commit a51c4d2cba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
53 changed files with 847 additions and 372 deletions

View file

@ -0,0 +1,31 @@
<%# locals: (plan:, form:, checked: false) %>
<% price = plan == "annual" ? 90 : 9 %>
<% frequency = plan == "annual" ? "/year" : "/month" %>
<div class="relative">
<%= form.radio_button :plan, plan, class: "peer sr-only", checked: checked %>
<%= form.label "plan_#{plan}", class: class_names(
"flex flex-col gap-1 p-4 cursor-pointer rounded-lg border border-primary hover:bg-container",
"peer-checked:bg-container peer-checked:rounded-2xl peer-checked:border-solid peer-checked:ring-4 peer-checked:ring-shadow",
"transition-all duration-300"
) do %>
<h3 class="text-sm text-secondary"><%= plan.titleize %></h3>
<div class="mt-auto flex items-end gap-1">
<p class="font-display text-xl lg:text-3xl font-medium text-primary">$<%= price %><%= frequency %></p>
<% if plan == "annual" %>
<span class="text-sm text-secondary mb-1">or <%= Money.new(price.to_f / 52).format %>/week</span>
<% end %>
</div>
<p class="text-sm text-secondary">
<% if plan == "annual" %>
Billed annually, 2 months free
<% else %>
Billed monthly
<% end %>
</p>
<% end %>
</div>

View file

@ -0,0 +1,55 @@
<div class="flex flex-col h-full justify-between bg-surface">
<nav class="p-4">
<h1 class="sr-only">Upgrade</h1>
<div class="flex justify-end">
<%= render ButtonComponent.new(
text: "Sign out",
icon: "log-out",
icon_position: :right,
variant: "ghost",
href: session_path(Current.session),
method: :delete
) %>
</div>
</nav>
<div class="grow flex flex-col items-center justify-center">
<%= image_tag "logo-color.png", class: "w-16 mb-6" %>
<% if Current.family.trialing? %>
<p class="text-xl lg:text-3xl text-primary font-display font-medium">Your trial has <%= Current.family.trial_remaining_days %> days remaining</p>
<% else %>
<p class="text-xl lg:text-3xl text-primary font-display font-medium">Your trial is over</p>
<% end %>
<h2 class="text-xl lg:text-3xl font-display font-medium mb-2">
<span class="text-secondary">Unlock</span>
<span class="bg-gradient-to-r from-[#EABE7F] to-[#957049] bg-clip-text text-transparent">Maybe</span>
<span class="text-secondary">today</span>
</h2>
<p class="text-sm text-secondary mb-8">To continue using Maybe pick a plan below.</p>
<%= form_with url: new_subscription_path, method: :get, class: "max-w-xs", data: { turbo: false } do |form| %>
<div class="space-y-4 mb-6">
<%= render "subscriptions/plan_choice", form: form, plan: "annual", checked: params[:plan] == "annual" || params[:plan].blank? %>
<%= render "subscriptions/plan_choice", form: form, plan: "monthly", checked: params[:plan] == "monthly" %>
</div>
<div class="text-center space-y-2">
<%= render ButtonComponent.new(
text: "Subscribe and unlock Maybe",
variant: "primary",
full_width: true
) %>
<p class="text-xs text-secondary">
In the next step, you'll be redirected to Stripe which handles our billing.
</p>
</div>
<% end %>
</div>
<%= render "layouts/shared/footer" %>
</div>