fix(ext/popup): replace emoji typeIcon with glyph constants in item-list

This commit is contained in:
adlee-was-taken
2026-05-03 21:01:38 -04:00
parent c5e8b52e12
commit 117716f6cf

View File

@@ -3,7 +3,11 @@
/// to the detail view. /// to the detail view.
import { getState, setState, sendMessage, navigate, escapeHtml, openVaultTab } from '../../shared/state'; import { getState, setState, sendMessage, navigate, escapeHtml, openVaultTab } from '../../shared/state';
import { GLYPH_VAULT_TAB } from '../../shared/glyphs'; import {
GLYPH_VAULT_TAB,
GLYPH_TYPE_LOGIN, GLYPH_TYPE_SECURE_NOTE, GLYPH_TYPE_TOTP,
GLYPH_TYPE_CARD, GLYPH_TYPE_IDENTITY, GLYPH_TYPE_KEY, GLYPH_TYPE_DOCUMENT,
} from '../../shared/glyphs';
import type { ItemId, ItemType, ManifestEntry, Item } from '../../shared/types'; import type { ItemId, ItemType, ManifestEntry, Item } from '../../shared/types';
/// Extract the display hostname from an icon_hint or fallback to the first tag. /// Extract the display hostname from an icon_hint or fallback to the first tag.
@@ -13,16 +17,16 @@ function metaLine(e: ManifestEntry): string {
return ''; return '';
} }
/// Emoji icon per item type. Placeholder until we ship real SVG icons. /// Glyph icon per item type.
function typeIcon(t: ItemType): string { function typeIcon(t: ItemType): string {
switch (t) { switch (t) {
case 'login': return '🔑'; case 'login': return GLYPH_TYPE_LOGIN;
case 'secure_note': return '📝'; case 'secure_note': return GLYPH_TYPE_SECURE_NOTE;
case 'identity': return '🪪'; case 'identity': return GLYPH_TYPE_IDENTITY;
case 'card': return '💳'; case 'card': return GLYPH_TYPE_CARD;
case 'key': return '🗝'; case 'key': return GLYPH_TYPE_KEY;
case 'document': return '📄'; case 'document': return GLYPH_TYPE_DOCUMENT;
case 'totp': return '⏱'; case 'totp': return GLYPH_TYPE_TOTP;
} }
} }
@@ -32,7 +36,7 @@ function buildRowsHtml(): string {
return filtered.length > 0 return filtered.length > 0
? filtered.map(([id, e], i) => ` ? filtered.map(([id, e], i) => `
<div class="entry-row ${i === state.selectedIndex ? 'selected' : ''}" data-id="${escapeHtml(id)}" data-index="${i}"> <div class="entry-row ${i === state.selectedIndex ? 'selected' : ''}" data-id="${escapeHtml(id)}" data-index="${i}">
<span class="entry-name"><span class="type-icon" aria-hidden="true">${typeIcon(e.type)}</span> ${escapeHtml(e.title)}${e.attachment_summaries.length > 0 ? ' <span class="entry-row__attach-indicator" title="has attachments">📎</span>' : ''}</span> <span class="entry-name"><span class="type-icon" aria-hidden="true">${typeIcon(e.type)}</span> ${escapeHtml(e.title)}${e.attachment_summaries.length > 0 ? ' <span class="entry-row__attach-indicator" title="has attachments"></span>' : ''}</span>
<span class="entry-meta">${escapeHtml(metaLine(e))}</span> <span class="entry-meta">${escapeHtml(metaLine(e))}</span>
</div> </div>
`).join('') `).join('')