34 lines
866 B
TypeScript
34 lines
866 B
TypeScript
import Link from "next/link";
|
|
import type { ReactNode } from "react";
|
|
import { UPGRADE_URL } from "@/lib/plans";
|
|
|
|
const PRO_UPGRADE_SUFFIX = " Upload up to 50 videos with Pro!";
|
|
|
|
type Props = {
|
|
className?: string;
|
|
children?: ReactNode;
|
|
};
|
|
|
|
export function UpgradeProLink({ className = "text-accent hover:underline", children }: Props) {
|
|
return (
|
|
<Link href={UPGRADE_URL} className={className}>
|
|
{children ?? "Upgrade to Pro"}
|
|
</Link>
|
|
);
|
|
}
|
|
|
|
export function QuotaErrorMessage({ message }: { message: string }) {
|
|
if (message.endsWith(PRO_UPGRADE_SUFFIX)) {
|
|
return (
|
|
<>
|
|
{message.slice(0, -PRO_UPGRADE_SUFFIX.length)}{" "}
|
|
<UpgradeProLink className="font-medium text-red-200 underline hover:text-white">
|
|
Upload up to 50 videos with Pro!
|
|
</UpgradeProLink>
|
|
</>
|
|
);
|
|
}
|
|
|
|
return <>{message}</>;
|
|
}
|