Versie 0.2.0

This commit is contained in:
Atreides Assets committed 2026-10-29 11:57:29 +01:00
commit e77d8fd373
495 files changed
+81026

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
// Generated, do not edit. sha256:514022a1fc2c9eb3b97d3f6069234344075741ea67baafe13687b608706d1657
import { appSetting } from '../app-settings.js';
import { ENUMS } from '../../shared/config.js';
const veld = (a, eigen, alias) => String((eigen in a ? a[eigen] : (alias in a ? a[alias] : '')) ?? '').trim();
const zelfde = (name, symbol) => !!name && name.toLowerCase() === symbol.toLowerCase();
export function assetLabel(a) {
if (!a) return '';
const name = veld(a, 'name', 'asset_name');
const symbol = veld(a, 'symbol', 'asset_symbol');
const showName = appSetting('asset_show_name') === 1;
const showSymbol = appSetting('asset_show_symbol') === 1;
if (showName && showSymbol) return name && symbol && !zelfde(name, symbol) ? `${name} (${symbol})` : (name || symbol);
if (showName) return name || symbol;
return symbol || name;
}
export function byKindAndLabel(a, b) {
const soort = x => { const i = ENUMS.ASSET_KIND.indexOf(x && x.kind); return i === -1 ? Number.MAX_SAFE_INTEGER : i; };
return soort(a) - soort(b)
|| assetLabel(a).localeCompare(assetLabel(b), 'nl', { sensitivity: 'base' })
|| String(a.symbol || '').localeCompare(String(b.symbol || ''));
}
export function assetLabelHtml(a, { withoutSymbol = false } = {}) {
if (!a) return '';
const e = s => String(s ?? '').trim().replace(/&/g, '&amp;').replace(/</g, '&lt;');
const name = e(veld(a, 'name', 'asset_name'));
const symbol = e(veld(a, 'symbol', 'asset_symbol'));
const showName = appSetting('asset_show_name') === 1;
const showSymbol = appSetting('asset_show_symbol') === 1;
const nm = txt => `<span class="asset-name">${txt}</span>`;
if (withoutSymbol) return nm(showName ? (name || symbol) : (symbol || name));
if (showName && showSymbol && name && symbol && !zelfde(name, symbol)) return `${nm(name)} <span class="t-muted-cell">${symbol}</span>`;
if (showName) return nm(name || symbol);
return nm(symbol || name);
}