diff --git a/components/calendar/EventInfo.tsx b/components/calendar/EventInfo.tsx index f4643a18d..a391e7214 100644 --- a/components/calendar/EventInfo.tsx +++ b/components/calendar/EventInfo.tsx @@ -110,6 +110,7 @@ const EventInfo = ({ event, edit }: EventInfoProps) => { src: `${badge.badgeName}.gif`, description: "", count: 1, + hueRotateAngle: badge.hueRotateAngle, }))} /> ) : null} diff --git a/components/u/BadgeContainer.tsx b/components/u/BadgeContainer.tsx index 5d109d586..540d5afe2 100644 --- a/components/u/BadgeContainer.tsx +++ b/components/u/BadgeContainer.tsx @@ -13,6 +13,7 @@ const BadgeContainer = ({ badges: { src: string; description: string; + hueRotateAngle?: number; count: number; }[]; }) => { @@ -39,6 +40,11 @@ const BadgeContainer = ({ h={10} m={1} src={`/badges/${badge.src}`} + filter={ + typeof badge.hueRotateAngle === "number" + ? `hue-rotate(${badge.hueRotateAngle}deg)` + : undefined + } /> {" "} @@ -61,6 +67,11 @@ const BadgeContainer = ({ h={10} m={1} src={`/badges/${badge.src}`} + filter={ + typeof badge.hueRotateAngle === "number" + ? `hue-rotate(${badge.hueRotateAngle}deg)` + : undefined + } /> { - const result: { src: string; description: string; count: number }[] = []; + const result: { + src: string; + description: string; + count: number; + hueRotateAngle?: number; + }[] = []; const [itz1To9, itz10to19, itz20To29] = wonITZCount(userId); @@ -220,6 +232,7 @@ const usersBadges = ({ src: `${tournament.badgeName}.gif`, description: `Awarded for winning ${tournament.name}`, count: presentationMode ? 1 : count, + hueRotateAngle: tournament.hueRotateAngle, }); } diff --git a/pages/api/calendar.ts b/pages/api/calendar.ts new file mode 100644 index 000000000..053741153 --- /dev/null +++ b/pages/api/calendar.ts @@ -0,0 +1,13 @@ +import { NextApiRequest, NextApiResponse } from "next"; +import { createHandler } from "utils/api"; +import calendarService from "services/calendar"; + +const GET = async (_req: NextApiRequest, res: NextApiResponse) => { + const events = await calendarService.events(); + res.status(200).json(events); +}; + +const colorsHandler = (req: NextApiRequest, res: NextApiResponse) => + createHandler(req, res, { GET }); + +export default colorsHandler; diff --git a/public/badges/ebtv.gif b/public/badges/ebtv.gif new file mode 100644 index 000000000..0433ff77a Binary files /dev/null and b/public/badges/ebtv.gif differ