Unverified 提交 92b65741 authored 作者: Will Chen's avatar Will Chen 提交者: GitHub

add buttons for dyad pro (#1494)

<!-- This is an auto-generated description by cubic. --> ## Summary by cubic Added Dyad Pro access buttons in ProBanner to manage a subscription or add an existing key. Show the manage button when Dyad Pro is enabled or a user budget exists; otherwise show the setup button, both linking to academy.dyad.sh. <!-- End of auto-generated description by cubic. -->
上级 2def841f
......@@ -6,9 +6,11 @@ import googleLogo from "../../assets/ai-logos/google-logo.svg";
import anthropicLogo from "../../assets/ai-logos/anthropic-logo.svg";
import { IpcClient } from "@/ipc/ipc_client";
import { useState } from "react";
import { KeyRound } from "lucide-react";
import { useSettings } from "@/hooks/useSettings";
import { useUserBudgetInfo } from "@/hooks/useUserBudgetInfo";
import { Button } from "./ui/button";
export function ProBanner() {
const { settings } = useSettings();
......@@ -20,7 +22,11 @@ export function ProBanner() {
});
if (settings?.enableDyadPro || userBudget) {
return null;
return (
<div className="mt-6 max-w-2xl mx-auto">
<ManageDyadProButton />
</div>
);
}
return (
......@@ -32,10 +38,47 @@ export function ProBanner() {
) : (
<TurboBanner />
)}
<SetupDyadProButton />
</div>
);
}
export function ManageDyadProButton() {
return (
<Button
variant="outline"
size="lg"
className="w-full mt-4 bg-(--background-lighter) text-primary"
onClick={() => {
IpcClient.getInstance().openExternalUrl(
"https://academy.dyad.sh/subscription",
);
}}
>
<KeyRound aria-hidden="true" />
Manage Dyad Pro subscription
</Button>
);
}
export function SetupDyadProButton() {
return (
<Button
variant="outline"
size="lg"
className="w-full mt-4 bg-(--background-lighter) text-primary"
onClick={() => {
IpcClient.getInstance().openExternalUrl(
"https://academy.dyad.sh/settings",
);
}}
>
<KeyRound aria-hidden="true" />
Already have Dyad Pro? Add your key
</Button>
);
}
export function AiAccessBanner() {
return (
<div
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论