🐛 Switch to icon for YouAvatar

This commit is contained in:
Luke Vella 2024-09-17 21:17:56 +01:00
parent a6bb357acc
commit c4b9edf297
No known key found for this signature in database
GPG key ID: 469CAD687F0D784C
2 changed files with 6 additions and 8 deletions

View file

@ -1,11 +1,12 @@
import { useTranslation } from "@/app/i18n/client";
import { Icon } from "@rallly/ui/icon";
import { UserIcon } from "lucide-react";
export function YouAvatar() {
const { t } = useTranslation();
return (
<div className="inline-flex size-5 items-center justify-center rounded-full bg-gray-200 text-xs font-medium">
{t("you")[0]}
<Icon>
<UserIcon />
</Icon>
</div>
);
}

View file

@ -49,13 +49,10 @@ const colorPairs = [
{ bg: "#EBE6FF", text: "#4800BD" }, // Light indigo
];
export function getColor(seed?: string): {
export function getColor(seed: string): {
bgColor: string;
textColor: string;
} {
if (!seed) {
return { bgColor: "#E6F4FF", textColor: "#0065BD" };
}
let hash = 0;
for (let i = 0; i < seed.length; i++) {
hash = seed.charCodeAt(i) + ((hash << 5) - hash);