import Image from "next/image"; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"; import { Badge } from "@/components/ui/badge"; import { Card, CardContent } from "@/components/ui/card"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { LunarisText } from "@/components/public/lunaris-text"; import { parseLunarisText } from "@/lib/catalog/lunaris"; import { rarityGradientClass } from "@/lib/catalog/rarity"; import type { getActiveCatalog } from "@/lib/guides/queries"; import type { getActiveStygianSchedule } from "@/lib/stygian/repository"; type Schedule = NonNullable>>; type Catalog = NonNullable>>; type Item = Schedule["recommendations"][number]["items"][number]; function recommendation(item: Item, catalog: Catalog) { if (item.kind === "element" && item.element) { const source = catalog.characters.find((character) => character.element === item.element && character.elementIconUrl); return { name: item.element, imageUrl: source?.elementIconUrl ?? null, badge: "Element" }; } if (item.kind === "constellation" && item.characterKey && item.constellationLevel) { const character = catalog.characters.find((candidate) => candidate.key === item.characterKey); const constellation = character?.constellations.find((candidate) => candidate.level === item.constellationLevel); return { name: `${character?.name ?? item.characterKey} C${item.constellationLevel}`, imageUrl: constellation?.iconUrl ?? character?.imageUrl ?? null, badge: "Constellation" }; } if (item.kind === "character") { const character = catalog.characters.find((candidate) => candidate.key === item.catalogKey); const weapon = catalog.weapons.find((candidate) => candidate.key === item.weaponKey); const artifact = catalog.artifacts.find((candidate) => candidate.key === item.artifactKey); return { name: character?.name ?? item.catalogKey ?? "Unknown", imageUrl: character?.imageUrl ?? null, badge: item.constellationLevel === null ? "Character" : `C${item.constellationLevel}`, rarity: character?.rarity ?? null, weapon, artifact, }; } const collection = item.kind === "weapon" ? catalog.weapons : catalog.artifacts; const value = collection.find((candidate) => candidate.key === item.catalogKey); return { name: value?.name ?? item.catalogKey ?? "Unknown", imageUrl: value?.imageUrl ?? null, badge: item.kind, rarity: value?.rarity ?? null }; } function RecommendationIcon({ item, catalog, teamLayout = false }: { item: Item; catalog: Catalog; teamLayout?: boolean }) { const value = recommendation(item, catalog); if (item.kind === "character") { return (
{value.imageUrl ? {value.name} : null}
{value.weapon ? {value.weapon.name} : null}
{value.artifact ? {value.artifact.name} : null}
{value.name}{value.badge}
); } return (
{value.imageUrl ? {value.name} : null}
{value.name} {value.badge}
); } function BossCard({ schedule, level, position, catalog }: { schedule: Schedule; level: 105 | 110; position: number; catalog: Catalog }) { const boss = schedule.bosses.find((candidate) => candidate.level === level && candidate.position === position); if (!boss) return null; const groups = schedule.recommendations.filter((group) => group.level === level && group.bossPosition === position); const teams = groups.filter((group) => group.kind === "team"); const units = groups.filter((group) => group.kind === "unit").flatMap((group) => group.items); return (
Boss overview {boss.mechanics.map((mechanic, index) => ( {mechanic.name} ))}

REC TEAM

{teams.length ? teams.map((team) => (
{team.items.slice(0, 4).map((item) => )} {Array.from({ length: Math.max(0, 4 - team.items.length) }, (_, index) => )) :

No team recommendations yet.

}

REC UNIT

{units.length ?
{units.map((item) => )}
:

No unit recommendations yet.

}
); } export function StygianGuide({ schedule, catalog }: { schedule: Schedule; catalog: Catalog }) { return ( Level 105 Level 110 {([105, 110] as const).map((level) => ( {[0, 1, 2].map((position) => { const boss = schedule.bosses.find((candidate) => candidate.level === level && candidate.position === position); return {boss?.name ?? `Boss ${position + 1}`}; })} {[0, 1, 2].map((position) => )} ))} ); }