[+] Wrapper for pfp path

This commit is contained in:
Azalea
2024-03-05 23:35:49 -05:00
parent f1af07e921
commit e514e4b64e
3 changed files with 21 additions and 5 deletions

View File

@@ -15,7 +15,8 @@ import moment from 'moment/moment'
import CalHeatmap from 'cal-heatmap'
// @ts-expect-error Cal-heatmap does not have proper types
import CalTooltip from 'cal-heatmap/plugins/Tooltip'
import { DEFAULT_PFP } from "./config";
import { DEFAULT_PFP, IMG_HOST } from "./config";
import type { UserMe } from "./generalTypes";
export function title(t: string) {
document.title = `AquaNet - ${t}`
@@ -152,3 +153,8 @@ export function tooltip(element: HTMLElement, params: { text: string } | string)
}
}
}
export function pfp(node: HTMLImageElement, me: UserMe) {
node.src = me.profilePicture ? `${IMG_HOST}/${me.profilePicture}` : DEFAULT_PFP
node.onerror = e => pfpNotFound(e as Event)
}