feat(ext/popup): add "View history" link to login detail view

Shows button when item.field_history is non-empty. Navigates to
field-history screen with historyItemId set.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
adlee-was-taken
2026-04-27 00:32:16 -04:00
parent 3b4788e5dc
commit 2fa54e2144

View File

@@ -77,6 +77,7 @@ export async function renderDetail(app: HTMLElement, item: Item): Promise<void>
${renderAttachmentsDisclosure({ itemId: item.id, attachments: item.attachments, mode: 'view' })} ${renderAttachmentsDisclosure({ itemId: item.id, attachments: item.attachments, mode: 'view' })}
<div class="form-actions" style="margin-top:14px;"> <div class="form-actions" style="margin-top:14px;">
<button class="btn" id="back-btn">back</button> <button class="btn" id="back-btn">back</button>
${Object.keys(item.field_history).length > 0 ? '<button class="btn" id="history-btn">view history</button>' : ''}
<button class="btn" id="edit-btn">edit</button> <button class="btn" id="edit-btn">edit</button>
<button class="btn" id="fill-btn">autofill</button> <button class="btn" id="fill-btn">autofill</button>
<button class="btn danger" id="trash-btn">trash</button> <button class="btn danger" id="trash-btn">trash</button>
@@ -91,6 +92,10 @@ export async function renderDetail(app: HTMLElement, item: Item): Promise<void>
teardown(); teardown();
navigate('list'); navigate('list');
}); });
document.getElementById('history-btn')?.addEventListener('click', () => {
setState({ historyItemId: item.id });
navigate('field-history');
});
document.getElementById('edit-btn')?.addEventListener('click', () => { document.getElementById('edit-btn')?.addEventListener('click', () => {
teardown(); teardown();
navigate('edit'); navigate('edit');