Add raid section to ContentUpdate
This commit is contained in:
parent
b6b8971399
commit
aa5f3be139
3 changed files with 46 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ import styles from './index.module.scss'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
id: string
|
id: string
|
||||||
type: 'character' | 'summon' | 'weapon'
|
type: 'character' | 'summon' | 'weapon' | 'raid' | 'job'
|
||||||
image?: '01' | '02' | '03' | '04'
|
image?: '01' | '02' | '03' | '04'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,6 +48,11 @@ const ChangelogUnit = ({ id, type, image }: Props) => {
|
||||||
const summon = await fetchSummon()
|
const summon = await fetchSummon()
|
||||||
setItem(summon.data)
|
setItem(summon.data)
|
||||||
break
|
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 })
|
return api.endpoints.summons.getOne({ id: id })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchRaid() {
|
||||||
|
return api.endpoints.raids.getOne({ id: id })
|
||||||
|
}
|
||||||
|
|
||||||
const imageUrl = () => {
|
const imageUrl = () => {
|
||||||
let src = ''
|
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}_${image}.jpg`
|
||||||
: `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/summon-grid/${id}.jpg`
|
: `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/summon-grid/${id}.jpg`
|
||||||
break
|
break
|
||||||
|
|
||||||
|
case 'raid':
|
||||||
|
src = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/raids/${id}.png`
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
return src
|
return src
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@
|
||||||
|
|
||||||
.characters,
|
.characters,
|
||||||
.weapons,
|
.weapons,
|
||||||
.summons {
|
.summons,
|
||||||
|
.raids,
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: auto 1fr;
|
grid-template-rows: auto 1fr;
|
||||||
gap: $unit;
|
gap: $unit;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ interface Props {
|
||||||
newItems?: UpdateObject
|
newItems?: UpdateObject
|
||||||
uncappedItems?: UpdateObject
|
uncappedItems?: UpdateObject
|
||||||
transcendedItems?: UpdateObject
|
transcendedItems?: UpdateObject
|
||||||
|
raidItems?: string[]
|
||||||
numNotes: number
|
numNotes: number
|
||||||
}
|
}
|
||||||
const ContentUpdate = ({
|
const ContentUpdate = ({
|
||||||
|
|
@ -27,6 +28,7 @@ const ContentUpdate = ({
|
||||||
newItems,
|
newItems,
|
||||||
uncappedItems,
|
uncappedItems,
|
||||||
transcendedItems,
|
transcendedItems,
|
||||||
|
raidItems,
|
||||||
numNotes,
|
numNotes,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { t: updates } = useTranslation('updates')
|
const { t: updates } = useTranslation('updates')
|
||||||
|
|
@ -138,6 +140,33 @@ const ContentUpdate = ({
|
||||||
return section
|
return section
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function newRaidSection() {
|
||||||
|
let section: React.ReactNode = ''
|
||||||
|
|
||||||
|
if (raidItems) {
|
||||||
|
section = raidItems && raidItems.length > 0 && (
|
||||||
|
<section className={styles['raids']}>
|
||||||
|
<h4>{updates(`labels.raids`)}</h4>
|
||||||
|
<div className={styles.items}>{raidItemElements()}</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return section
|
||||||
|
}
|
||||||
|
|
||||||
|
function raidItemElements() {
|
||||||
|
let elements: React.ReactNode[] = []
|
||||||
|
|
||||||
|
if (raidItems) {
|
||||||
|
elements = raidItems.map((id) => {
|
||||||
|
return <ChangelogUnit id={id} type="raid" key={id} />
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return elements
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
className={classNames({
|
className={classNames({
|
||||||
|
|
@ -163,6 +192,7 @@ const ContentUpdate = ({
|
||||||
{newItemSection('summon')}
|
{newItemSection('summon')}
|
||||||
{uncapItemSection('summon')}
|
{uncapItemSection('summon')}
|
||||||
{transcendItemSection('summon')}
|
{transcendItemSection('summon')}
|
||||||
|
{newRaidSection()}
|
||||||
</div>
|
</div>
|
||||||
{numNotes > 0 ? (
|
{numNotes > 0 ? (
|
||||||
<div className={styles.notes}>
|
<div className={styles.notes}>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue