mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Fix: Home and team page style adjustment, and some bug fixes #10703 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
67 lines
1.8 KiB
TypeScript
67 lines
1.8 KiB
TypeScript
import { RAGFlowAvatar } from '@/components/ragflow-avatar';
|
|
import { Card, CardContent } from '@/components/ui/card';
|
|
import { formatDate } from '@/utils/date';
|
|
import { ReactNode } from 'react';
|
|
|
|
interface IProps {
|
|
data: {
|
|
name: string;
|
|
description?: string;
|
|
avatar?: string;
|
|
update_time?: string | number;
|
|
};
|
|
onClick?: () => void;
|
|
moreDropdown: React.ReactNode;
|
|
sharedBadge?: ReactNode;
|
|
icon?: React.ReactNode;
|
|
}
|
|
export function HomeCard({
|
|
data,
|
|
onClick,
|
|
moreDropdown,
|
|
sharedBadge,
|
|
icon,
|
|
}: IProps) {
|
|
return (
|
|
<Card
|
|
onClick={() => {
|
|
// navigateToSearch(data?.id);
|
|
onClick?.();
|
|
}}
|
|
>
|
|
<CardContent className="p-4 flex gap-2 items-start group h-full w-full">
|
|
<div className="flex justify-between mb-4">
|
|
<RAGFlowAvatar
|
|
className="w-[32px] h-[32px]"
|
|
avatar={data.avatar}
|
|
name={data.name}
|
|
/>
|
|
</div>
|
|
<div className="flex flex-col justify-between gap-1 flex-1 h-full w-[calc(100%-50px)]">
|
|
<section className="flex justify-between">
|
|
<section className="flex flex-1 min-w-0 gap-1 items-center">
|
|
<div className="text-base font-bold leading-snug truncate">
|
|
{data.name}
|
|
</div>
|
|
{icon}
|
|
</section>
|
|
{moreDropdown}
|
|
</section>
|
|
|
|
<section className="flex flex-col gap-1 mt-1">
|
|
<div className="whitespace-nowrap overflow-hidden text-ellipsis">
|
|
{data.description}
|
|
</div>
|
|
<div className="flex justify-between items-center">
|
|
<p className="text-sm opacity-80 whitespace-nowrap">
|
|
{formatDate(data.update_time)}
|
|
</p>
|
|
{sharedBadge}
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
}
|