This commit is contained in:
root
2025-10-28 16:07:38 +00:00
parent e96cd63f33
commit 4eea4b23bd
16 changed files with 907 additions and 230 deletions
+4 -4
View File
@@ -3,7 +3,7 @@ import { db } from '../db/index.js';
export const SUPERUSER_GROUP_NAME = 'superuser';
const AVATAR_COLORS = [
export const AVATAR_COLORS = [
'bg-arcticBlue-600',
'bg-copperRust-500',
'bg-sunsetCoral-600',
@@ -16,10 +16,10 @@ const AVATAR_COLORS = [
'bg-mossGreen-400'
];
const DEFAULT_AVATAR_COLOR = 'bg-mossGreen-500';
export const DEFAULT_AVATAR_COLOR = 'bg-mossGreen-500';
const AVATAR_COLOR_SET = new Set([...AVATAR_COLORS, DEFAULT_AVATAR_COLOR]);
const pickRandomAvatarColor = () => {
export const pickRandomAvatarColor = () => {
if (!Array.isArray(AVATAR_COLORS) || AVATAR_COLORS.length === 0) {
return DEFAULT_AVATAR_COLOR;
}
@@ -27,7 +27,7 @@ const pickRandomAvatarColor = () => {
return AVATAR_COLORS[index] ?? DEFAULT_AVATAR_COLOR;
};
const normalizeAvatarColor = (value) => {
export const normalizeAvatarColor = (value) => {
if (!value) return null;
const candidate = String(value).trim();
return AVATAR_COLOR_SET.has(candidate) ? candidate : null;