desktop: improve projects header and avatar contrast

Bring project navigation closer to its page heading and give fallback avatars distinct, readable colors on light backgrounds.

Signed-off-by: Thomas Petersen <thomasp@squareup.com>
This commit is contained in:
Thomas Petersen
2026-08-12 10:29:17 -04:00
parent 0f8246b527
commit fc6216cb17
2 changed files with 20 additions and 2 deletions

View File

@@ -761,7 +761,7 @@ export function ProjectsView() {
const projectsHeader = (
<PageHeader
className="pointer-events-auto mb-8"
className="pointer-events-auto mb-4"
description="Set up and manage your projects."
title="Projects"
/>

View File

@@ -14,6 +14,24 @@ const sizeClasses: Record<UserAvatarSize, string> = {
md: "h-9 w-9 text-xs",
};
const fallbackColorClasses = [
"bg-blue-500 text-white",
"bg-emerald-500 text-white",
"bg-amber-400 text-amber-950",
"bg-rose-500 text-white",
"bg-cyan-400 text-cyan-950",
"bg-violet-500 text-white",
"bg-orange-500 text-white",
] as const;
function fallbackColorClass(displayName: string) {
const hash = Array.from(displayName.trim().toLowerCase()).reduce(
(value, character) => (value * 31 + (character.codePointAt(0) ?? 0)) >>> 0,
0,
);
return fallbackColorClasses[hash % fallbackColorClasses.length];
}
type UserAvatarProps = {
avatarUrl: string | null;
displayName: string;
@@ -66,7 +84,7 @@ export function UserAvatar({
"font-semibold",
accent
? "bg-primary text-primary-foreground"
: "bg-secondary text-secondary-foreground",
: fallbackColorClass(displayName),
)}
data-testid={testId ? `${testId}-fallback` : undefined}
delayMs={fallbackDelayMs}