diff --git a/src/seqta/ui/AddBetterSEQTAElements.ts b/src/seqta/ui/AddBetterSEQTAElements.ts index d7c23d26..e719bc4a 100644 --- a/src/seqta/ui/AddBetterSEQTAElements.ts +++ b/src/seqta/ui/AddBetterSEQTAElements.ts @@ -113,6 +113,10 @@ function updateUserInfo(info: { userName: string | null; }) { const titlebar = document.getElementsByClassName("titlebar")[0]; + const metadata = [info.meta.code, info.meta.governmentID] + .filter((value): value is string => Boolean(value)) + .join(" // "); + const displayName = info.userDesc || info.userName || ""; titlebar.append( stringToHTML(/* html */ ` @@ -128,10 +132,10 @@ function updateUserInfo(info: {
-

-

${info.userDesc}

+ + ${displayName ? `

${displayName}

` : ""}
-

${info.meta.code} // ${info.meta.governmentID}

+ ${metadata ? `

${metadata}

` : ""}
`).firstChild!, @@ -171,9 +175,12 @@ async function updateStudentInfo(students: any) { const houseelement = document.getElementsByClassName( "userInfohouse", - )[0] as HTMLElement; + )[0] as HTMLElement | undefined; + + if (!houseelement) return; + const student = students[index] ?? {}; - let text = "N/A"; + let text = ""; if (student.house) { text = `${student.year ?? ""}${student.house}`; @@ -193,6 +200,7 @@ async function updateStudentInfo(students: any) { } houseelement.innerText = text; + houseelement.style.display = text ? "block" : "none"; } function createNewsButton(fragment: DocumentFragment, menu: HTMLElement) {