Adjust functioning of ee button

This commit is contained in:
Owen
2026-04-13 10:44:19 -07:00
parent 34cc2e0ed1
commit 1e77ead488
18 changed files with 2510 additions and 2395 deletions

View File

@@ -42,7 +42,9 @@ import {
SettingsSectionFooter
} from "@app/components/Settings";
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
import { Check, Heart, InfoIcon } from "lucide-react";
import { ArrowRight, Check, ExternalLink, Heart, InfoIcon, TicketCheck } from "lucide-react";
import Link from "next/link";
import DismissableBanner from "@app/components/DismissableBanner";
import CopyTextBox from "@app/components/CopyTextBox";
import ConfirmDeleteDialog from "@app/components/ConfirmDeleteDialog";
import { SitePriceCalculator } from "@app/components/SitePriceCalculator";
@@ -51,6 +53,10 @@ import { Alert, AlertDescription, AlertTitle } from "@app/components/ui/alert";
import { useSupporterStatusContext } from "@app/hooks/useSupporterStatusContext";
import { useTranslations } from "next-intl";
const ENTERPRISE_DOCS_URL =
"https://docs.pangolin.net/self-host/enterprise-edition";
const ENTERPRISE_PRICING_URL = "https://pangolin.net/pricing#Self-Hosted";
function obfuscateLicenseKey(key: string): string {
if (key.length <= 8) return key;
const firstPart = key.substring(0, 4);
@@ -336,6 +342,47 @@ export default function LicensePage() {
description={t("licenseTitleDescription")}
/>
{!licenseStatus?.isLicenseValid && (
<DismissableBanner
storageKey="license-banner-dismissed"
version={1}
title={t("licenseBannerTitle")}
titleIcon={
<TicketCheck className="w-5 h-5 text-primary" />
}
description={t("licenseBannerDescription")}
>
<Link
href={ENTERPRISE_PRICING_URL}
target="_blank"
rel="noopener noreferrer"
>
<Button
variant="default"
size="sm"
className="gap-2"
>
{t("licenseBannerGetLicense")}
<ArrowRight className="w-4 h-4" />
</Button>
</Link>
<Link
href={ENTERPRISE_DOCS_URL}
target="_blank"
rel="noopener noreferrer"
>
<Button
variant="outline"
size="sm"
className="gap-2 hover:bg-primary/10 hover:border-primary/50 transition-colors"
>
{t("licenseBannerViewDocs")}
<ExternalLink className="w-4 h-4" />
</Button>
</Link>
</DismissableBanner>
)}
{/* <Alert variant="neutral" className="mb-6"> */}
{/* <InfoIcon className="h-4 w-4" /> */}
{/* <AlertTitle className="font-semibold"> */}

View File

@@ -10,6 +10,7 @@ import { Button } from "./ui/button";
import { TicketCheck } from "lucide-react";
import { useTranslations } from "next-intl";
import { useLicenseStatusContext } from "@app/hooks/useLicenseStatusContext";
import { useUserContext } from "@app/hooks/useUserContext";
import Link from "next/link";
interface SidebarLicenseButtonProps {
@@ -20,8 +21,11 @@ export default function SidebarLicenseButton({
isCollapsed = false
}: SidebarLicenseButtonProps) {
const { licenseStatus, updateLicenseStatus } = useLicenseStatusContext();
const { user } = useUserContext();
const url = "https://docs.pangolin.net/self-host/enterprise-edition";
const url = user?.serverAdmin
? "/admin/license"
: "https://docs.pangolin.net/self-host/enterprise-edition";
const t = useTranslations();