implemented organisation features

This commit is contained in:
2026-01-24 19:44:40 +00:00
parent c37c3742b9
commit f65ad0c593
8 changed files with 120 additions and 106 deletions

View File

@@ -1,5 +1,6 @@
import { useSession } from "@/components/session-provider";
import Icon from "@/components/ui/icon";
import { useSelectedOrganisation } from "@/lib/query/hooks";
import { cn } from "@/lib/utils";
const FALLBACK_COLOURS = [
@@ -59,6 +60,7 @@ export default function Avatar({
className?: string;
}) {
// if the username matches the authed user, use their avatarURL and name (avoid stale data)
const selectedOrganisation = useSelectedOrganisation();
const { user } = useSession();
const avatarURL = !strong && username && user && username === user.username ? user.avatarURL : _avatarURL;
const name = !strong && username && user && username === user.username ? user.name : _name;
@@ -73,14 +75,15 @@ export default function Avatar({
"flex items-center justify-center rounded-full",
"text-white font-medium select-none",
name && "border",
!avatarURL && backgroundClass,
(!avatarURL || !selectedOrganisation?.Organisation.features.userAvatars) && backgroundClass,
"transition-colors",
`w-${size || 6}`,
`h-${size || 6}`,
className,
)}
>
{avatarURL ? (
{selectedOrganisation?.Organisation.features.userAvatars && avatarURL ? (
<img
src={avatarURL}
alt="Avatar"