feat(ext/popup): empty states with glyph icons in item-list
This commit is contained in:
@@ -34,14 +34,30 @@ function typeIcon(t: ItemType): string {
|
|||||||
function buildRowsHtml(): string {
|
function buildRowsHtml(): string {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const filtered = getFilteredEntries();
|
const filtered = getFilteredEntries();
|
||||||
return filtered.length > 0
|
if (filtered.length > 0) {
|
||||||
? filtered.map(([id, e], i) => `
|
return 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('');
|
||||||
: '<div class="empty">no items</div>';
|
}
|
||||||
|
if (state.searchQuery) {
|
||||||
|
return `
|
||||||
|
<div class="empty-state">
|
||||||
|
<span class="empty-state__icon" aria-hidden="true">⊘</span>
|
||||||
|
<div class="empty-state__title">No results for "${escapeHtml(state.searchQuery)}"</div>
|
||||||
|
<div class="empty-state__hint">Try a shorter search term.</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
return `
|
||||||
|
<div class="empty-state">
|
||||||
|
<span class="empty-state__icon" aria-hidden="true">◈</span>
|
||||||
|
<div class="empty-state__title">No items yet</div>
|
||||||
|
<div class="empty-state__hint">Press <kbd>+</kbd> to add your first item.</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateItemList(): void {
|
function updateItemList(): void {
|
||||||
|
|||||||
@@ -1608,3 +1608,30 @@ textarea {
|
|||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
background: var(--bg-input);
|
background: var(--bg-input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 40px 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state__icon {
|
||||||
|
font-size: 28px;
|
||||||
|
color: var(--text-muted, #8b949e);
|
||||||
|
margin-bottom: 12px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state__title {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state__hint {
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--text-muted, #8b949e);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user