2023-11-30 02:14:24 +03:00
|
|
|
import { useIntl } from 'react-intl';
|
|
|
|
|
2023-12-13 14:32:57 +03:00
|
|
|
import { useUsers } from '@/context/UsersContext';
|
|
|
|
import { ILibraryItemEx } from '@/models/library';
|
2023-11-30 02:14:24 +03:00
|
|
|
|
2024-01-04 19:38:12 +03:00
|
|
|
import LabeledValue from './ui/LabeledValue';
|
2023-12-30 19:43:24 +03:00
|
|
|
|
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'>
|
2023-12-30 19:43:24 +03:00
|
|
|
<LabeledValue label='Владелец' text={getUserLabel(item?.owner ?? null)} />
|
|
|
|
<LabeledValue label='Отслеживают' text={item?.subscribers.length ?? 0} />
|
|
|
|
<LabeledValue
|
|
|
|
label='Дата обновления'
|
|
|
|
text={item ? new Date(item?.time_update).toLocaleString(intl.locale) : ''}
|
|
|
|
/>
|
|
|
|
<LabeledValue label='Дата создания' text={item ? new Date(item?.time_create).toLocaleString(intl.locale) : ''} />
|
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;
|