📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
blackfriday sale banner
Blue Mousefe837d9c7aff
diff --git a/web/app/components/Header/index.tsx b/web/app/components/Header/index.tsxindex a0f7fb553..7fe1725de 100644--- a/web/app/components/Header/index.tsx+++ b/web/app/components/Header/index.tsx@@ -26,7 +26,7 @@ import { type t as i18nextT } from 'i18next'import _map from 'lodash/map'import _startsWith from 'lodash/startsWith'import { GaugeIcon, ChartPieIcon, BugIcon, PuzzleIcon, PhoneIcon } from 'lucide-react'-import { memo, Fragment, useMemo, useState } from 'react'+import { memo, Fragment, useMemo, useState, useEffect } from 'react'import { useTranslation } from 'react-i18next'import { Link } from 'react-router'@@ -414,7 +414,20 @@ const TrialBanner = () => {return [TRIAL_STATUS_MAPPING.ENDS_IN_X_DAYS, t('header.trialBanner.youHaveXDaysLeft', { amount })]}, [user, t])- if (!status || isSelfhosted || !isAuthenticated || !['none', 'trial'].includes(user?.planCode || '')) {+ const blackFridayBannerVisible = useMemo(() => {+ const now = dayjs.utc()+ const diff = BLACK_FRIDAY_END.diff(now)++ return diff > 0+ }, [])++ if (+ !status ||+ isSelfhosted ||+ !isAuthenticated ||+ !['none', 'trial'].includes(user?.planCode || '') ||+ blackFridayBannerVisible+ ) {return null}@@ -436,6 +449,125 @@ const TrialBanner = () => {)}+const BLACK_FRIDAY_END = dayjs.utc('2025-12-03T00:00:00')++const BlackFridayBanner = () => {+ const { user, isAuthenticated } = useAuth()+ const [timeLeft, setTimeLeft] = useState<{+ days: number+ hours: number+ minutes: number+ seconds: number+ } | null>(null)++ useEffect(() => {+ const calculateTimeLeft = () => {+ const now = dayjs.utc()+ const diff = BLACK_FRIDAY_END.diff(now)++ if (diff <= 0) {+ setTimeLeft(null)+ return+ }++ const duration = dayjs.duration(diff)+ setTimeLeft({+ days: Math.floor(duration.asDays()),+ hours: duration.hours(),+ minutes: duration.minutes(),+ seconds: duration.seconds(),+ })+ }++ calculateTimeLeft()+ const interval = setInterval(calculateTimeLeft, 1000)++ return () => clearInterval(interval)+ }, [])++ const shouldShow = useMemo(() => {+ if (isSelfhosted) return false+ if (!timeLeft) return false++ if (!isAuthenticated) return true++ const eligiblePlans = ['free', 'none', 'trial']+ return eligiblePlans.includes(user?.planCode || '')+ }, [isAuthenticated, user, timeLeft])++ if (!shouldShow || !timeLeft) return null++ return (+ <div className='relative w-full overflow-hidden bg-gradient-to-r from-slate-950 via-purple-950 to-slate-950'>+ <div className='absolute inset-0 overflow-hidden'>+ <div className='absolute top-1 left-[10%] h-1 w-1 animate-pulse rounded-full bg-yellow-400/60' />+ <div className='absolute top-3 left-[25%] h-0.5 w-0.5 animate-pulse rounded-full bg-amber-300/50 [animation-delay:200ms]' />+ <div className='absolute top-1 left-[50%] h-1 w-1 animate-pulse rounded-full bg-orange-400/60 [animation-delay:400ms]' />+ <div className='absolute top-2 left-[75%] h-0.5 w-0.5 animate-pulse rounded-full bg-yellow-300/50 [animation-delay:600ms]' />+ <div className='absolute top-1 left-[90%] h-1 w-1 animate-pulse rounded-full bg-amber-400/60 [animation-delay:800ms]' />+ </div>++ <div className='relative mx-auto max-w-7xl px-4 py-2 sm:px-6 lg:px-8'>+ <div className='flex flex-col items-center justify-center gap-2 sm:flex-row sm:gap-6'>+ <div className='flex items-center gap-2'>+ <span className='bg-gradient-to-r from-amber-400 via-orange-400 to-red-500 bg-clip-text text-base font-black tracking-tight text-transparent sm:text-lg'>+ ⚡ BLACK FRIDAY SALE ⚡+ </span>+ </div>++ <div className='flex items-center gap-2 text-sm text-white/90'>+ <span>Get</span>+ <span className='rounded-md bg-gradient-to-r from-amber-500 to-orange-500 px-2 py-0.5 text-sm font-bold text-white shadow-lg shadow-orange-500/25'>+ 50% OFF+ </span>+ <span>your first month</span>+ </div>++ <div className='flex items-center gap-2 text-sm'>+ <span className='text-white/70'>Code:</span>+ <code className='rounded border border-amber-500/30 bg-black/40 px-2 py-0.5 font-mono font-bold text-amber-400'>+ BLACKFRIDAY+ </code>+ </div>++ <div className='flex items-center gap-2'>+ <span className='text-xs text-white/60'>Ends in:</span>+ <div className='flex items-center gap-1 font-mono text-sm font-bold'>+ <span className='rounded bg-white/10 px-1.5 py-0.5 text-white'>+ {String(timeLeft.days).padStart(2, '0')}+ <span className='text-xs text-white/60'>d</span>+ </span>+ <span className='text-white/40'>:</span>+ <span className='rounded bg-white/10 px-1.5 py-0.5 text-white'>+ {String(timeLeft.hours).padStart(2, '0')}+ <span className='text-xs text-white/60'>h</span>+ </span>+ <span className='text-white/40'>:</span>+ <span className='rounded bg-white/10 px-1.5 py-0.5 text-white'>+ {String(timeLeft.minutes).padStart(2, '0')}+ <span className='text-xs text-white/60'>m</span>+ </span>+ <span className='text-white/40'>:</span>+ <span className='rounded bg-white/10 px-1.5 py-0.5 text-white'>+ {String(timeLeft.seconds).padStart(2, '0')}+ <span className='text-xs text-white/60'>s</span>+ </span>+ </div>+ </div>++ <Link+ to={routes.billing}+ className='group ml-2 hidden items-center gap-1 rounded-full bg-gradient-to-r from-amber-500 to-orange-500 px-4 py-1.5 text-sm font-semibold text-white shadow-lg shadow-orange-500/25 transition-all hover:shadow-orange-500/40 sm:flex'+ >+ Claim offer+ <ArrowRightIcon className='h-3.5 w-3.5 transition-transform group-hover:translate-x-0.5' />+ </Link>+ </div>+ </div>+ </div>+ )+}+const AuthedHeader = ({logoutHandler,colourBackground,@@ -656,6 +788,7 @@ const Header = ({ refPage, transparent }: HeaderProps) => {return (<Popover>+ <BlackFridayBanner /><TrialBanner />{/* Computer / Laptop / Tablet layout header */}