diff --git a/src/components/PrizesChallenges/index.tsx b/src/components/PrizesChallenges/index.tsx index 2ce798e8..c85a04d6 100644 --- a/src/components/PrizesChallenges/index.tsx +++ b/src/components/PrizesChallenges/index.tsx @@ -57,7 +57,7 @@ const AwardBox: React.FC = ({ }; const PrizesChallenges: React.FC = () => { - const { data: prizesAndChallengesFlag } = useFlagState("PrizeEnable"); + const { data: prizesAndChallengesFlag } = useFlagState("PrizesEnabled"); return (
= ({ const columnWidth = `${100 / totalColumns}%`; const leftOffset = `${(event.column * 100) / totalColumns}%`; + // Add state for current time and update it every minute + const [isHappening, setIsHappening] = useState(false); + + useEffect(() => { + const checkIfHappening = () => { + const now = new Date(); + setIsHappening(now >= event.startTime && now <= event.endTime); + }; + + // Check initially + checkIfHappening(); + + // Update every minute + const interval = setInterval(checkIfHappening, 60000); + + return () => clearInterval(interval); + }, [event.startTime, event.endTime]); + // Adjust positioning and sizing based on interval type // 1-hour intervals: 80px per hour = 80/60 = 1.33px per minute // 2-hour intervals: 120px per 2 hours = 120/120 = 1px per minute @@ -251,7 +269,7 @@ const EventItem: React.FC = ({ return ( = ({ whileTap={{ scale: 0.99 }} onClick={() => onEventClick(event)} > + {isHappening && ( +
+ )}
onEventClick(event)} > + {(() => { + const now = new Date(); + const isHappening = + now >= event.startTime && now <= event.endTime; + return ( + isHappening && ( +
+ ) + ); + })()}
{event.name}
{event.startTime.toLocaleDateString("en-US", { diff --git a/yarn.lock b/yarn.lock index 78f44f81..04160049 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2857,11 +2857,11 @@ integrity sha512-H3iskjFIAn5SlJU7OuxUmTEpebK6TKB8rxZShDslBMZJ5u9S//KM1sbdAisiSrqwLQncVjnpi2OK2J51h+4lsg== "@types/node@>=12.12.47", "@types/node@>=13.7.0", "@types/node@^24.1.0": - version "24.8.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-24.8.1.tgz#74c8ae00b045a0a351f2837ec00f25dfed0053be" - integrity sha512-alv65KGRadQVfVcG69MuB4IzdYVpRwMG/mq8KWOaoOdyY617P5ivaDiMCGOFDWD2sAn5Q0mR3mRtUOgm99hL9Q== + version "24.9.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-24.9.0.tgz#4fb62beb8b322fe2955ac94f80ff5a58c941ebf4" + integrity sha512-MKNwXh3seSK8WurXF7erHPJ2AONmMwkI7zAMrXZDPIru8jRqkk6rGDBVbw4mLwfqA+ZZliiDPg05JQ3uW66tKQ== dependencies: - undici-types "~7.14.0" + undici-types "~7.16.0" "@types/parse-json@^4.0.0": version "4.0.2" @@ -5674,9 +5674,9 @@ postcss@^8.4.47: source-map-js "^1.2.1" posthog-js@^1.257.0: - version "1.276.0" - resolved "https://registry.yarnpkg.com/posthog-js/-/posthog-js-1.276.0.tgz#3605e99dd42e69b772fc43c661c064edc3693aa1" - integrity sha512-FYZE1037LrAoKKeUU0pUL7u8WwNK2BVeg5TFApwquVPUdj9h7u5Z077A313hPN19Ar+7Y+VHxqYqdHc4VNsVgw== + version "1.277.0" + resolved "https://registry.yarnpkg.com/posthog-js/-/posthog-js-1.277.0.tgz#027c4c546863edd899aff60bdfd7e46a4aa5849a" + integrity sha512-whSyov8KH2IwXkeJVbgu07EkPk6AITXnrJN7Mg5rGAHJQ0LS1w6qh2Ib4LMsLHTrR5UAqwYHcufbjDl6snoESw== dependencies: "@posthog/core" "1.3.0" core-js "^3.38.1" @@ -6654,10 +6654,10 @@ unbox-primitive@^1.1.0: has-symbols "^1.1.0" which-boxed-primitive "^1.1.1" -undici-types@~7.14.0: - version "7.14.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.14.0.tgz#4c037b32ca4d7d62fae042174604341588bc0840" - integrity sha512-QQiYxHuyZ9gQUIrmPo3IA+hUl4KYk8uSA7cHrcKd/l3p1OTpZcM0Tbp9x7FAtXdAYhlasd60ncPpgu6ihG6TOA== +undici-types@~7.16.0: + version "7.16.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.16.0.tgz#ffccdff36aea4884cbfce9a750a0580224f58a46" + integrity sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw== unicode-canonical-property-names-ecmascript@^2.0.0: version "2.0.1"