diff --git a/src/app/wrapped/wrapped.config.ts b/src/app/wrapped/wrapped.config.ts index 780567f8..bdadfb91 100644 --- a/src/app/wrapped/wrapped.config.ts +++ b/src/app/wrapped/wrapped.config.ts @@ -266,6 +266,18 @@ export const WRAPPED_DEFAULTS: WrappedSettings = { progress: "bars", }; +// --- Navbar promo button --------------------------------------------------- + +/** + * The navbar "Wrapped" button is shown until this moment (local time). + * After it passes the button disappears; the /wrapped page itself stays up. + */ +export const WRAPPED_PROMO_ENDS_AT = new Date("2026-08-01T00:00:00"); + +export function isWrappedPromoActive(now: Date = new Date()): boolean { + return now < WRAPPED_PROMO_ENDS_AT; +} + // --- Logo easter egg ------------------------------------------------------- /** Clicks on the logo (in a row) that trigger a random theme. */ diff --git a/src/components/navbar/mobile-menu.tsx b/src/components/navbar/mobile-menu.tsx index dc5c6d14..1aea0d3f 100644 --- a/src/components/navbar/mobile-menu.tsx +++ b/src/components/navbar/mobile-menu.tsx @@ -8,6 +8,7 @@ import { AuthButtons } from "./auth-buttons"; import { LogoutButton } from "./logout-button"; import { NavLinks } from "./nav-links"; import { NavbarActions } from "./navbar-actions"; +import { WrappedButton } from "./wrapped-button"; interface MobileMenuProps { onNavigate?: () => void; @@ -20,6 +21,7 @@ export function MobileMenu({ onNavigate }: MobileMenuProps) {
+ {isAuthenticated ? : null} diff --git a/src/components/navbar/wrapped-button.tsx b/src/components/navbar/wrapped-button.tsx new file mode 100644 index 00000000..269e4432 --- /dev/null +++ b/src/components/navbar/wrapped-button.tsx @@ -0,0 +1,43 @@ +"use client"; + +import { SparklesIcon } from "lucide-react"; +import { useContext } from "react"; + +import { AppContext } from "@/app-context"; +import { isWrappedPromoActive } from "@/app/wrapped/wrapped.config"; +import { ButtonLink } from "@/components/ui/button"; +import { PermissionAction } from "@/lib/auth/permissions"; + +interface WrappedButtonProps { + onNavigate?: () => void; +} + +export function WrappedButton({ onNavigate }: WrappedButtonProps) { + const { checkPermission } = useContext(AppContext); + + if ( + !isWrappedPromoActive() || + !checkPermission(PermissionAction.VIEW_WRAPPED) + ) { + return null; + } + + return ( + + + + + Wrapped + + ); +}