mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-15 05:45:20 +00:00
add trial duration indicator to nav bar
This commit is contained in:
parent
e2c90b8fcc
commit
8929d05b88
1 changed files with 17 additions and 3 deletions
|
|
@ -9,7 +9,8 @@ import { SettingsDropdown } from "./settingsDropdown";
|
||||||
import { GitHubLogoIcon, DiscordLogoIcon } from "@radix-ui/react-icons";
|
import { GitHubLogoIcon, DiscordLogoIcon } from "@radix-ui/react-icons";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { OrgSelector } from "./orgSelector";
|
import { OrgSelector } from "./orgSelector";
|
||||||
|
import { getSubscriptionData } from "@/actions";
|
||||||
|
import { isServiceError } from "@/lib/utils";
|
||||||
const SOURCEBOT_DISCORD_URL = "https://discord.gg/6Fhp27x7Pb";
|
const SOURCEBOT_DISCORD_URL = "https://discord.gg/6Fhp27x7Pb";
|
||||||
const SOURCEBOT_GITHUB_URL = "https://github.com/sourcebot-dev/sourcebot";
|
const SOURCEBOT_GITHUB_URL = "https://github.com/sourcebot-dev/sourcebot";
|
||||||
|
|
||||||
|
|
@ -20,6 +21,8 @@ interface NavigationMenuProps {
|
||||||
export const NavigationMenu = async ({
|
export const NavigationMenu = async ({
|
||||||
domain,
|
domain,
|
||||||
}: NavigationMenuProps) => {
|
}: NavigationMenuProps) => {
|
||||||
|
const subscription = await getSubscriptionData(domain);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col w-screen h-fit">
|
<div className="flex flex-col w-screen h-fit">
|
||||||
<div className="flex flex-row justify-between items-center py-1.5 px-3">
|
<div className="flex flex-row justify-between items-center py-1.5 px-3">
|
||||||
|
|
@ -66,14 +69,14 @@ export const NavigationMenu = async ({
|
||||||
<NavigationMenuItem>
|
<NavigationMenuItem>
|
||||||
<Link href={`/${domain}/secrets`} legacyBehavior passHref>
|
<Link href={`/${domain}/secrets`} legacyBehavior passHref>
|
||||||
<NavigationMenuLink className={navigationMenuTriggerStyle()}>
|
<NavigationMenuLink className={navigationMenuTriggerStyle()}>
|
||||||
Secrets
|
Secrets
|
||||||
</NavigationMenuLink>
|
</NavigationMenuLink>
|
||||||
</Link>
|
</Link>
|
||||||
</NavigationMenuItem>
|
</NavigationMenuItem>
|
||||||
<NavigationMenuItem>
|
<NavigationMenuItem>
|
||||||
<Link href={`/${domain}/connections`} legacyBehavior passHref>
|
<Link href={`/${domain}/connections`} legacyBehavior passHref>
|
||||||
<NavigationMenuLink className={navigationMenuTriggerStyle()}>
|
<NavigationMenuLink className={navigationMenuTriggerStyle()}>
|
||||||
Connections
|
Connections
|
||||||
</NavigationMenuLink>
|
</NavigationMenuLink>
|
||||||
</Link>
|
</Link>
|
||||||
</NavigationMenuItem>
|
</NavigationMenuItem>
|
||||||
|
|
@ -89,6 +92,17 @@ export const NavigationMenu = async ({
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-row items-center gap-2">
|
<div className="flex flex-row items-center gap-2">
|
||||||
|
{!isServiceError(subscription) && subscription.status === "trialing" && (
|
||||||
|
<Link href={`/${domain}/settings/billing`}>
|
||||||
|
<div className="flex items-center gap-2 px-3 py-1.5 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-700 rounded-full text-yellow-700 dark:text-yellow-400 text-xs font-medium hover:bg-yellow-100 dark:hover:bg-yellow-900/30 transition-colors cursor-pointer">
|
||||||
|
<span className="inline-block w-2 h-2 bg-yellow-400 dark:bg-yellow-500 rounded-full"></span>
|
||||||
|
<span>
|
||||||
|
{Math.ceil((subscription.nextBillingDate * 1000 - Date.now()) / (1000 * 60 * 60 * 24))} days left in
|
||||||
|
trial
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
<form
|
<form
|
||||||
action={async () => {
|
action={async () => {
|
||||||
"use server";
|
"use server";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue