|
1 | 1 | --- |
2 | | -import type { Award, ModGardenEvent, Project } from "../ts/ModGardenAPI"; |
| 2 | +import type { Award, ModGardenEvent, Project, UserData } from "../ts/ModGardenAPI"; |
3 | 3 | import { getUserData } from "../ts/ModGardenAPI"; |
4 | 4 | import type { Mod } from "../ts/ModrinthHelper"; |
5 | 5 | import { getModrinthModData } from "../ts/ModGardenAPI"; |
@@ -31,13 +31,13 @@ if (awards != undefined && awards.length > 0) { |
31 | 31 |
|
32 | 32 | const galleryPicture = mod.gallery?.length ? mod.gallery[0] : undefined; |
33 | 33 | const iconPicture = mod.icon_url ? mod.icon_url : undefined; |
34 | | -const projectAuthors: string[] = []; |
| 34 | +const projectAuthors: UserData[] = []; |
35 | 35 | if (showUserInfo) { |
36 | 36 | const users = submission.authors; |
37 | 37 | for (const userId of users) { |
38 | 38 | const userData = await getUserData(userId); |
39 | | - if (userData && "display_name" in userData) { |
40 | | - projectAuthors.push(userData.display_name); |
| 39 | + if (userData) { |
| 40 | + projectAuthors.push(userData as UserData); |
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
@@ -66,8 +66,8 @@ if (showUserInfo) { |
66 | 66 | {showUserInfo && (<div> By: |
67 | 67 | {projectAuthors.length > 0 |
68 | 68 | ? projectAuthors.map((author) => ( |
69 | | - <a class="text-sm text-leaf-600 underline hover:text-leaf-800 dark:text-leaf-200 dark:hover:text-leaf-600" href={`/user/${author}`} target="_blank"> |
70 | | - {author}</a> |
| 69 | + <a class="text-sm text-leaf-600 underline hover:text-leaf-800 dark:text-leaf-200 dark:hover:text-leaf-600" href={`/user/${author.username}`} target="_blank"> |
| 70 | + {author.display_name}</a> |
71 | 71 | )).reduce((prev, curr) => [prev, ", ", curr]) |
72 | 72 | : "No authors listed" /* Here just in case somehow no authors, shouldn't be possible, but you can't be too safe */ |
73 | 73 | } |
|
0 commit comments