christmas season 30 -> 7 days, show S nav logo on mobile
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
a5dddcf093
commit
94ae8847cc
@ -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 <span className="text-xs">{age.toFixed(0)}st 🎂</span>;
|
||||
}
|
||||
if (isHalloween()) return <span title="Happy Halloween!">🎃</span>;
|
||||
if (isStPatricksDay()) return <span title="Happy St. Patrick's Day!">🍀</span>;
|
||||
if (isChristmas()) return <span title="Merry Christmas!">🎄</span>;
|
||||
};
|
||||
|
||||
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 <span className="text-xs">{age.toFixed(0)}st 🎂</span>;
|
||||
}
|
||||
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 (
|
||||
<Link to="/" className="logo hover:no-underline" onClick={handleLogoClick}>
|
||||
<h1 className="flex flex-row items-center md:justify-center font-bold my-0 p-0 md:mx-3 font-bold text-3xl">
|
||||
{CONFIG.navLogo && <img src={CONFIG.navLogo} className="w-8" />}
|
||||
{!CONFIG.navLogo && (
|
||||
<span className="p-5 hidden md:flex xl:hidden w-8 h-8 rounded-xl bg-dark flex items-center justify-center">
|
||||
<span className="p-3 md:p-5 text-xl md:text-3xl flex xl:hidden w-8 h-8 rounded-xl bg-dark flex items-center justify-center">
|
||||
{CONFIG.appName[0]}
|
||||
</span>
|
||||
)}
|
||||
{showText && (
|
||||
<div className="md:hidden xl:inline ml-2">
|
||||
{CONFIG.appName}
|
||||
{extra()}
|
||||
{appName}
|
||||
{extra && <span className="ml-1">{extra}</span>}
|
||||
</div>
|
||||
)}
|
||||
</h1>
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user