main
erb 78 lines 3.82 KB
Raw
1 <% content_for :title, "Billing" %>
2
3 <div class="max-w-2xl mx-auto px-4 sm:px-6 py-12">
4 <h1 class="text-xl font-semibold text-gray-100 mb-8">Billing</h1>
5
6 <% if params[:billing] == "success" %>
7 <div class="card mb-6 px-6 py-4 border border-green-800/40 bg-green-900/20 text-sm text-green-300">
8 You're on siGit Code Cloud. It may take a moment to activate.
9 </div>
10 <% elsif params[:billing] == "cancel" %>
11 <div class="card mb-6 px-6 py-4 border border-amber-800/40 bg-amber-900/20 text-sm text-amber-300">
12 Checkout canceled — no changes were made.
13 </div>
14 <% end %>
15
16 <!-- Plan -->
17 <div class="card mb-6">
18 <div class="px-6 py-4 border-b border-surface-600 flex items-center justify-between">
19 <h2 class="text-sm font-semibold text-gray-100">Plan</h2>
20 <span class="text-xs px-2 py-0.5 rounded-full <%= @entitled ? "bg-brand-500/15 text-brand-400" : "bg-surface-700 text-gray-400" %>">
21 <%= @plan.to_s.capitalize %><%= " · #{@status}" if @status && @status != "active" %>
22 </span>
23 </div>
24 <div class="px-6 py-6">
25 <% if @entitled %>
26 <p class="text-sm text-gray-300">
27 <% if @status.to_s == "trialing" %>
28 You're on a <span class="text-gray-100 font-medium">free trial</span> of
29 <%= @plan.to_s.capitalize %> — siGit Code Cloud is unlocked.
30 <% if @period_end %>
31 <span class="text-gray-500">Trial ends <%= @period_end.strftime("%b %-d, %Y") %>, then $20/mo.</span>
32 <% end %>
33 <% else %>
34 You're on <span class="text-gray-100 font-medium"><%= @plan.to_s.capitalize %></span> — siGit Code Cloud is unlocked.
35 <% if @period_end %>
36 <span class="text-gray-500">Renews <%= @period_end.strftime("%b %-d, %Y") %>.</span>
37 <% end %>
38 <% end %>
39 </p>
40 <% else %>
41 <p class="text-sm text-gray-300">
42 You're on the free <span class="text-gray-100 font-medium">Garage</span> plan. AI runs
43 <span class="text-gray-100">on your device</span> — private and free. Try siGit Code Cloud
44 (the Fast / Balanced / Large tiers) free for 14 days when you need more.
45 </p>
46 <% end %>
47 </div>
48 </div>
49
50 <!-- Cloud usage -->
51 <% if @entitled %>
52 <div class="card mb-6">
53 <div class="px-6 py-4 border-b border-surface-600">
54 <h2 class="text-sm font-semibold text-gray-100">Cloud usage this period</h2>
55 </div>
56 <div class="px-6 py-6">
57 <div class="flex items-baseline justify-between mb-2">
58 <span class="text-sm text-gray-300"><%= number_with_delimiter(@used) %> / <%= number_with_delimiter(@allowance) %> requests</span>
59 <span class="text-xs text-gray-500"><%= @allowance.positive? ? (100 * @used / @allowance).clamp(0, 100) : 0 %>%</span>
60 </div>
61 <div class="h-2 w-full rounded-full bg-surface-700 overflow-hidden">
62 <div class="h-full bg-brand-500" style="width: <%= @allowance.positive? ? (100 * @used / @allowance).clamp(0, 100) : 0 %>%"></div>
63 </div>
64 <p class="text-xs text-gray-500 mt-3">On-device requests are always free and don't count toward this.</p>
65 </div>
66 </div>
67 <% end %>
68
69 <!-- Actions -->
70 <div class="flex flex-wrap items-center gap-4">
71 <% if @entitled %>
72 <%= button_to "Manage billing", billing_portal_path, method: :post, data: { turbo: false }, class: "btn-primary cursor-pointer" %>
73 <% else %>
74 <%= button_to "Start 14-day free trial", billing_checkout_path(plan: "pro"), method: :post, data: { turbo: false }, class: "btn-primary cursor-pointer" %>
75 <%= button_to "Try Team free", billing_checkout_path(plan: "team"), method: :post, data: { turbo: false }, class: "text-sm text-gray-400 hover:text-gray-200 transition-colors bg-transparent border-0 cursor-pointer" %>
76 <% end %>
77 </div>
78 </div>