File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11---
22import type {
33 Award ,
4- EventSubmission ,
5- ModGardenEvents ,
4+ ModGardenEvent ,
65 Project ,
76} from " ../ts/ModGardenAPI" ;
87import type { Mod } from " ../ts/ModrinthHelper" ;
@@ -11,7 +10,7 @@ import { getModrinthModData } from "../ts/ModGardenAPI";
1110interface Props {
1211 submission: Project ;
1312 awards? : Award [];
14- events? : ModGardenEvents [];
13+ events? : ModGardenEvent [];
1514}
1615
1716const { submission, events, awards } = Astro .props ;
Original file line number Diff line number Diff line change @@ -4,17 +4,17 @@ import {
44 getEvent ,
55 getEventProjects ,
66} from " ../../ts/ModGardenAPI" ;
7- import type { ModGardenEvents , ResponseError } from " ../../ts/ModGardenAPI" ;
7+ import type { ModGardenEvent , ResponseError } from " ../../ts/ModGardenAPI" ;
88
99const { event } = Astro .params ;
1010
11- let eventData: ModGardenEvents | ResponseError = await getEvent (event ! );
11+ let eventData: ModGardenEvent | ResponseError = await getEvent (event ! );
1212
1313if (! eventData || " error" in eventData ) {
1414 Astro .response .status = 404 ;
1515 Astro .response .statusText = " Event not found" ;
1616}
17- eventData = eventData as ModGardenEvents ;
17+ eventData = eventData as ModGardenEvent ;
1818const projects = await getEventProjects (eventData .id );
1919---
2020
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ const events = await getEvents();
2121 <div class = " border-0 border-b-4 border-leaf-200 text-lg font-semibold text-black dark:text-white" >
2222 { modGardenEvent .display_name }
2323 </div >
24- <div class = " italic" >{ modGardenEvent .description } </div >
24+ <div class = " italic" >{ modGardenEvent .description . split ( " \n " )[ 0 ] } </div >
2525 </div >
2626 </a >
2727 ))
Original file line number Diff line number Diff line change 11---
22import Layout from " ../../layouts/Layout.astro" ;
3- import { Image } from " astro:assets" ;
43import {
54 getEvents ,
65 getUserAwards ,
@@ -10,7 +9,7 @@ import {
109} from " ../../ts/ModGardenAPI" ;
1110import type {
1211 UserData ,
13- ModGardenEvents ,
12+ ModGardenEvent ,
1413 Award ,
1514} from " ../../ts/ModGardenAPI" ;
1615import ProjectCard from " ../../components/ProjectCard.astro" ;
@@ -33,15 +32,15 @@ const events = await getEvents();
3332for (const submission of submissions ) {
3433 uniqueEvents .add (submission .event );
3534}
36- const projectToEventsMap: Map <string , ModGardenEvents []> = new Map ();
35+ const projectToEventsMap: Map <string , ModGardenEvent []> = new Map ();
3736for (const submission of submissions ) {
3837 if (! projectToEventsMap .has (submission .project_id )) {
3938 projectToEventsMap .set (submission .project_id , []);
4039 }
4140 projectToEventsMap
4241 .get (submission .project_id )
4342 ?.push (
44- events .find ((event ) => event .id === submission .event ) as ModGardenEvents ,
43+ events .find ((event ) => event .id === submission .event ) as ModGardenEvent ,
4544 );
4645}
4746const images = import .meta .glob <{ default: ImageMetadata }>(
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ export type UserData = {
1515 id : string ;
1616 username : string ;
1717 display_name : string ;
18+ avatar_url ?: string ;
19+ pronouns ?: string ;
1820 discord_id : string ;
1921 modrinth_id ?: string ;
2022 created : number ;
@@ -37,17 +39,19 @@ export type Project = {
3739 modrinth_id : string ;
3840 attributed_to : string ;
3941 authors : string [ ] ;
42+ builders : string [ ] ;
4043} ;
4144
42- export type ModGardenEvents = {
45+ export type ModGardenEvent = {
4346 id : string ;
4447 slug : string ;
4548 display_name : string ;
4649 description : string ;
4750 minecraft_version : string ;
4851 loader : string ;
4952 loader_version : string ;
50- started : number ;
53+ start_time : string ;
54+ end_time : string ;
5155} ;
5256export type AwardTier = "COMMON" | "UNCOMMON" | "RARE" | "LEGENDARY" ;
5357export type Award = {
@@ -93,18 +97,18 @@ export async function getUserData(
9397
9498export async function getEvent (
9599 slug : string ,
96- ) : Promise < ModGardenEvents | ResponseError > {
100+ ) : Promise < ModGardenEvent | ResponseError > {
97101 return await fetch ( api_url + "event/" + slug )
98102 . then ( ( response ) => response . json ( ) )
99103 . then ( ( data ) =>
100- data . error ? ( data as ResponseError ) : ( data as ModGardenEvents ) ,
104+ data . error ? ( data as ResponseError ) : ( data as ModGardenEvent ) ,
101105 ) ;
102106}
103107
104- export async function getEvents ( ) : Promise < ModGardenEvents [ ] > {
108+ export async function getEvents ( ) : Promise < ModGardenEvent [ ] > {
105109 return await fetch ( api_url + "events" )
106110 . then ( ( response ) => response . json ( ) )
107- . then ( ( data ) => data as ModGardenEvents [ ] ) ;
111+ . then ( ( data ) => data as ModGardenEvent [ ] ) ;
108112}
109113
110114export async function getSubmission (
You can’t perform that action at this time.
0 commit comments