mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-11 23:04:59 +00:00
Dont show the link if not the org owner
This commit is contained in:
@@ -129,9 +129,7 @@ export function LayoutSidebar({
|
|||||||
user.serverAdmin || Boolean(currentOrg?.isOwner || currentOrg?.isAdmin);
|
user.serverAdmin || Boolean(currentOrg?.isOwner || currentOrg?.isAdmin);
|
||||||
|
|
||||||
const showTrial =
|
const showTrial =
|
||||||
build === "saas" &&
|
build === "saas" && Boolean(orgId) && subscriptionContext?.isTrial;
|
||||||
Boolean(orgId) &&
|
|
||||||
subscriptionContext?.isTrial;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -240,11 +238,16 @@ export function LayoutSidebar({
|
|||||||
<div className="px-4">
|
<div className="px-4">
|
||||||
<ProductUpdates isCollapsed={isSidebarCollapsed} />
|
<ProductUpdates isCollapsed={isSidebarCollapsed} />
|
||||||
</div>
|
</div>
|
||||||
) : <div className="mt-0.2"></div>}
|
) : (
|
||||||
|
<div className="mt-0.2"></div>
|
||||||
|
)}
|
||||||
|
|
||||||
{showTrial && (
|
{showTrial && (
|
||||||
<div className="px-4">
|
<div className="px-4">
|
||||||
<ShowTrialCard isCollapsed={isSidebarCollapsed} />
|
<ShowTrialCard
|
||||||
|
isCollapsed={isSidebarCollapsed}
|
||||||
|
isOwner={Boolean(currentOrg?.isOwner)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,11 @@ import { useTranslations } from "next-intl";
|
|||||||
const TRIAL_DURATION_DAYS = 10;
|
const TRIAL_DURATION_DAYS = 10;
|
||||||
|
|
||||||
export default function ShowTrialCard({
|
export default function ShowTrialCard({
|
||||||
isCollapsed
|
isCollapsed,
|
||||||
|
isOwner = false
|
||||||
}: {
|
}: {
|
||||||
isCollapsed?: boolean;
|
isCollapsed?: boolean;
|
||||||
|
isOwner?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const context = useSubscriptionStatusContext();
|
const context = useSubscriptionStatusContext();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
@@ -47,16 +49,13 @@ export default function ShowTrialCard({
|
|||||||
const billingHref = orgId ? `/${orgId}/settings/billing` : "/";
|
const billingHref = orgId ? `/${orgId}/settings/billing` : "/";
|
||||||
|
|
||||||
if (isCollapsed) {
|
if (isCollapsed) {
|
||||||
return (
|
const icon = (
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Link
|
<span className="flex items-center justify-center rounded-md p-2 text-muted-foreground">
|
||||||
href={billingHref}
|
|
||||||
className="flex items-center justify-center rounded-md p-2 text-muted-foreground"
|
|
||||||
>
|
|
||||||
<ClockIcon className="h-4 w-4 flex-none" />
|
<ClockIcon className="h-4 w-4 flex-none" />
|
||||||
</Link>
|
</span>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent side="right" sideOffset={8}>
|
<TooltipContent side="right" sideOffset={8}>
|
||||||
<p>
|
<p>
|
||||||
@@ -70,16 +69,16 @@ export default function ShowTrialCard({
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (isOwner) {
|
||||||
|
return <Link href={billingHref}>{icon}</Link>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
const cardContent = (
|
||||||
<Link
|
<>
|
||||||
href={billingHref}
|
|
||||||
className={cn(
|
|
||||||
"group cursor-pointer block",
|
|
||||||
"rounded-md border bg-secondary p-2 py-3 w-full flex flex-col gap-2 text-sm"
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<ClockIcon className="flex-none size-4 text-muted-foreground" />
|
<ClockIcon className="flex-none size-4 text-muted-foreground" />
|
||||||
<p className="font-medium flex-1 leading-tight">
|
<p className="font-medium flex-1 leading-tight">
|
||||||
@@ -93,11 +92,37 @@ export default function ShowTrialCard({
|
|||||||
? t("trialHasEnded")
|
? t("trialHasEnded")
|
||||||
: t("trialDaysRemaining", { count: remainingDays })}
|
: t("trialDaysRemaining", { count: remainingDays })}
|
||||||
</small>
|
</small>
|
||||||
<div className="inline-flex items-center gap-1 text-xs text-muted-foreground">
|
{isOwner && (
|
||||||
<span>{t("trialGoToBilling")}</span>
|
<div className="inline-flex items-center gap-1 text-xs text-muted-foreground">
|
||||||
<ArrowRight className="flex-none size-3" />
|
<span>{t("trialGoToBilling")}</span>
|
||||||
</div>
|
<ArrowRight className="flex-none size-3" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isOwner) {
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
href={billingHref}
|
||||||
|
className={cn(
|
||||||
|
"group cursor-pointer block",
|
||||||
|
"rounded-md border bg-secondary p-2 py-3 w-full flex flex-col gap-2 text-sm"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{cardContent}
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
"rounded-md border bg-secondary p-2 py-3 w-full flex flex-col gap-2 text-sm"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{cardContent}
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user