Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Fix license activation refresh and add settings page (#561)

Richie McIlroy8945ea28f608
diff --git a/apps/desktop/src/routes/(window-chrome)/licensing.tsx b/apps/desktop/src/routes/(window-chrome)/licensing.tsx
deleted file mode 100644
index f58a509ac..000000000
--- a/apps/desktop/src/routes/(window-chrome)/licensing.tsx
+++ /dev/null
@@ -1,286 +0,0 @@
-import { Button } from "@cap/ui-solid";
-import { licenseContract } from "@cap/web-api-contract";
-import { useNavigate } from "@solidjs/router";
-import { createMutation } from "@tanstack/solid-query";
-import * as tauriShell from "@tauri-apps/plugin-shell";
-import { ClientInferResponseBody } from "@ts-rest/core";
-import {
- createResource,
- createSignal,
- Match,
- Show,
- Suspense,
- Switch,
-} from "solid-js";
-import { generalSettingsStore } from "~/store";
-import { createLicenseQuery } from "~/utils/queries";
-import { licenseApiClient } from "~/utils/web-api";
-import { Input } from "../editor/ui";
-
-export default function Page() {
- const license = createLicenseQuery();
- const navigate = useNavigate();
-
- return (
- <div class="py-5 w-full max-w-[700px] mx-auto relative flex flex-col justify-start items-center h-full">
- <div class="text-center">
- <h1 class="text-4xl md:text-4xl mb-3 tracking-[-.05em] font-medium text-[--text-primary]">
- Commercial License
- </h1>
- <p class="text-base font-normal leading-6 text-gray-11 dark:text-[--black-transparent-60]">
- Permits using Cap for commercial purposes, but without paying for
- cloud features.
- </p>
- </div>
- <Button
- class="text-[--text-secondary] text-center text-base block my-4"
- variant="secondary"
- onClick={() => navigate("/upgrade")}
- >
- Looking for Cap Pro?
- </Button>
- <Switch fallback={<CommercialLicensePurchase />}>
- <Match when={license.data?.type === "pro" && license.data}>
- <div class="p-4 mt-4 space-y-4 w-full rounded-xl bg-gray-3">
- <p class="text-[--text-primary]">
- Your account is upgraded to Cap Pro and already includes a
- commercial license.
- </p>
- </div>
- </Match>
- <Match when={license.data?.type === "commercial" && license.data}>
- {(license) => (
- <div class="p-6 space-y-4 w-full rounded-xl bg-gray-3">
- <h3 class="text-2xl font-medium tracking-tight text-[--text-primary]">
- Your License
- </h3>
- <div class="flex flex-col">
- <label class="text-[--text-tertiary] text-sm">Key</label>
- <pre class="text-[--text-secondary] font-mono bg-gray-2 rounded-lg p-1 px-2">
- {license().licenseKey}
- </pre>
- </div>
- <Show when={license().expiryDate}>
- {(expiry) => (
- <div class="flex flex-col">
- <label class="text-[--text-tertiary] text-sm">
- Expires
- </label>
- <span class="text-[--text-secondary] mt-1 ml-0.5">
- {new Date(expiry()).toUTCString()}
- </span>
- </div>
- )}
- </Show>
-
- {/* <p class="text-[--text-tertiary] text-sm pt-1">
- Instance ID: {license().instanceId}
- </p> */}
- <div class="flex flex-row justify-end">
- <Button variant="destructive">Deactivate License Key</Button>
- </div>
- </div>
- )}
- </Match>
- </Switch>
- </div>
- );
-}
-
-function LicenseKeyActivate(props: {
- onActivated: (
- value: ClientInferResponseBody<
- (typeof licenseContract)["activateCommercialLicense"],
- 200
- > & { licenseKey: string }
- ) => void;
-}) {
- const [store] = createResource(() => generalSettingsStore.get());
-
- return (
- <Suspense>
- <Show when={store()}>
- {(generalSettings) => {
- const [licenseKey, setLicenseKey] = createSignal("");
-
- const activateLicenseKey = createMutation(() => ({
- mutationFn: async (vars: { licenseKey: string }) => {
- const resp = await licenseApiClient.activateCommercialLicense({
- headers: {
- licensekey: vars.licenseKey,
- instanceid: generalSettings().instanceId!,
- },
- body: { reset: false },
- });
-
- if (resp.status === 200) return resp.body;
- if (
- typeof resp.body === "object" &&
- resp.body &&
- "message" in resp.body
- )
- throw resp.body.message;
- throw new Error((resp.body as any).toString());
- },
- onSuccess: (value, { licenseKey }) =>
- props.onActivated({ ...value, licenseKey }),
- }));
-
- return (
- <div class="p-6 mt-4 space-y-2 w-full rounded-xl bg-gray-3">
- <p class="text-[--text-primary]">
- Got a license key? Enter it below
- </p>
- <Input
- placeholder="License key"
- value={licenseKey()}
- onInput={(e) => setLicenseKey(e.currentTarget.value)}
- />
- <Button
- disabled={activateLicenseKey.isPending}
- onClick={() =>
- activateLicenseKey.mutate({ licenseKey: licenseKey() })
- }
- >
- Submit
- </Button>
- {/* <p class="text-[--text-tertiary] text-sm pt-1">
- Instance ID: {generalSettings().instanceId}
- </p> */}
- </div>
- );
- }}
- </Show>
- </Suspense>
- );
-}
-
-type CommercialLicenseType = "yearly" | "lifetime";
-function CommercialLicensePurchase() {
- const openCheckoutInExternalBrowser = createMutation(() => ({
- mutationFn: async ({ type }: { type: CommercialLicenseType }) => {
- const resp = await licenseApiClient.createCommercialCheckoutUrl({
- body: { type },
- });
-
- if (resp.status === 200) tauriShell.open(resp.body.url);
- else throw resp.body;
- },
- }));
-
- const [type, setType] = createSignal<CommercialLicenseType>("yearly");
-
- return (
- <>
- <div class="p-3 w-full bg-blue-9 rounded-xl border shadow-sm text-card-foreground md:p-3 border-blue-500/20">
- <div class="space-y-3">
- <div class="flex flex-col space-y-1.5 pt-6 px-6">
- <h3 class="text-2xl font-medium tracking-tight text-gray-1 text-gray-12">
- Commercial License
- </h3>
- <p class="text-[0.875rem] leading-[1.25rem] text-gray-1 text-gray-12">
- For professional use without cloud features.
- </p>
- <div>
- <div class="flex items-center space-x-3">
- <h3 class="text-4xl text-gray-1 text-gray-12">
- {type() === "yearly" ? "$29/year" : "$58"}
- </h3>
- <div>
- {type() === "lifetime" && (
- <p class="text-sm font-medium text-gray-1 text-gray-12">
- billed once
- </p>
- )}
- {type() === "lifetime" && (
- <p class="text-sm text-gray-1 text-gray-12">
- or, $29/year.
- </p>
- )}
- </div>
- </div>
- </div>
- </div>
- <div class="px-3 md:px-8">
- <div class="flex items-center pt-4 pb-1 border-t-2 border-[--white-transparent-20] dark:border-[--black-transparent-20]">
- <span class="mr-2 text-xs text-gray-1 text-gray-12">
- Switch to {type() === "yearly" ? "lifetime" : "yearly"}
- </span>
- <button
- type="button"
- role="switch"
- aria-checked={type() === "lifetime"}
- data-state={type() === "yearly" ? "unchecked" : "checked"}
- value={type() === "lifetime" ? "on" : "off"}
- class="peer inline-flex h-4 w-8 shrink-0
- cursor-pointer items-center rounded-full border-2 border-transparent
- dark:bg-[#3F75E0]
- transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
- focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 bg-[--blue-400]"
- onClick={() =>
- setType(type() === "yearly" ? "lifetime" : "yearly")
- }
- >
- <span
- data-state={type() === "yearly" ? "unchecked" : "checked"}
- class={`pointer-events-none block h-4 w-4 rounded-full dark:bg-gray-12
- bg-gray-1 shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4
- data-[state=unchecked]:translate-x-0 border-2 ${
- type() === "lifetime"
- ? "border-blue-400 dark:border-[#3F75E0]"
- : "border-gray-300 dark:border-[--white-transparent-20]"
- }`}
- />
- </button>
- </div>
- </div>
- <div class="px-6 pt-0 pb-4">
- <button
- onClick={() => {
- openCheckoutInExternalBrowser.mutate({ type: type() });
- }}
- disabled={openCheckoutInExternalBrowser.isPending}
- class="flex items-center justify-center hover:opacity-90 transition-opacity duration-200 rounded-full bg-[--gray-50] dark:bg-[--gray-500] hover:bg-[--gray-200] disabled:bg-[--gray-100]
- font-medium text-lg px-6 h-12 w-full no-underline text-gray-12 dark:text-gray-1"
- >
- Buy Commercial Licenses
- </button>
- </div>
- <div class="flex items-center px-6 pt-0 pb-6">
- <div class="space-y-6">
- <div>
- <ul class="p-0 space-y-3 list-none">
- {[
- "Commercial Use of Cap Recorder + Editor",
- "Community Support",
- ].map((feature) => (
- <li class="flex justify-start items-center">
- <div class="w-6 h-6 m-0 p-0 flex items-center border-[2px] border-[--gray-50] dark:border-[--gray-500] justify-center rounded-full">
- <IconLucideCheck class="w-4 h-4 text-gray-1" />
- </div>
- <span class="ml-2 text-[0.9rem] text-gray-1">
- {feature}
- </span>
- </li>
- ))}
- </ul>
- </div>
- </div>
- </div>
- </div>
- </div>
- <LicenseKeyActivate
- onActivated={async (value) => {
- await generalSettingsStore.set({
- commercialLicense: {
- activatedOn: Date.now(),
- expiryDate: value.expiryDate ?? null,
- refresh: value.refresh,
- licenseKey: value.licenseKey,
- },
- });
- }}
- />
- </>
- );
-}
diff --git a/apps/desktop/src/routes/(window-chrome)/settings.tsx b/apps/desktop/src/routes/(window-chrome)/settings.tsx
index 3aee92597..c3f886498 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings.tsx
@@ -46,6 +46,11 @@ export default function Settings(props: RouteSectionProps) {
name: "Integrations",
icon: IconLucideUnplug,
},
+ {
+ href: "license",
+ name: "License",
+ icon: IconLucideGift,
+ },
{
href: "experimental",
name: "Experimental",
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx b/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx
index c6740bcfa..38b44c65f 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx
@@ -41,10 +41,10 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
<div class="flex-1 custom-scroll">
<div class="p-4 space-y-2 divide-y divide-gray-200">
<div class="py-2 mb-4">
- <h2 class="text-[--text-primary] text-lg font-medium">
+ <h2 class="text-gray-12 text-lg font-medium">
Experimental Features
</h2>
- <p class="text-[--text-secondary] text-sm">
+ <p class="text-gray-11 text-sm">
These features are still in development and may not work as
expected.
</p>
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx
new file mode 100644
index 000000000..af346be38
--- /dev/null
+++ b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx
@@ -0,0 +1,331 @@
+import { createRive } from "@aerofoil/rive-solid-canvas";
+import { Button } from "@cap/ui-solid";
+import { licenseContract } from "@cap/web-api-contract";
+import { useNavigate } from "@solidjs/router";
+import { createMutation, useQueryClient } from "@tanstack/solid-query";
+import * as tauriShell from "@tauri-apps/plugin-shell";
+import { ClientInferResponseBody } from "@ts-rest/core";
+import {
+ createResource,
+ createSignal,
+ Match,
+ Show,
+ Suspense,
+ Switch,
+} from "solid-js";
+import { generalSettingsStore } from "~/store";
+import { createLicenseQuery } from "~/utils/queries";
+import { commands } from "~/utils/tauri";
+import { licenseApiClient } from "~/utils/web-api";
+import PricingRive from "../../../assets/rive/pricing.riv";
+import { Input } from "../../editor/ui";
+
+export default function Page() {
+ const license = createLicenseQuery();
+ const navigate = useNavigate();
+ const queryClient = useQueryClient();
+
+ return (
+ <div class="flex overflow-y-auto gap-3 relative flex-col items-center p-4 mx-auto w-full h-full custom-scroll">
+ <div class="text-left w-full py-2">
+ <h2 class="text-gray-12 text-lg font-medium">Commercial License</h2>
+ <p class="text-gray-11 text-sm">
+ Permits using Cap for commercial purposes, but without paying for
+ cloud features.
+ <Show when={license.data?.type !== "pro"}>
+ <br />
+ Need cloud features?{" "}
+ <button
+ class="underline cursor-pointer"
+ onClick={() => commands.showWindow("Upgrade")}
+ >
+ Upgrade to Cap Pro.
+ </button>
+ </Show>
+ </p>
+ </div>
+ <Switch fallback={<CommercialLicensePurchase />}>
+ <Match when={license.data?.type === "pro" && license.data}>
+ <div class="p-6 mx-auto mt-6 w-full max-w-md text-white bg-gray-2 rounded-3xl border border-gray-4">
+ <div class="space-y-4 text-center">
+ <div class="flex flex-col gap-2 items-center mb-4">
+ <h3 class="text-2xl font-medium text-gray-12">
+ Cap Pro License
+ </h3>
+ </div>
+ <p class="text-gray-11">
+ Your account is upgraded to{" "}
+ <span class="font-semibold text-blue-400">Cap Pro</span> and
+ already includes a commercial license.
+ </p>
+ </div>
+ </div>
+ </Match>
+ <Match when={license.data?.type === "commercial" && license.data}>
+ {(license) => (
+ <div class="p-8 mx-auto mt-6 w-full max-w-[700px] text-white rounded-xl border border-gray-3 bg-gray-2">
+ <div class="space-y-6">
+ <div class="flex flex-col gap-2 items-center mb-4 text-center">
+ <span class="text-2xl text-green-400 fa fa-briefcase" />
+ <h3 class="text-2xl text-gray-12 font-medium">
+ Commercial License
+ </h3>
+ </div>
+ <div>
+ <label class="block mb-2 text-sm text-gray-12">
+ License Key
+ </label>
+ <pre class="overflow-x-auto p-3 font-mono text-xs rounded-lg border border-gray-4 text-gray-9 bg-gray-3">
+ {license().licenseKey}
+ </pre>
+ </div>
+ <Show when={license().expiryDate}>
+ {(expiry) => (
+ <div class="space-y-1">
+ <label class="text-sm text-gray-12">Expires</label>
+ <p class="text-gray-10">
+ {new Date(expiry()).toLocaleDateString()}
+ </p>
+ </div>
+ )}
+ </Show>
+ <div class="my-6 h-px bg-gray-4" />
+ <div class="flex flex-col items-center">
+ <Button
+ variant="destructive"
+ onClick={() => {
+ generalSettingsStore.set({
+ commercialLicense: undefined,
+ });
+ queryClient.refetchQueries({ queryKey: ["bruh"] });
+ }}
+ >
+ Deactivate License
+ </Button>
+ </div>
+ </div>
+ </div>
+ )}
+ </Match>
+ </Switch>
+ </div>
+ );
+}
+
+function LicenseKeyActivate(props: {
+ onActivated: (
+ value: ClientInferResponseBody<
+ (typeof licenseContract)["activateCommercialLicense"],
+ 200
+ > & { licenseKey: string }
+ ) => void;
+}) {
+ const [store] = createResource(() => generalSettingsStore.get());
+ const queryClient = useQueryClient();
+
+ return (
+ <Suspense>
+ <Show when={store()}>
+ {(generalSettings) => {
+ const [licenseKey, setLicenseKey] = createSignal("");
+
+ const activateLicenseKey = createMutation(() => ({
+ mutationFn: async (vars: { licenseKey: string }) => {
+ const resp = await licenseApiClient.activateCommercialLicense({
+ headers: {
+ licensekey: vars.licenseKey,
+ instanceid: generalSettings().instanceId!,
+ },
+ body: { reset: false },
+ });
+
+ if (resp.status === 200) return resp.body;
+ if (
+ typeof resp.body === "object" &&
+ resp.body &&
+ "message" in resp.body
+ )
+ throw resp.body.message;
+ throw new Error((resp.body as any).toString());
+ },
+ onSuccess: (value, { licenseKey }) => {
+ props.onActivated({ ...value, licenseKey });
+ queryClient.refetchQueries({ queryKey: ["bruh"] });
+ },
+ }));
+
+ return (
+ <div class="p-6 mx-auto w-full text-gray-12 rounded-xl border bg-gray-2 border-gray-3">
+ <div class="space-y-3">
+ <h3 class="mb-2 text-xl text-center">Have a license key?</h3>
+ <Input
+ placeholder="License key"
+ value={licenseKey()}
+ onInput={(e) => setLicenseKey(e.currentTarget.value)}
+ class="w-full bg-gray-3 border-gray-4"
+ />
+ <div class="flex justify-center mt-4">
+ <Button
+ variant="primary"
+ disabled={
+ activateLicenseKey.isPending || !licenseKey().trim()
+ }
+ onClick={() =>
+ activateLicenseKey.mutate({ licenseKey: licenseKey() })
+ }
+ >
+ {activateLicenseKey.isPending
+ ? "Activating..."
+ : "Activate License"}
+ </Button>
+ </div>
+ <Show when={activateLicenseKey.isError}>
+ <p class="mt-2 text-sm text-center text-red-500">
+ {String(activateLicenseKey.error)}
+ </p>
+ </Show>
+ </div>
+ </div>
+ );
+ }}
+ </Show>
+ </Suspense>
+ );
+}
+
+type CommercialLicenseType = "yearly" | "lifetime";
+function CommercialLicensePurchase() {
+ const queryClient = useQueryClient();
+
+ const [type, setType] = createSignal<CommercialLicenseType>("yearly");
+
+ const [isCommercialAnnual, setIsCommercialAnnual] = createSignal(true);
+
+ const { rive: CommercialRive, RiveComponent: Commercial } = createRive(
+ () => ({
+ src: PricingRive,
+ autoplay: true,
+ artboard: "commercial",
+ animations: ["card-stack"],
+ })
+ );
+
+ const openCommercialCheckout = createMutation(() => ({
+ mutationFn: async () => {
+ const resp = await licenseApiClient.createCommercialCheckoutUrl({
+ body: { type: isCommercialAnnual() ? "yearly" : "lifetime" },
+ });
+
+ if (resp.status === 200) {
+ commands.openExternalLink(resp.body.url);
+ }
+ },
+ }));
+
+ return (
+ <>
+ <div class="w-full max-w-[700px] rounded-xl shadow-sm bg-gray-2">
+ <div class="flex flex-col md:flex-row">
+ {/* Left Column */}
+ <div
+ onMouseEnter={() => {
+ const riveInstance = CommercialRive();
+ if (riveInstance) {
+ // Stop any current animations first
+ riveInstance.stop();
+ // Play the enter animation
+ riveInstance.play("cards");
+ }
+ }}
+ onMouseLeave={() => {
+ const riveInstance = CommercialRive();
+ if (riveInstance) {
+ // Stop any current animations first
+ riveInstance.stop();
+ // Play the leave animation
+ riveInstance.play("card-stack");
+ }
+ }}
+ class="flex flex-col gap-4 items-center p-5 rounded-t-xl border md:rounded-tr-none md:rounded-tl-xl md:rounded-bl-xl border-gray-4 md:w-1/2 bg-gray-3"
+ >
+ <Commercial class="w-[200px]" />
+ <div class="space-y-1 text-center">
+ <h3 class="text-2xl font-medium tracking-tight leading-5">
+ Commercial License
+ </h3>
+ <p class="mt-2 text-sm text-[--text-tertiary]">
+ For commercial use
+ </p>
+ </div>
+ <div class="flex flex-col justify-center items-center mt-5">
+ <h3 class="text-4xl leading-6">
+ {isCommercialAnnual() ? "$29" : "$58"}
+ <span class="text-gray-11 text-[16px]">.00 /</span>
+ </h3>
+ <p class="text-[16px] font-medium text-gray-11">
+ {isCommercialAnnual() ? "billed annually" : "one-time payment"}
+ </p>
+ </div>
+ <div
+ onClick={() => setIsCommercialAnnual((v) => !v)}
+ class="px-3 py-2 text-center rounded-full border border-transparent transition-all duration-200 cursor-pointer w-fit bg-gray-5 hover:border-gray-400"
+ >
+ <p class="text-xs text-gray-12">
+ Switch to {isCommercialAnnual() ? "lifetime" : "yearly"}:{" "}
+ <span class="font-medium">
+ {isCommercialAnnual() ? "$58" : "$29"}
+ </span>
+ </p>
+ </div>
+ <Button
+ onClick={() => openCommercialCheckout.mutate()}
+ disabled={openCommercialCheckout.isPending}
+ variant="lightdark"
+ class="w-full !rounded-full mt-10 !h-[48px] text-lg font-medium"
+ size="lg"
+ >
+ {openCommercialCheckout.isPending
+ ? "Loading..."
+ : "Purchase License"}
+ </Button>
+ </div>
+
+ {/* Right Column */}
+ <div class="flex flex-col gap-4 justify-center items-center p-5 rounded-t-none rounded-b-xl border border-t-0 md:border-t md:border-l-0 md:rounded-bl-none md:rounded-tr-xl md:rounded-br-xl md:w-1/2 border-gray-3">
+ <ul class="flex flex-col gap-2 list-none">
+ {[
+ "Commercial Use of Cap Recorder + Editor",
+ "Community Support",
+ "Local-only features",
+ "Perpetual license option",
+ ].map((feature) => (
+ <li class="flex justify-start items-center">
+ <div class="flex justify-center items-center p-0 m-0 w-6 h-6">
+ <IconLucideCheck class="w-4 h-4 text-[--text-primary]" />
+ </div>
+ <span class="ml-1 text-[0.9rem] text-[--text-primary]">
+ {feature}
+ </span>
+ </li>
+ ))}
+ </ul>
+ </div>
+ </div>
+ </div>
+
+ <LicenseKeyActivate
+ onActivated={async (value) => {
+ await generalSettingsStore.set({
+ commercialLicense: {
+ activatedOn: Date.now(),
+ expiryDate: value.expiryDate ?? null,
+ refresh: value.refresh,
+ licenseKey: value.licenseKey,
+ },
+ });
+ await queryClient.refetchQueries({ queryKey: ["bruh"] });
+ }}
+ />
+ </>
+ );
+}
diff --git a/apps/desktop/src/routes/(window-chrome)/upgrade.tsx b/apps/desktop/src/routes/(window-chrome)/upgrade.tsx
index 01a8f9339..178e105a2 100644
--- a/apps/desktop/src/routes/(window-chrome)/upgrade.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/upgrade.tsx
@@ -1,7 +1,7 @@
import { createRive } from "@aerofoil/rive-solid-canvas";
import { Button } from "@cap/ui-solid";
import { action, useAction } from "@solidjs/router";
-import { createMutation } from "@tanstack/solid-query";
+import { createMutation, useQueryClient } from "@tanstack/solid-query";
import { invoke } from "@tauri-apps/api/core";
import { listen } from "@tauri-apps/api/event";
import { getCurrentWindow, Window } from "@tauri-apps/api/window";
@@ -284,34 +284,32 @@ export default function Page() {
{!upgradeComplete() && (
<>
{license.data?.type === "commercial" ? (
- <div class="bg-[--gray-50] dark:bg-[--gray-900] rounded-xl shadow-sm border border-gray-3 dark:border-[--gray-700] w-full">
+ <div class="p-8 mx-auto w-full max-w-[700px] rounded-xl border shadow-sm bg-gray-2 border-gray-3">
<div class="space-y-6">
- <div class="border-b border-gray-3 dark:border-[--gray-700] pb-6">
- <h3 class="text-2xl font-semibold tracking-tight text-[--text-primary]">
- Your Commercial License
- </h3>
- <p class="mt-2 text-sm text-[--text-tertiary]">
- License details for Cap commercial use
+ <div class="flex flex-col items-center mb-6 text-center">
+ <h3 class="text-2xl font-medium">Commercial License</h3>
+ <p class="text-sm text-gray-11">
+ Your license details for Cap commercial use
</p>
</div>
<div class="space-y-6">
- <div class="space-y-2">
- <label class="text-sm font-medium text-[--text-primary]">
+ <div>
+ <label class="block mb-2 text-sm text-gray-12">
License Key
</label>
- <pre class="w-full p-3 bg-gray-1 rounded-lg border border-gray-3 dark:border-[--gray-700] font-mono text-sm text-[--text-secondary] break-all whitespace-pre-wrap">
+ <p class="overflow-x-auto p-3 font-mono text-xs whitespace-pre-wrap break-all rounded-lg border border-gray-4 text-gray-9 bg-gray-3">
{license.data.licenseKey}
- </pre>
+ </p>
</div>
<Show when={license.data.expiryDate}>
{(expiryDate) => (
- <div class="space-y-2">
- <label class="text-sm font-medium text-[--text-primary]">
- Expiration Date
+ <div class="space-y-1">
+ <label class="text-sm text-gray-12">
+ Expires
</label>
- <div class="w-full p-3 bg-gray-1 rounded-lg border border-gray-3 dark:border-[--gray-700] text-sm text-[--text-secondary]">
+ <p class="text-gray-10">
{new Date(expiryDate()).toLocaleDateString(
undefined,
{
@@ -320,27 +318,23 @@ export default function Page() {
day: "numeric",
}
)}
- </div>
+ </p>
</div>
)}
</Show>
- <div class="pt-4 border-t border-gray-3 dark:border-[--gray-700]">
+ <div class="flex flex-col items-center pt-6 border-t border-gray-3">
<Button
variant="destructive"
- class="mx-auto w-fit"
disabled={resetLicense.isPending}
onClick={() => {
resetLicense.mutate();
}}
>
{resetLicense.isPending
- ? "Detaching..."
- : "Detach License"}
+ ? "Deactivating..."
+ : "Deactivate License"}
</Button>
- <p class="mt-2 text-xs text-[--text-tertiary]">
- This will remove the license key from this device.
- </p>
</div>
</div>
</div>
@@ -555,6 +549,7 @@ interface Props {
const ActivateLicenseDialog = ({ open, onOpenChange }: Props) => {
const [licenseKey, setLicenseKey] = createSignal("");
+ const queryClient = useQueryClient();
const activateLicenseKey = createMutation(() => ({
mutationFn: async (vars: { licenseKey: string }) => {
@@ -585,6 +580,7 @@ const ActivateLicenseDialog = ({ open, onOpenChange }: Props) => {
licenseKey: value.licenseKey,
},
});
+ await queryClient.refetchQueries({ queryKey: ["bruh"] });
},
}));
return (
diff --git a/apps/desktop/src/routes/editor/ui.tsx b/apps/desktop/src/routes/editor/ui.tsx
index 003a90a71..e2fdc31d1 100644
--- a/apps/desktop/src/routes/editor/ui.tsx
+++ b/apps/desktop/src/routes/editor/ui.tsx
@@ -151,7 +151,7 @@ export function Input(props: ComponentProps<"input">) {
<TextInput
{...props}
class={cx(
- "rounded-[0.5rem] bg-gray-2 hover:ring-1 py-[18px] hover:ring-gray-3 h-[2rem] font-normal placeholder:text-black-transparent-40 text-xs caret-gray-500 transition-shadow duration-200 focus:ring-offset-1 focus:bg-gray-3 focus:ring-offset-gray-100 focus:ring-1 focus:ring-gray-500 px-[0.5rem] w-full text-[0.875rem] outline-none text-gray-12",
+ "rounded-[0.5rem] bg-gray-2 hover:ring-1 py-[18px] hover:ring-gray-5 h-[2rem] font-normal placeholder:text-black-transparent-40 text-xs caret-gray-500 transition-shadow duration-200 focus:ring-offset-1 focus:bg-gray-3 focus:ring-offset-gray-100 focus:ring-1 focus:ring-gray-10 px-[0.5rem] w-full text-[0.875rem] outline-none text-gray-12",
props.class
)}
/>