From aa5f3be139b77e12975ed9936e591108211f95c2 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 21 Feb 2024 12:44:24 -0500 Subject: [PATCH] Add raid section to ContentUpdate --- components/about/ChangelogUnit/index.tsx | 15 +++++++++- .../about/ContentUpdate/index.module.scss | 3 +- components/about/ContentUpdate/index.tsx | 30 +++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/components/about/ChangelogUnit/index.tsx b/components/about/ChangelogUnit/index.tsx index 759154d9..1ae9bc5c 100644 --- a/components/about/ChangelogUnit/index.tsx +++ b/components/about/ChangelogUnit/index.tsx @@ -6,7 +6,7 @@ import styles from './index.module.scss' interface Props { id: string - type: 'character' | 'summon' | 'weapon' + type: 'character' | 'summon' | 'weapon' | 'raid' | 'job' image?: '01' | '02' | '03' | '04' } @@ -48,6 +48,11 @@ const ChangelogUnit = ({ id, type, image }: Props) => { const summon = await fetchSummon() setItem(summon.data) break + + case 'raid': + const raid = await fetchRaid() + setItem(raid.data) + break } } @@ -63,6 +68,10 @@ const ChangelogUnit = ({ id, type, image }: Props) => { return api.endpoints.summons.getOne({ id: id }) } + async function fetchRaid() { + return api.endpoints.raids.getOne({ id: id }) + } + const imageUrl = () => { let src = '' @@ -82,6 +91,10 @@ const ChangelogUnit = ({ id, type, image }: Props) => { ? `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/summon-grid/${id}_${image}.jpg` : `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/summon-grid/${id}.jpg` break + + case 'raid': + src = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/raids/${id}.png` + break } return src diff --git a/components/about/ContentUpdate/index.module.scss b/components/about/ContentUpdate/index.module.scss index 1ba49359..d03b9e7a 100644 --- a/components/about/ContentUpdate/index.module.scss +++ b/components/about/ContentUpdate/index.module.scss @@ -30,7 +30,8 @@ .characters, .weapons, - .summons { + .summons, + .raids, display: grid; grid-template-rows: auto 1fr; gap: $unit; diff --git a/components/about/ContentUpdate/index.tsx b/components/about/ContentUpdate/index.tsx index 0118da0f..26b62d68 100644 --- a/components/about/ContentUpdate/index.tsx +++ b/components/about/ContentUpdate/index.tsx @@ -18,6 +18,7 @@ interface Props { newItems?: UpdateObject uncappedItems?: UpdateObject transcendedItems?: UpdateObject + raidItems?: string[] numNotes: number } const ContentUpdate = ({ @@ -27,6 +28,7 @@ const ContentUpdate = ({ newItems, uncappedItems, transcendedItems, + raidItems, numNotes, }: Props) => { const { t: updates } = useTranslation('updates') @@ -138,6 +140,33 @@ const ContentUpdate = ({ return section } + function newRaidSection() { + let section: React.ReactNode = '' + + if (raidItems) { + section = raidItems && raidItems.length > 0 && ( +
+

{updates(`labels.raids`)}

+
{raidItemElements()}
+
+ ) + } + + return section + } + + function raidItemElements() { + let elements: React.ReactNode[] = [] + + if (raidItems) { + elements = raidItems.map((id) => { + return + }) + } + + return elements + } + return (
{numNotes > 0 ? (