@@ -4,22 +4,23 @@ import Head from "next/head"
44import ReactMarkdown from "react-markdown"
55import FormattedLink from "../../components/FormattedLink"
66import Guides from "../../components/Guides"
7- import Icon , { CharIcon , IconName } from "../../components/Icon"
7+ import Icon , { SmallIcon } from "../../components/Icon"
88import Main from "../../components/Main"
9- import { CostTemplates , getCharacters , getCostTemplates , getMaterials } from "../../utils/data-cache"
10- import { Cost , CostTemplate , Material , SmallChar } from "../../utils/types"
11- import { createSmallChar , getCostsFromTemplate , getGuidesFor , getLinkToGuide , getStarColor , urlify } from "../../utils/utils"
9+ import { CostTemplates , getCharacters , getCostTemplates , getMaterials , getWeapons } from "../../utils/data-cache"
10+ import { Cost , CostTemplate , Material , SmallChar , SmallWeapon } from "../../utils/types"
11+ import { createSmallChar , createSmallWeapon , getCostsFromTemplate , getGuidesFor , getLinkToGuide , getStarColor , urlify } from "../../utils/utils"
1212
1313interface Props {
1414 mat : Material ,
1515 guides ?: string [ ] [ ] ,
1616 usedBy : {
1717 charTalents : SmallChar [ ]
1818 charAscension : SmallChar [ ]
19+ weaponAscension : SmallWeapon [ ]
1920 }
2021}
2122
22- export default function CharacterWebpage ( { mat, location, guides, usedBy } : Props & { location : string } ) {
23+ export default function MaterialWebpage ( { mat, location, guides, usedBy } : Props & { location : string } ) {
2324 const color = getStarColor ( mat . stars ?? 1 )
2425
2526 return (
@@ -81,14 +82,21 @@ export default function CharacterWebpage({ mat, location, guides, usedBy }: Prop
8182 { usedBy . charTalents . length > 0 && < >
8283 < h3 className = "text-lg font-bold pt-1" id = "chartalents" > Used by character talents:</ h3 >
8384 < div className = "flex flex-wrap justify-start text-center mt-2" >
84- { usedBy . charTalents . map ( c => < CharIcon key = { c . name } char = { c } location = { location } /> ) }
85+ { usedBy . charTalents . map ( c => < SmallIcon key = { c . name } thing = { c } location = { location } /> ) }
8586 </ div >
8687 </ > }
8788
8889 { usedBy . charAscension . length > 0 && < >
8990 < h3 className = "text-lg font-bold pt-1" id = "charascension" > Used by character ascensions:</ h3 >
9091 < div className = "flex flex-wrap justify-start text-center mt-2" >
91- { usedBy . charAscension . map ( c => < CharIcon key = { c . name } char = { c } location = { location } /> ) }
92+ { usedBy . charAscension . map ( c => < SmallIcon key = { c . name } thing = { c } location = { location } /> ) }
93+ </ div >
94+ </ > }
95+
96+ { usedBy . weaponAscension . length > 0 && < >
97+ < h3 className = "text-lg font-bold pt-1" id = "weaponascension" > Used by weapon ascensions:</ h3 >
98+ < div className = "flex flex-wrap justify-start text-center mt-2" >
99+ { usedBy . weaponAscension . map ( c => < SmallIcon key = { c . name } thing = { c } location = { location } /> ) }
92100 </ div >
93101 </ > }
94102
@@ -147,13 +155,25 @@ export async function getStaticProps(context: GetStaticPropsContext): Promise<Ge
147155 }
148156 }
149157
158+
159+ const weapons = await getWeapons ( )
160+ const weaponAscension : SmallWeapon [ ] = [ ]
161+
162+ if ( weapons && costTemplates ) {
163+ for ( const w of Object . values ( weapons ) ) {
164+ if ( w . ascensionCosts && isInCosts ( w . ascensionCosts , costTemplates , mat . name ) )
165+ weaponAscension . push ( createSmallWeapon ( w ) )
166+ }
167+ }
168+
150169 return {
151170 props : {
152171 mat,
153172 guides,
154173 usedBy : {
155174 charAscension,
156- charTalents
175+ charTalents,
176+ weaponAscension : weaponAscension . sort ( ( a , b ) => ( a . stars && b . stars && b . stars - a . stars ) || ( a . weapon && b . weapon && a . weapon . localeCompare ( b . weapon ) ) || a . name . localeCompare ( b . name ) )
157177 }
158178 } ,
159179 revalidate : 60 * 60
0 commit comments