diff --git a/monkeyai/web/src/components/paid-license-card.tsx b/monkeyai/web/src/components/paid-license-card.tsx index be7b399e..ea43e782 100644 --- a/monkeyai/web/src/components/paid-license-card.tsx +++ b/monkeyai/web/src/components/paid-license-card.tsx @@ -1,4 +1,10 @@ -import { useCallback, useEffect, useState, type FormEvent } from "react" +import { + useCallback, + useEffect, + useState, + type FormEvent, + type ReactNode, +} from "react" import { Loading03Icon } from "@hugeicons/core-free-icons" import { HugeiconsIcon } from "@hugeicons/react" import { useTranslation } from "react-i18next" @@ -22,14 +28,6 @@ import { DialogTitle, DialogTrigger, } from "@/components/ui/dialog" -import { - Item, - ItemActions, - ItemContent, - ItemDescription, - ItemGroup, - ItemTitle, -} from "@/components/ui/item" import { api } from "@/lib/api" import { publishLicenseStatus, type LicenseInfo } from "@/lib/license" import { cn } from "@/lib/utils" @@ -38,6 +36,25 @@ type MachineCodeResponse = { machine_code: string } +function LicenseRow({ + label, + children, + valueClassName, +}: { + label: string + children: ReactNode + valueClassName?: string +}) { + return ( +
+
{label}
+
+ {children} +
+
+ ) +} + function formatDate(value: number | undefined, locale: string) { if (value == null) return "—" const date = new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format( @@ -109,21 +126,6 @@ export function PaidLicenseCard({ className }: { className?: string }) { } } - async function copyMachineCode() { - try { - await navigator.clipboard.writeText(machineCode) - showToast({ - status: "success", - title: t("pages.license.machineCodeCopied"), - }) - } catch { - showToast({ - status: "error", - title: t("pages.license.copyFailed"), - }) - } - } - const unavailable = info?.state === "invalid" const expired = info?.state === "expired" const dangerClassName = "text-red-600 dark:text-red-400" @@ -201,110 +203,65 @@ export function PaidLicenseCard({ className }: { className?: string }) { {t("pages.license.loading")}

)} - - {info !== null && ( - <> - - - - {t("licenseCapabilities.cloudComputer")} - - - {t( - info.state === "valid" && - info.allow_cloud_computer === true - ? "licenseCapabilities.granted" - : "licenseCapabilities.notGranted" - )} - - - - - - - {t("licenseCapabilities.customBranding")} - - - {t( - info.state === "valid" && - info.allow_custom_branding === true - ? "licenseCapabilities.granted" - : "licenseCapabilities.notGranted" - )} - - - - - )} +
{info !== null && info.state !== "missing" && ( <> - - - {t("pages.license.seats")} - - {unavailable - ? t("pages.license.unavailable") - : info.max_members == null - ? "—" - : t("pages.license.seatsAllowed", { - count: info.max_members, - })} - - - - - - {t("pages.license.client")} - - {unavailable - ? t("pages.license.unavailable") - : info.client_name || info.client_id || "—"} - - - - - - {t("pages.license.validityPeriod")} - - {unavailable - ? t("pages.license.unavailable") - : `${formatDate(info.not_valid_before, i18n.language)} - ${formatDate(info.not_valid_after, i18n.language)}`} - - - + + {unavailable + ? t("pages.license.unavailable") + : info.client_name || info.client_id || "—"} + + + {unavailable + ? t("pages.license.unavailable") + : `${formatDate(info.not_valid_before, i18n.language)} - ${formatDate(info.not_valid_after, i18n.language)}`} + + + {unavailable + ? t("pages.license.unavailable") + : info.max_members == null + ? "—" + : t("pages.license.seatsAllowed", { + count: info.max_members, + })} + )} - - - {t("pages.license.machineTitle")} - - {machineCode || "—"} - - - - - - - + {info !== null && ( + <> + + {t( + info.state === "valid" && info.allow_cloud_computer === true + ? "licenseCapabilities.granted" + : "licenseCapabilities.notGranted" + )} + + + {t( + info.state === "valid" && info.allow_custom_branding === true + ? "licenseCapabilities.granted" + : "licenseCapabilities.notGranted" + )} + + + )} + + + {machineCode || "—"} + + +
) diff --git a/monkeyai/web/src/i18n/locales/ar.ts b/monkeyai/web/src/i18n/locales/ar.ts index 8f8163b8..489b3a2b 100644 --- a/monkeyai/web/src/i18n/locales/ar.ts +++ b/monkeyai/web/src/i18n/locales/ar.ts @@ -2,10 +2,10 @@ import { enUS } from "./en-US.ts" export const ar = { licenseCapabilities: { - cloudComputer: "أجهزة الكمبيوتر السحابية", - customBranding: "تخصيص العلامة التجارية", - granted: "متاح", - notGranted: "غير متاح", + cloudComputer: "وضع الكمبيوتر السحابي", + customBranding: "تطبيق عميل مخصص", + granted: "مدعوم", + notGranted: "غير مدعوم", cloudLocked: "إنشاء أجهزة كمبيوتر سحابية غير متاح حاليًا.", brandingLocked: "تخصيص العلامة التجارية غير متاح حاليًا.", }, diff --git a/monkeyai/web/src/i18n/locales/de-DE.ts b/monkeyai/web/src/i18n/locales/de-DE.ts index 803d77c3..c4f6b47f 100644 --- a/monkeyai/web/src/i18n/locales/de-DE.ts +++ b/monkeyai/web/src/i18n/locales/de-DE.ts @@ -2,10 +2,10 @@ import { enUS } from "./en-US.ts" export const deDE = { licenseCapabilities: { - cloudComputer: "Cloud-Computer", - customBranding: "Eigenes Branding", - granted: "Verfügbar", - notGranted: "Nicht verfügbar", + cloudComputer: "Cloud-Computer-Modus", + customBranding: "Angepasster Client", + granted: "Unterstützt", + notGranted: "Nicht unterstützt", cloudLocked: "Derzeit können keine Cloud-Computer erstellt werden.", brandingLocked: "Eigenes Branding ist derzeit nicht verfügbar.", }, diff --git a/monkeyai/web/src/i18n/locales/en-US.ts b/monkeyai/web/src/i18n/locales/en-US.ts index 2c75a1fd..7aebf6be 100644 --- a/monkeyai/web/src/i18n/locales/en-US.ts +++ b/monkeyai/web/src/i18n/locales/en-US.ts @@ -1,9 +1,9 @@ export const enUS = { licenseCapabilities: { - cloudComputer: "Cloud computers", - customBranding: "Custom branding", - granted: "Available", - notGranted: "Unavailable", + cloudComputer: "Cloud computer mode", + customBranding: "Customized client", + granted: "Supported", + notGranted: "Not supported", cloudLocked: "Creating cloud computers is currently unavailable.", brandingLocked: "Custom branding is currently unavailable.", }, diff --git a/monkeyai/web/src/i18n/locales/es-419.ts b/monkeyai/web/src/i18n/locales/es-419.ts index c48fc599..5cd1f091 100644 --- a/monkeyai/web/src/i18n/locales/es-419.ts +++ b/monkeyai/web/src/i18n/locales/es-419.ts @@ -2,10 +2,10 @@ import { enUS } from "./en-US.ts" export const es419 = { licenseCapabilities: { - cloudComputer: "Computadoras en la nube", - customBranding: "Marca personalizada", - granted: "Disponible", - notGranted: "No disponible", + cloudComputer: "Modo de computadora en la nube", + customBranding: "Cliente personalizado", + granted: "Compatible", + notGranted: "No compatible", cloudLocked: "Por ahora no se pueden crear computadoras en la nube.", brandingLocked: "La personalización de la marca no está disponible.", }, diff --git a/monkeyai/web/src/i18n/locales/fr-FR.ts b/monkeyai/web/src/i18n/locales/fr-FR.ts index bec35224..417e3b1e 100644 --- a/monkeyai/web/src/i18n/locales/fr-FR.ts +++ b/monkeyai/web/src/i18n/locales/fr-FR.ts @@ -2,10 +2,10 @@ import { enUS } from "./en-US.ts" export const frFR = { licenseCapabilities: { - cloudComputer: "Ordinateurs cloud", - customBranding: "Personnalisation de la marque", - granted: "Disponible", - notGranted: "Indisponible", + cloudComputer: "Mode ordinateur cloud", + customBranding: "Client personnalisé", + granted: "Pris en charge", + notGranted: "Non pris en charge", cloudLocked: "La création d’ordinateurs cloud est actuellement indisponible.", brandingLocked: "La personnalisation de la marque est actuellement indisponible.", }, diff --git a/monkeyai/web/src/i18n/locales/ja-JP.ts b/monkeyai/web/src/i18n/locales/ja-JP.ts index 3493cc8b..502bdaae 100644 --- a/monkeyai/web/src/i18n/locales/ja-JP.ts +++ b/monkeyai/web/src/i18n/locales/ja-JP.ts @@ -2,10 +2,10 @@ import { enUS } from "./en-US.ts" export const jaJP = { licenseCapabilities: { - cloudComputer: "クラウド PC", - customBranding: "ブランドのカスタマイズ", - granted: "利用可能", - notGranted: "利用不可", + cloudComputer: "クラウド PC モード", + customBranding: "カスタムクライアント", + granted: "対応", + notGranted: "非対応", cloudLocked: "現在、クラウド PC は作成できません。", brandingLocked: "現在、ブランドをカスタマイズできません。", }, diff --git a/monkeyai/web/src/i18n/locales/ko-KR.ts b/monkeyai/web/src/i18n/locales/ko-KR.ts index ab925d4a..dca2c180 100644 --- a/monkeyai/web/src/i18n/locales/ko-KR.ts +++ b/monkeyai/web/src/i18n/locales/ko-KR.ts @@ -2,10 +2,10 @@ import { enUS } from "./en-US.ts" export const koKR = { licenseCapabilities: { - cloudComputer: "클라우드 컴퓨터", - customBranding: "사용자 지정 브랜드", - granted: "사용 가능", - notGranted: "사용 불가", + cloudComputer: "클라우드 컴퓨터 모드", + customBranding: "맞춤형 클라이언트", + granted: "지원", + notGranted: "미지원", cloudLocked: "현재 새 클라우드 컴퓨터를 만들 수 없습니다.", brandingLocked: "현재 브랜드를 변경할 수 없습니다.", }, diff --git a/monkeyai/web/src/i18n/locales/ru-RU.ts b/monkeyai/web/src/i18n/locales/ru-RU.ts index a33cf5bc..7ba6d42b 100644 --- a/monkeyai/web/src/i18n/locales/ru-RU.ts +++ b/monkeyai/web/src/i18n/locales/ru-RU.ts @@ -2,10 +2,10 @@ import { enUS } from "./en-US.ts" export const ruRU = { licenseCapabilities: { - cloudComputer: "Облачные компьютеры", - customBranding: "Настройка бренда", - granted: "Доступно", - notGranted: "Недоступно", + cloudComputer: "Режим облачного компьютера", + customBranding: "Индивидуальная версия клиента", + granted: "Поддерживается", + notGranted: "Не поддерживается", cloudLocked: "Создание облачных компьютеров сейчас недоступно.", brandingLocked: "Настройка бренда сейчас недоступна.", }, diff --git a/monkeyai/web/src/i18n/locales/zh-CN.ts b/monkeyai/web/src/i18n/locales/zh-CN.ts index 1b1af02b..c8001688 100644 --- a/monkeyai/web/src/i18n/locales/zh-CN.ts +++ b/monkeyai/web/src/i18n/locales/zh-CN.ts @@ -1,9 +1,9 @@ export const zhCN = { licenseCapabilities: { - cloudComputer: "云电脑", - customBranding: "自定义品牌", - granted: "可用", - notGranted: "不可用", + cloudComputer: "云电脑模式", + customBranding: "定制客户端", + granted: "支持", + notGranted: "不支持", cloudLocked: "当前无法新建云电脑。", brandingLocked: "当前无法编辑自定义品牌。", }, @@ -1027,7 +1027,7 @@ export const zhCN = { title: "付费授权", description: "用于查看和管理付费授权", seats: "授权席位", - seatsAllowed: "允许最多 {{count}} 个用户使用", + seatsAllowed: "最多允许 {{count}} 个成员使用", unavailable: "授权不可用", client: "授权客户", validityPeriod: "授权时间", diff --git a/monkeyai/web/src/i18n/locales/zh-TW.ts b/monkeyai/web/src/i18n/locales/zh-TW.ts index 3af8b922..eb2deee4 100644 --- a/monkeyai/web/src/i18n/locales/zh-TW.ts +++ b/monkeyai/web/src/i18n/locales/zh-TW.ts @@ -2,10 +2,10 @@ import { enUS } from "./en-US.ts" export const zhTW = { licenseCapabilities: { - cloudComputer: "雲端電腦", - customBranding: "自訂品牌", - granted: "可用", - notGranted: "無法使用", + cloudComputer: "雲端電腦模式", + customBranding: "客製化用戶端", + granted: "支援", + notGranted: "不支援", cloudLocked: "目前無法建立雲端電腦。", brandingLocked: "目前無法編輯自訂品牌。", },