Skip to content

Commit a0d411f

Browse files
fix: Fix author links not working.
1 parent 24e96e5 commit a0d411f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/components/ProjectCard.astro

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import type { Award, ModGardenEvent, Project } from "../ts/ModGardenAPI";
2+
import type { Award, ModGardenEvent, Project, UserData } from "../ts/ModGardenAPI";
33
import { getUserData } from "../ts/ModGardenAPI";
44
import type { Mod } from "../ts/ModrinthHelper";
55
import { getModrinthModData } from "../ts/ModGardenAPI";
@@ -31,13 +31,13 @@ if (awards != undefined && awards.length > 0) {
3131
3232
const galleryPicture = mod.gallery?.length ? mod.gallery[0] : undefined;
3333
const iconPicture = mod.icon_url ? mod.icon_url : undefined;
34-
const projectAuthors: string[] = [];
34+
const projectAuthors: UserData[] = [];
3535
if (showUserInfo) {
3636
const users = submission.authors;
3737
for (const userId of users) {
3838
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);
4141
}
4242
}
4343
}
@@ -66,8 +66,8 @@ if (showUserInfo) {
6666
{showUserInfo && (<div> By:
6767
{projectAuthors.length > 0
6868
? 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>
7171
)).reduce((prev, curr) => [prev, ", ", curr])
7272
: "No authors listed" /* Here just in case somehow no authors, shouldn't be possible, but you can't be too safe */
7373
}

0 commit comments

Comments
 (0)