tahamajs/IE / Projects /front /src /components /collaboration /CollaborativeAvatars.tsx
tahamajs's picture
download
raw
1.49 kB
// src/components/collaboration/CollaborativeAvatars.tsx
import type { CollaborationUser } from "@/lib/collaboration/yjs-setup";
interface Props {
peers: Map<number, CollaborationUser>;
}
export function CollaborativeAvatars({ peers }: Props) {
const peerList = Array.from(peers.values());
if (peerList.length === 0) {
return (
<span className="text-xs text-gray-400 flex items-center gap-1">
<div className="w-2 h-2 rounded-full bg-gray-300" />
Only you
</span>
);
}
return (
<div className="flex items-center gap-1">
<div className="flex -space-x-2">
{peerList.slice(0, 5).map((peer, i) => (
<div
key={i}
className="w-7 h-7 rounded-full border-2 border-white dark:border-gray-900 flex items-center justify-center text-white text-xs font-bold shadow-sm"
style={{ backgroundColor: peer.color }}
title={peer.name}
>
{peer.name[0]?.toUpperCase() ?? "?"}
</div>
))}
{peerList.length > 5 && (
<div className="w-7 h-7 rounded-full bg-gray-200 dark:bg-gray-700 border-2 border-white dark:border-gray-900 flex items-center justify-center text-xs text-gray-600 dark:text-gray-300">
+{peerList.length - 5}
</div>
)}
</div>
<span className="text-xs text-gray-500 ml-1">
{peerList.length} collaborator{peerList.length > 1 ? "s" : ""}
</span>
</div>
);
}

Xet Storage Details

Size:
1.49 kB
·
Xet hash:
a68d395e5fb830de092e5d8689a35cfd32834f07169fd481d914e268fb04c5fd

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.