|
1 | | -import { A, createAsync } from "@solidjs/router" |
| 1 | +import { A, createAsync, useSearchParams } from "@solidjs/router" |
2 | 2 | import "./index.css" |
3 | 3 | import { Title } from "@solidjs/meta" |
4 | 4 | import { github } from "~/lib/github" |
5 | | -import { createMemo, Match, Switch } from "solid-js" |
| 5 | +import { createMemo, createSignal, For, Match, Show, Switch } from "solid-js" |
6 | 6 | import { config } from "~/config" |
7 | 7 |
|
| 8 | +const plans = [ |
| 9 | + { id: "20", amount: 20, multiplier: null }, |
| 10 | + { id: "100", amount: 100, multiplier: "6x more usage than Black 20" }, |
| 11 | + { id: "200", amount: 200, multiplier: "21x more usage than Black 20" }, |
| 12 | +] as const |
| 13 | + |
| 14 | +function PlanIcon(props: { plan: string }) { |
| 15 | + return ( |
| 16 | + <Switch> |
| 17 | + <Match when={props.plan === "20"}> |
| 18 | + <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 19 | + <rect x="4" y="4" width="16" height="16" rx="2" stroke="currentColor" stroke-width="1.5" /> |
| 20 | + </svg> |
| 21 | + </Match> |
| 22 | + <Match when={props.plan === "100"}> |
| 23 | + <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 24 | + <rect x="3" y="3" width="7" height="7" rx="1" stroke="currentColor" stroke-width="1.5" /> |
| 25 | + <rect x="14" y="3" width="7" height="7" rx="1" stroke="currentColor" stroke-width="1.5" /> |
| 26 | + <rect x="3" y="14" width="7" height="7" rx="1" stroke="currentColor" stroke-width="1.5" /> |
| 27 | + <rect x="14" y="14" width="7" height="7" rx="1" stroke="currentColor" stroke-width="1.5" /> |
| 28 | + </svg> |
| 29 | + </Match> |
| 30 | + <Match when={props.plan === "200"}> |
| 31 | + <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 32 | + <rect x="2" y="2" width="4" height="4" rx="0.5" stroke="currentColor" stroke-width="1" /> |
| 33 | + <rect x="10" y="2" width="4" height="4" rx="0.5" stroke="currentColor" stroke-width="1" /> |
| 34 | + <rect x="18" y="2" width="4" height="4" rx="0.5" stroke="currentColor" stroke-width="1" /> |
| 35 | + <rect x="2" y="10" width="4" height="4" rx="0.5" stroke="currentColor" stroke-width="1" /> |
| 36 | + <rect x="10" y="10" width="4" height="4" rx="0.5" stroke="currentColor" stroke-width="1" /> |
| 37 | + <rect x="18" y="10" width="4" height="4" rx="0.5" stroke="currentColor" stroke-width="1" /> |
| 38 | + <rect x="2" y="18" width="4" height="4" rx="0.5" stroke="currentColor" stroke-width="1" /> |
| 39 | + <rect x="10" y="18" width="4" height="4" rx="0.5" stroke="currentColor" stroke-width="1" /> |
| 40 | + <rect x="18" y="18" width="4" height="4" rx="0.5" stroke="currentColor" stroke-width="1" /> |
| 41 | + </svg> |
| 42 | + </Match> |
| 43 | + </Switch> |
| 44 | + ) |
| 45 | +} |
| 46 | + |
8 | 47 | export default function Black() { |
| 48 | + const [params] = useSearchParams() |
| 49 | + const [selected, setSelected] = createSignal<string | null>(params.plan as string | null) |
| 50 | + const selectedPlan = createMemo(() => plans.find((p) => p.id === selected())) |
| 51 | + |
9 | 52 | const githubData = createAsync(() => github()) |
10 | 53 | const starCount = createMemo(() => |
11 | 54 | githubData()?.stars |
@@ -16,9 +59,6 @@ export default function Black() { |
16 | 59 | : config.github.starsFormatted.compact, |
17 | 60 | ) |
18 | 61 |
|
19 | | - // TODO: Frank, toggle this based on availability |
20 | | - const available = false |
21 | | - |
22 | 62 | return ( |
23 | 63 | <div data-page="black"> |
24 | 64 | <Title>opencode</Title> |
@@ -148,17 +188,65 @@ export default function Black() { |
148 | 188 | <p data-slot="subheading">Including Claude, GPT, Gemini, and more</p> |
149 | 189 | </div> |
150 | 190 | <Switch> |
151 | | - <Match when={available}> |
152 | | - <a href="/black/subscribe" data-slot="button"> |
153 | | - Subscribe $200/mo |
154 | | - </a> |
155 | | - <p data-slot="fine-print">Fair usage limits apply</p> |
| 191 | + <Match when={!selected()}> |
| 192 | + <div data-slot="pricing"> |
| 193 | + <For each={plans}> |
| 194 | + {(plan) => ( |
| 195 | + <button type="button" onClick={() => setSelected(plan.id)} data-slot="pricing-card"> |
| 196 | + <div data-slot="icon"> |
| 197 | + <PlanIcon plan={plan.id} /> |
| 198 | + </div> |
| 199 | + <p data-slot="price"> |
| 200 | + <span data-slot="amount">${plan.amount}</span> <span data-slot="period">per month</span> |
| 201 | + <Show when={plan.multiplier}> |
| 202 | + <span data-slot="multiplier">{plan.multiplier}</span> |
| 203 | + </Show> |
| 204 | + </p> |
| 205 | + </button> |
| 206 | + )} |
| 207 | + </For> |
| 208 | + </div> |
| 209 | + <p data-slot="fine-print"> |
| 210 | + Prices shown don't include applicable tax · <A href="/legal/terms-of-service">Terms of Service</A> |
| 211 | + </p> |
156 | 212 | </Match> |
157 | | - <Match when={!available}> |
158 | | - <p data-slot="back-soon">We’ll be back soon with more availability.</p> |
159 | | - <a data-slot="follow-us" href="https://x.com/opencode" target="_blank"> |
160 | | - Follow @opencode |
161 | | - </a> |
| 213 | + <Match when={selectedPlan()}> |
| 214 | + {(plan) => ( |
| 215 | + <div data-slot="selected-plan"> |
| 216 | + <div data-slot="selected-card"> |
| 217 | + <div data-slot="icon"> |
| 218 | + <PlanIcon plan={plan().id} /> |
| 219 | + </div> |
| 220 | + <p data-slot="price"> |
| 221 | + <span data-slot="amount">${plan().amount}</span>{" "} |
| 222 | + <span data-slot="period">per person billed monthly</span> |
| 223 | + <Show when={plan().multiplier}> |
| 224 | + <span data-slot="multiplier">{plan().multiplier}</span> |
| 225 | + </Show> |
| 226 | + </p> |
| 227 | + <ul data-slot="terms"> |
| 228 | + <li>Your subscription will not start immediately</li> |
| 229 | + <li>You will be added to the waitlist and activated soon</li> |
| 230 | + <li>Your card will be only charged when your subscription is activated</li> |
| 231 | + <li>Usage limits apply, heavily automated use may reach limits sooner</li> |
| 232 | + <li>Subscriptions for individuals, contact Enterprise for teams</li> |
| 233 | + <li>Limits may be adjusted and plans may be discontinued in the future</li> |
| 234 | + <li>Cancel your subscription at anytime</li> |
| 235 | + </ul> |
| 236 | + <div data-slot="actions"> |
| 237 | + <button type="button" onClick={() => setSelected(null)} data-slot="cancel"> |
| 238 | + Cancel |
| 239 | + </button> |
| 240 | + <a href={`/black/subscribe?plan=${plan().id}`} data-slot="continue"> |
| 241 | + Continue |
| 242 | + </a> |
| 243 | + </div> |
| 244 | + </div> |
| 245 | + <p data-slot="fine-print"> |
| 246 | + Prices shown don't include applicable tax · <A href="/legal/terms-of-service">Terms of Service</A> |
| 247 | + </p> |
| 248 | + </div> |
| 249 | + )} |
162 | 250 | </Match> |
163 | 251 | </Switch> |
164 | 252 | </section> |
|