// SPDX-FileCopyrightText: 2024 John Livingston // // SPDX-License-Identifier: AGPL-3.0-only 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: string = '' 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)} />` : '' }
` }