@@ -6,37 +6,39 @@ import styles from "../pages/style.module.css"
66import { MaterialCost } from "./Material"
77
88export function FullAscensionCosts ( { template, costTemplates } : { template : CostTemplate , costTemplates : CostTemplates } ) {
9- const [ expanded , setExpanded ] = useState ( false )
10- const costs = getCostsFromTemplate ( template , costTemplates )
9+ const [ expanded , setExpanded ] = useState ( false )
10+ const costs = getCostsFromTemplate ( template , costTemplates )
1111
12- return < >
13- < h3 className = "text-lg font-bold pt-1" id = "ascensions" > Ascensions:</ h3 >
14- < table className = { `table-auto w-full ${ styles . table } mb-2 ${ expanded ? "" : "cursor-pointer" } sm:text-sm md:text-base text-xs` } onClick = { ( e ) => setExpanded ( true ) } >
15- < thead className = "font-semibold divide-x divide-gray-200 dark:divide-gray-500" >
16- < td > Asc.</ td >
17- < td > Mora</ td >
18- < td colSpan = { costs [ costs . length - 1 ] . items . length } > Items</ td >
19- </ thead >
20- < tbody className = "divide-y divide-gray-200 dark:divide-gray-500" >
21- { costs
22- . slice ( 1 )
23- . map ( ( { mora, items } , ind ) => {
24- let newItems = items
25- if ( ind == 0 && template . mapping . BossMat )
26- newItems = [ items [ 0 ] , { name : "" , count : 0 } , ...items . slice ( 1 ) ]
27- return < tr className = "pr-1 divide-x divide-gray-200 dark:divide-gray-500" key = { ind } >
28- < td > A{ ind + 1 } </ td >
29- < td className = "text-right" > { mora } </ td >
30- { newItems . map ( ( { count, name } ) => < td key = { name } >
31- { count > 0 && < MaterialCost name = { name } count = { count } /> }
32- </ td > ) }
33- </ tr >
34- } )
35- . filter ( ( _ , i , arr ) => expanded ? true : ( i == arr . length - 1 ) ) }
36- { ! expanded && < tr className = "pr-1 cursor-pointer text-blue-700 dark:text-blue-300 hover:text-blue-400 dark:hover:text-blue-400 no-underline transition-all duration-200 font-semibold" >
37- < td colSpan = { costs [ costs . length - 1 ] . items . length + 2 } style = { ( { textAlign : "center" } ) } > Click to expand...</ td >
38- </ tr > }
39- </ tbody >
40- </ table >
41- </ >
42- }
12+ return < >
13+ < h3 className = "text-lg font-bold pt-1" id = "ascensions" > Ascensions:</ h3 >
14+ < table className = { `table-auto w-full ${ styles . table } mb-2 ${ expanded ? "" : "cursor-pointer" } sm:text-sm md:text-base text-xs` } onClick = { ( e ) => setExpanded ( true ) } >
15+ < thead >
16+ < tr className = "divide-x divide-gray-200 dark:divide-gray-500" >
17+ < th > Asc.</ th >
18+ < th > Mora</ th >
19+ < th colSpan = { costs [ costs . length - 1 ] . items . length } > Items</ th >
20+ </ tr >
21+ </ thead >
22+ < tbody className = "divide-y divide-gray-200 dark:divide-gray-500" >
23+ { costs
24+ . slice ( 1 )
25+ . map ( ( { mora, items } , ind ) => {
26+ let newItems = items
27+ if ( ind == 0 && template . mapping . BossMat )
28+ newItems = [ items [ 0 ] , { name : "" , count : 0 } , ...items . slice ( 1 ) ]
29+ return < tr className = "pr-1 divide-x divide-gray-200 dark:divide-gray-500" key = { ind } >
30+ < td > A{ ind + 1 } </ td >
31+ < td className = "text-right" > { mora } </ td >
32+ { newItems . map ( ( { count, name } ) => < td key = { name } >
33+ { count > 0 && < MaterialCost name = { name } count = { count } /> }
34+ </ td > ) }
35+ </ tr >
36+ } )
37+ . filter ( ( _ , i , arr ) => expanded ? true : ( i == arr . length - 1 ) ) }
38+ { ! expanded && < tr className = "pr-1 cursor-pointer text-blue-700 dark:text-blue-300 hover:text-blue-400 dark:hover:text-blue-400 no-underline transition-all duration-200 font-semibold" >
39+ < td colSpan = { costs [ costs . length - 1 ] . items . length + 2 } style = { ( { textAlign : "center" } ) } > Click to expand...</ td >
40+ </ tr > }
41+ </ tbody >
42+ </ table >
43+ </ >
44+ }
0 commit comments