From e91cc7e5142ea6568836c463de69b06d35fc3fc3 Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 7 Jan 2026 01:55:36 -0500 Subject: wip: black --- .../[id]/billing/black-section.module.css | 6 +++ .../workspace/[id]/billing/black-section.tsx | 50 +++++++++++++++++++++- 2 files changed, 54 insertions(+), 2 deletions(-) (limited to 'packages/console/app/src/routes/workspace') diff --git a/packages/console/app/src/routes/workspace/[id]/billing/black-section.module.css b/packages/console/app/src/routes/workspace/[id]/billing/black-section.module.css index c3a2af639..c189f0d64 100644 --- a/packages/console/app/src/routes/workspace/[id]/billing/black-section.module.css +++ b/packages/console/app/src/routes/workspace/[id]/billing/black-section.module.css @@ -1,2 +1,8 @@ .root { + [data-slot="title-row"] { + display: flex; + justify-content: space-between; + align-items: center; + gap: var(--space-4); + } } diff --git a/packages/console/app/src/routes/workspace/[id]/billing/black-section.tsx b/packages/console/app/src/routes/workspace/[id]/billing/black-section.tsx index d4876b242..2eece1b62 100644 --- a/packages/console/app/src/routes/workspace/[id]/billing/black-section.tsx +++ b/packages/console/app/src/routes/workspace/[id]/billing/black-section.tsx @@ -1,11 +1,57 @@ +import { action, useParams, useAction, useSubmission, json } from "@solidjs/router" +import { createStore } from "solid-js/store" +import { Billing } from "@opencode-ai/console-core/billing.js" +import { withActor } from "~/context/auth.withActor" +import { queryBillingInfo } from "../../common" import styles from "./black-section.module.css" +const createSessionUrl = action(async (workspaceID: string, returnUrl: string) => { + "use server" + return json( + await withActor( + () => + Billing.generateSessionUrl({ returnUrl }) + .then((data) => ({ error: undefined, data })) + .catch((e) => ({ + error: e.message as string, + data: undefined, + })), + workspaceID, + ), + { revalidate: queryBillingInfo.key }, + ) +}, "sessionUrl") + export function BlackSection() { + const params = useParams() + const sessionAction = useAction(createSessionUrl) + const sessionSubmission = useSubmission(createSessionUrl) + const [store, setStore] = createStore({ + sessionRedirecting: false, + }) + + async function onClickSession() { + const result = await sessionAction(params.id!, window.location.href) + if (result.data) { + setStore("sessionRedirecting", true) + window.location.href = result.data + } + } + return (
-

Black

-

You are subscribed to Black.

+

Subscription

+
+

You are subscribed to OpenCode Black for $200 per month.

+ +
) -- cgit v1.2.3