From 94ae8847cc00f396dd73709ca6f4ff70d150f91d Mon Sep 17 00:00:00 2001 From: Martti Malmi Date: Thu, 7 Dec 2023 22:31:58 +0200 Subject: [PATCH] christmas season 30 -> 7 days, show S nav logo on mobile --- packages/app/src/Pages/Layout/LogoHeader.tsx | 28 +++++++++++--------- packages/app/src/SnortUtils/index.ts | 6 ++--- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/app/src/Pages/Layout/LogoHeader.tsx b/packages/app/src/Pages/Layout/LogoHeader.tsx index 2cc650e75..1cdcd5be0 100644 --- a/packages/app/src/Pages/Layout/LogoHeader.tsx +++ b/packages/app/src/Pages/Layout/LogoHeader.tsx @@ -7,37 +7,41 @@ import Icon from "@/Icons/Icon"; import { unixNowMs } from "@snort/shared"; import { Birthday, Day } from "@/Const"; +const getExtra = () => { + if (isBirthday()) { + const age = (unixNowMs() - Birthday.getTime()) / (Day * 365_000); + return {age.toFixed(0)}st 🎂; + } + if (isHalloween()) return 🎃; + if (isStPatricksDay()) return 🍀; + if (isChristmas()) return 🎄; +}; + export function LogoHeader({ showText = false }) { const { subscriptions } = useLogin(); const currentSubscription = getCurrentSubscription(subscriptions); - const extra = () => { - if (isBirthday()) { - const age = (unixNowMs() - Birthday.getTime()) / (Day * 365_000); - return {age.toFixed(0)}st 🎂; - } - if (isHalloween()) return "🎃"; - if (isStPatricksDay()) return "🍀"; - if (isChristmas()) return "🎄"; - }; + const appName = CONFIG.appName === "iris" && isStPatricksDay() ? "Irish" : CONFIG.appName; const handleLogoClick = () => { window.scrollTo({ top: 0, behavior: "instant" }); }; + const extra = getExtra(); + return (

{CONFIG.navLogo && } {!CONFIG.navLogo && ( - + {CONFIG.appName[0]} )} {showText && (
- {CONFIG.appName} - {extra()} + {appName} + {extra && {extra}}
)}

diff --git a/packages/app/src/SnortUtils/index.ts b/packages/app/src/SnortUtils/index.ts index 591d5a41f..3cf2ebb30 100644 --- a/packages/app/src/SnortUtils/index.ts +++ b/packages/app/src/SnortUtils/index.ts @@ -485,17 +485,17 @@ export const isHalloween = () => { export const isStPatricksDay = () => { const event = new Date(ThisYear, 2, 17); - return IsTheSeason(event, 7); + return IsTheSeason(event, 1); }; export const isChristmas = () => { const event = new Date(ThisYear, 11, 25); - return IsTheSeason(event, 30); + return IsTheSeason(event, 7); }; export const isBirthday = () => { const event = new Date(ThisYear, Birthday.getMonth(), Birthday.getDate()); - return IsTheSeason(event, 1); + return CONFIG.appName === "Snort" && IsTheSeason(event, 1); }; export function getDisplayName(user: UserMetadata | undefined, pubkey: HexKey): string {