import { useTranslation } from 'react-i18next'
import getMeta from '@/utils/meta'
import OLCol from '@/features/ui/components/ol/ol-col'
import OLRow from '@/features/ui/components/ol/ol-row'
import OLTooltip from '@/features/ui/components/ol/ol-tooltip'
import { formatDate, fromNowDate } from '../../../utils/dates'
import { cleanHtml } from '../../../../../modules/template-gallery/app/src/CleanHtml.mjs'
import { useTemplateContext } from '../context/template-context'
import DeleteTemplateButton from './delete-template-button'
import EditTemplateButton from './edit-template-button'
function TemplateDetails() {
const { t } = useTranslation()
const {template, setTemplate} = useTemplateContext()
const lastUpdatedDate = fromNowDate(template.lastUpdated)
const tooltipText = formatDate(template.lastUpdated)
const loggedInUserId = getMeta('ol-user_id')
const loggedInUserIsAdmin = getMeta('ol-userIsAdmin')
const openAsTemplateParams = new URLSearchParams({
version: template.version,
...(template.brandVariationId && { brandVariationId: template.brandVariationId }),
name: template.name,
compiler: template.compiler,
mainFile: template.mainFile,
language: template.language,
...(template.imageName && { imageName: template.imageName })
}).toString()
const sanitizedAuthor = cleanHtml(template.author, 'linksOnly') || t('anonymous')
const sanitizedDescription = cleanHtml(template.description, 'reachText')
return (
<>
{template.name}