All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Wrap 7 list-item/card components with React.memo to prevent unnecessary re-renders when parent components update but props remain unchanged: - TaskItem (task lists) - EventCard (calendar views) - EntryCard (knowledge base) - WorkspaceCard (workspace list) - TeamCard (team list) - DomainItem (domain list) - ConnectionCard (federation connections) All are pure components rendered inside .map() loops that depend solely on their props for rendering output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import React from "react";
|
|
import type { Team } from "@mosaic/shared";
|
|
import { Card, CardHeader, CardContent } from "@mosaic/ui";
|
|
import Link from "next/link";
|
|
|
|
interface TeamCardProps {
|
|
team: Team;
|
|
workspaceId: string;
|
|
}
|
|
|
|
export const TeamCard = React.memo(function TeamCard({
|
|
team,
|
|
workspaceId,
|
|
}: TeamCardProps): React.JSX.Element {
|
|
return (
|
|
<Link href={`/settings/workspaces/${workspaceId}/teams/${team.id}`}>
|
|
<Card className="hover:shadow-lg transition-shadow cursor-pointer">
|
|
<CardHeader>
|
|
<h3 className="text-lg font-semibold text-gray-900">{team.name}</h3>
|
|
</CardHeader>
|
|
<CardContent>
|
|
{team.description ? (
|
|
<p className="text-sm text-gray-600">{team.description}</p>
|
|
) : (
|
|
<p className="text-sm text-gray-400 italic">No description</p>
|
|
)}
|
|
<div className="mt-3 flex items-center gap-2 text-xs text-gray-500">
|
|
<span>Created {new Date(team.createdAt).toLocaleDateString()}</span>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
</Link>
|
|
);
|
|
});
|