mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
Fix more types - specifically in components/templates. This is done by removing eslint-ignores and fixing them.
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
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)}
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
>{`${item.date_updated && item.date_updated !== item.date_created ? 'updated' : 'posted'} ${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>
|
|
)
|
|
}
|