[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot]
2026-01-04 17:01:40 +00:00
committed by GitHub
parent eb14a68bdd
commit 0897417d7c
2 changed files with 21 additions and 11 deletions

View File

@@ -375,9 +375,15 @@ export const ProfileForm = () => {
<div
className="color-avatar h-12 w-12 rounded-full border hover:p-px hover:border-primary transition-colors flex items-center justify-center overflow-hidden cursor-pointer"
style={{
backgroundColor: isSolidColorAvatar(field.value) ? field.value : undefined,
backgroundColor: isSolidColorAvatar(
field.value,
)
? field.value
: undefined,
}}
onClick={() => colorInputRef.current?.click()}
onClick={() =>
colorInputRef.current?.click()
}
>
{!isSolidColorAvatar(field.value) && (
<Palette className="h-5 w-5 text-muted-foreground" />

View File

@@ -1,26 +1,30 @@
/**
* Checks if the given avatar value represents a solid color in hexadecimal format.
*
*
* @param value Avatar value to check.
*
*
* @return True if the avatar is a solid color, false otherwise.
*/
export function isSolidColorAvatar(value?: string | null) {
return (value?.startsWith("#") && /^#[0-9A-Fa-f]{6}$/.test(value)) || value?.startsWith("color:") || false;
};
return (
(value?.startsWith("#") && /^#[0-9A-Fa-f]{6}$/.test(value)) ||
value?.startsWith("color:") ||
false
);
}
/**
* Gets the avatar type for form selection (RadioGroup value).
*
*
* @param value Avatar value.
*
*
* @return "upload" for base64 images, "color" for solid colors, or the original value for other types.
*/
export function getAvatarType(value?: string | null) {
if (!value) return "";
if (value.startsWith("data:")) return "upload";
if (isSolidColorAvatar(value)) return "color";
return value;
};
}