UI refinements (#2859)

## Description:

UI Refinements requested by @evanpelle  check https://ui.openfront.dev

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

w.o.n
This commit is contained in:
Ryan
2026-01-11 22:52:03 +00:00
committed by GitHub
parent 14512e4f87
commit 3e661752af
39 changed files with 1928 additions and 1573 deletions
+26
View File
@@ -393,3 +393,29 @@ export async function getSvgAspectRatio(src: string): Promise<number | null> {
return null;
}
export function getDiscordAvatarUrl(user: {
id: string;
avatar: string | null;
discriminator?: string;
}): string | null {
if (user.avatar) {
// - id is a Discord numeric string
// - avatar is a hash, optionally prefixed with "a_" for animated avatars
const validId = /^\d+$/.test(user.id);
const validAvatar =
/^[a-f0-9]+$/.test(user.avatar) || /^a_[a-f0-9]+$/.test(user.avatar);
if (validId && validAvatar) {
const extension = user.avatar.startsWith("a_") ? "gif" : "png";
return `https://cdn.discordapp.com/avatars/${encodeURIComponent(user.id)}/${encodeURIComponent(user.avatar)}.${extension}?size=64`;
}
}
if (user.discriminator !== undefined) {
const idx = Number(user.discriminator) % 5;
return `https://cdn.discordapp.com/embed/avatars/${idx}.png`;
}
return null;
}