Skip to content

πŸ“ˆ 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!

Revert "ProductHunt lanuch banner"

Andrii Romasiund0ca35d9b581
diff --git a/web/app/components/Header/index.tsx b/web/app/components/Header/index.tsx
index e5b47511c..23b789673 100644
--- a/web/app/components/Header/index.tsx
+++ b/web/app/components/Header/index.tsx
@@ -17,7 +17,7 @@ import {
import { ArrowRightIcon } from '@heroicons/react/20/solid'
import { Bars3Icon, XMarkIcon, ChevronDownIcon } from '@heroicons/react/24/outline'
import { MoonIcon, SunIcon } from '@heroicons/react/24/solid'
-import { SiYoutube, SiProducthunt } from '@icons-pack/react-simple-icons'
+import { SiYoutube } from '@icons-pack/react-simple-icons'
import cx from 'clsx'
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
@@ -28,7 +28,7 @@ import _startsWith from 'lodash/startsWith'
import { GaugeIcon, ChartPieIcon, BugIcon, PuzzleIcon, PhoneIcon } from 'lucide-react'
import { memo, Fragment, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { Link, useRouteLoaderData } from 'react-router'
+import { Link } from 'react-router'
import { changeLanguage } from '~/i18n'
import {
@@ -39,14 +39,11 @@ import {
DOCS_URL,
CAPTCHA_URL,
isDisableMarketingPages,
- LS_PH_BANNER_DISMISSED,
} from '~/lib/constants'
import { useAuth } from '~/providers/AuthProvider'
import { useTheme } from '~/providers/ThemeProvider'
import Flag from '~/ui/Flag'
import SwetrixLogo from '~/ui/icons/SwetrixLogo'
-import { trackCustom } from '~/utils/analytics'
-import { getCookie, setCookie } from '~/utils/cookie'
import routes from '~/utils/routes'
dayjs.extend(utc)
@@ -379,68 +376,6 @@ const Separator = () => (
</svg>
)
-const ProductHuntBanner = () => {
- const { t } = useTranslation('common')
- const rootData = useRouteLoaderData('root') as { phBannerDismissed?: boolean } | undefined
- const [dismissed, setDismissed] = useState<boolean>(() => {
- if (rootData?.phBannerDismissed) return true
- try {
- return getCookie(LS_PH_BANNER_DISMISSED) === '1'
- } catch {
- return false
- }
- })
-
- if (isSelfhosted || dismissed) {
- return null
- }
-
- const dismiss = () => {
- try {
- // 3 days in seconds
- setCookie(LS_PH_BANNER_DISMISSED, '1', 3 * 24 * 60 * 60)
- } catch {
- //
- }
- setDismissed(true)
- }
-
- return (
- <div className='bg-gradient-to-r from-orange-600 via-orange-500 to-orange-400 text-white ring-1 ring-black/5 dark:to-orange-500/80 dark:ring-white/10'>
- <div className='mx-auto max-w-7xl px-4 sm:px-6 lg:px-8'>
- <div className='flex flex-col items-center justify-center gap-2 py-1.5 text-center sm:flex-row sm:justify-between'>
- <div className='flex items-center gap-2 text-sm font-medium sm:text-left md:text-base'>
- <SiProducthunt className='h-5 w-5 shrink-0' aria-hidden='true' />
- <span>We&apos;re live on Product Hunt! Please support us by upvoting πŸ™‚</span>
- </div>
- <div className='mt-2 flex w-full items-center justify-center gap-2 sm:mt-0 sm:w-auto sm:justify-end'>
- <a
- href='https://www.producthunt.com/products/swetrix-analytics/launches/swetrix-5'
- target='_blank'
- rel='noopener noreferrer'
- className='block w-full rounded-md bg-white/10 px-3 py-2 text-center text-sm font-semibold text-white ring-1 ring-white/30 transition-colors hover:bg-white/15 sm:inline-block sm:w-auto'
- aria-label={`Upvote on Product Hunt (opens in a new tab)`}
- onClick={() => {
- trackCustom('PRODUCT_HUNT_BANNER_UPVOTE_CLICKED')
- }}
- >
- Upvote on Product Hunt
- </a>
- <button
- type='button'
- onClick={dismiss}
- className='rounded-md p-1 text-white/90 transition-colors hover:bg-white/10 hover:text-white'
- aria-label={t('common.close')}
- >
- <XMarkIcon className='h-5 w-5' />
- </button>
- </div>
- </div>
- </div>
- </div>
- )
-}
-
const AuthedHeader = ({
rawStatus,
status,
@@ -463,7 +398,6 @@ const AuthedHeader = ({
'border-b border-gray-200 bg-gray-50 dark:border-slate-600/40 dark:bg-slate-900': colourBackground,
})}
>
- <ProductHuntBanner />
<nav className='mx-auto max-w-7xl px-4 sm:px-6 lg:px-8' aria-label='Top'>
<div className='flex w-full items-center justify-between py-4'>
<div className='flex items-center'>
@@ -568,7 +502,6 @@ const NotAuthedHeader = ({
'border-b border-gray-200 bg-gray-50 dark:border-slate-600/40 dark:bg-slate-900': colourBackground,
})}
>
- <ProductHuntBanner />
<nav className='mx-auto max-w-7xl px-4 sm:px-6 lg:px-8' aria-label='Top'>
<div className='flex w-full items-center justify-between py-4'>
<div className='flex items-center'>
diff --git a/web/app/lib/constants/index.ts b/web/app/lib/constants/index.ts
index dd5f033d5..474e52099 100644
--- a/web/app/lib/constants/index.ts
+++ b/web/app/lib/constants/index.ts
@@ -325,7 +325,6 @@ export const SHOW_BANNER_AT_PERC = 85 // show banner when 85% of events in tier
export const LS_THEME_SETTING = 'colour-theme'
export const LS_VIEW_PREFS_SETTING = 'proj-view-preferences'
export const LS_CAPTCHA_VIEW_PREFS_SETTING = 'captcha-view-preferences'
-export const LS_PH_BANNER_DISMISSED = 'ph-banner-dismissed'
export const DEFAULT_TIMEZONE = 'Etc/GMT'
diff --git a/web/app/root.tsx b/web/app/root.tsx
index 899ac5190..bbd6698d1 100644
--- a/web/app/root.tsx
+++ b/web/app/root.tsx
@@ -22,13 +22,7 @@ import { ExternalScripts } from 'remix-utils/external-scripts'
import { LocaleLinks } from '~/components/LocaleLinks'
import SelfhostedApiUrlBanner from '~/components/SelfhostedApiUrlBanner'
import { SEO } from '~/components/SEO'
-import {
- CONTACT_EMAIL,
- LS_THEME_SETTING,
- isSelfhosted,
- I18N_CACHE_BREAKER,
- LS_PH_BANNER_DISMISSED,
-} from '~/lib/constants'
+import { CONTACT_EMAIL, LS_THEME_SETTING, isSelfhosted, I18N_CACHE_BREAKER } from '~/lib/constants'
import mainCss from '~/styles/index.css?url'
import tailwindCss from '~/styles/tailwind.css?url'
import { trackViews, trackErrors, trackError } from '~/utils/analytics'
@@ -192,9 +186,6 @@ export async function loader({ request }: LoaderFunctionArgs) {
const locale = detectLanguage(request)
const theme = detectTheme(request)
const isAuthed = isAuthenticated(request)
- const cookieHeader = request.headers.get('Cookie')
- const phBannerDismissedMatch = cookieHeader?.match(new RegExp(`(?:^|; )${LS_PH_BANNER_DISMISSED}=([^;]*)`))
- const phBannerDismissed = phBannerDismissedMatch?.[1] === '1'
const REMIX_ENV = {
NODE_ENV: process.env.NODE_ENV,
@@ -209,7 +200,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
COOKIE_DOMAIN: process.env.COOKIE_DOMAIN,
}
- return { locale, url, theme, REMIX_ENV, isAuthed, pathname: urlObject.pathname, phBannerDismissed }
+ return { locale, url, theme, REMIX_ENV, isAuthed, pathname: urlObject.pathname }
}
export const handle = { i18n: 'common' }