Files
AtreidesAssetsFree/client/ui/lock.js
T

37 lines
1.4 KiB
JavaScript
Raw Normal View History

2026-10-29 15:24:06 +01:00
// Generated, do not edit. sha256:d2bc926ea0bee8d8465cb325428dc8ec0f61a809df8e09696d2ce30fb50111c2
2026-10-29 11:57:29 +01:00
import { esc } from './escape.js';
import { SHIELD } from './icons.js';
import { t } from '../i18n/index.js';
import { TARGETS, targetHash } from '../../shared/config.js';
2026-10-29 15:24:06 +01:00
import { limitFor, counterText } from '../license.js';
2026-10-29 11:57:29 +01:00
export function lockIcon(title = t('license.lockedTitle')) {
return `<span class="lock-icon" title="${esc(title)}" aria-label="${esc(title)}">${SHIELD}</span>`;
}
export function lockPanelHtml(what) {
const href = targetHash(TARGETS.LICENSE);
return `<div class="lock-panel">
<div class="lock-panel-head">${lockIcon()}<span>${esc(t('license.lockedTitle'))}</span></div>
<p class="lock-panel-what">${esc(what)}</p>
<p class="lock-panel-more"><a href="${esc(href)}">${esc(t('license.whatIsPaid'))}</a></p>
</div>`;
}
export function lockNoteHtml(what) {
return `<div class="lock-note">${lockIcon()}<span>${esc(what)}</span> `
+ `<a href="${esc(targetHash(TARGETS.LICENSE))}">${esc(t('license.whatIsPaid'))}</a></div>`;
}
export function counterHtml(text) {
return text ? `<span class="lock-counter">${esc(text)}</span>` : '';
}
export function capacityCfg(kind, used) {
const max = limitFor(kind);
if (max === null) return {};
return {
2026-10-29 15:24:06 +01:00
toolbarNote: () => counterText(kind, used()),
2026-10-29 11:57:29 +01:00
createHidden: () => used() >= max,
};
}