// SPDX-FileCopyrightText: 2024 John Livingston // // SPDX-License-Identifier: AGPL-3.0-only // FIXME: @stylistic/indent is buggy with strings literrals. /* eslint-disable @stylistic/indent */ import type { LivechatTokenListElement } from '../token-list' import { html, TemplateResult } from 'lit' import { unsafeHTML } from 'lit/directives/unsafe-html.js' import { repeat } from 'lit/directives/repeat.js' import { ptTr } from '../../directives/translation' import { AddSVG, RemoveSVG } from '../../buttons' export function tplTokenList (el: LivechatTokenListElement): TemplateResult { return html`
${ repeat(el.tokenList ?? [], (token) => token.id, (token) => { let dateStr = '' try { const date = new Date(token.date) dateStr = date.toLocaleDateString() + ' ' + date.toLocaleTimeString() } catch (_err) {} return html`` }) }
${ptTr(LOC_TOKEN_LABEL)} ${ptTr(LOC_TOKEN_DATE)}
${ el.mode === 'select' ? html` el.selectToken(ev, token)} />` : '' }
` }