mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
removed obsolete eslint disables fixed a type problem another type problem type check
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
|
import { useState } from 'react'
|
|
|
|
import { timeAgo } from '#utils/TimeAgo'
|
|
|
|
import type { Item } from '#types/Item'
|
|
|
|
export const DateUserInfo = ({ item }: { item: Item }) => {
|
|
const [infoExpanded, setInfoExpanded] = useState<boolean>(false)
|
|
return (
|
|
<div
|
|
className='tw-flex -tw-mb-1 tw-flex-row tw-mr-2 -tw-mt-2'
|
|
onClick={(e) => e.stopPropagation()}
|
|
>
|
|
{infoExpanded ? (
|
|
<p
|
|
className={'tw-italic tw-min-h-[21px] !tw-my-0 tw-text-gray-500'}
|
|
onClick={() => setInfoExpanded(false)}
|
|
>{`${item.date_updated && item.date_updated !== item.date_created ? 'updated' : 'posted'} ${item && item.user_created && item.user_created.first_name ? `by ${item.user_created.first_name}` : ''} ${item.date_updated ? timeAgo(item.date_updated) : timeAgo(item.date_created!)}`}</p>
|
|
) : (
|
|
<p
|
|
className='!tw-my-0 tw-min-h-[21px] tw-font-bold tw-cursor-pointer tw-text-gray-500'
|
|
onClick={() => setInfoExpanded(true)}
|
|
>
|
|
ⓘ
|
|
</p>
|
|
)}
|
|
<div className='tw-grow '></div>
|
|
</div>
|
|
)
|
|
}
|