@@ -11,7 +11,7 @@ import styles from "./style.module.css"
1111
1212
1313interface Props {
14- events : GenshinEvent [ ]
14+ events : ( GenshinEvent & { index : number } ) [ ]
1515}
1616
1717type Server = "Asia" | "Europe" | "North America"
@@ -80,7 +80,7 @@ export default function Events(props: Props & { location: string }) {
8080 const endA = getEndTime ( a , serverTimezone )
8181 const endB = getEndTime ( b , serverTimezone )
8282
83- if ( ! endA && ! endB ) return 0
83+ if ( ! endA && ! endB ) return a . index - b . index
8484 if ( ! endA ) return 1
8585 if ( ! endB ) return - 1
8686
@@ -96,7 +96,7 @@ export default function Events(props: Props & { location: string }) {
9696 const startA = getStartTime ( a , serverTimezone )
9797 const startB = getStartTime ( b , serverTimezone )
9898
99- if ( ! startA && ! startB ) return 0
99+ if ( ! startA && ! startB ) return a . index - b . index
100100 if ( ! startA ) return 1
101101 if ( ! startB ) return - 1
102102
@@ -109,7 +109,7 @@ export default function Events(props: Props & { location: string }) {
109109 const startA = getStartTime ( a , serverTimezone )
110110 const startB = getStartTime ( b , serverTimezone )
111111
112- if ( ! startA && ! startB ) return 0
112+ if ( ! startA && ! startB ) return a . index - b . index
113113 if ( ! startA ) return - 1
114114 if ( ! startB ) return 1
115115
@@ -208,7 +208,7 @@ export async function getStaticProps(context: GetStaticPropsContext): Promise<Ge
208208
209209 return {
210210 props : {
211- events
211+ events : events . map ( ( e , i ) => Object . assign ( { index : i } , e ) )
212212 } ,
213213 revalidate : 60 * 30
214214 }
0 commit comments