ConceptPortal-public/rsconcept/frontend/src/components/Shared/InfoLibraryItem.tsx

40 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-11-30 02:14:24 +03:00
import { useIntl } from 'react-intl';
import { useUsers } from '@/context/UsersContext';
import { ILibraryItemEx } from '@/models/library';
2023-11-30 02:14:24 +03:00
interface InfoLibraryItemProps {
2023-12-28 14:04:44 +03:00
item?: ILibraryItemEx;
2023-11-30 02:14:24 +03:00
}
function InfoLibraryItem({ item }: InfoLibraryItemProps) {
const { getUserLabel } = useUsers();
const intl = useIntl();
return (
2023-12-28 14:04:44 +03:00
<div className='flex flex-col gap-1'>
<div className='flex'>
<label className='font-semibold'>Владелец:</label>
<span className='min-w-[200px] ml-2 overflow-ellipsis overflow-hidden whitespace-nowrap'>
{getUserLabel(item?.owner ?? null)}
</span>
</div>
<div className='flex'>
<label className='font-semibold'>Отслеживают:</label>
<span id='subscriber-count' className='ml-2'>
{item?.subscribers.length ?? 0}
</span>
</div>
<div className='flex'>
<label className='font-semibold'>Дата обновления:</label>
<span className='ml-2'>{item && new Date(item?.time_update).toLocaleString(intl.locale)}</span>
</div>
<div className='flex'>
<label className='font-semibold'>Дата создания:</label>
<span className='ml-8'>{item && new Date(item?.time_create).toLocaleString(intl.locale)}</span>
</div>
2023-11-30 02:14:24 +03:00
</div>
2023-12-28 14:04:44 +03:00
);
2023-11-30 02:14:24 +03:00
}
export default InfoLibraryItem;