refactor(ui): recent: add a quick button to remove item from recent
This commit is contained in:
@@ -30,3 +30,20 @@ export async function clearRecent(): Promise<void> {
|
||||
});
|
||||
if (!res.ok) throw new Error(`clear recent failed: ${res.status}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a single item from the caller's recent history — the "broom"
|
||||
* per-row affordance in the recent view. Distinct from `clearRecent`
|
||||
* (which wipes every entry). 404 means the item wasn't in recents to
|
||||
* begin with — treated as a no-op success by the caller.
|
||||
*/
|
||||
export async function removeFromRecent(kind: ItemType, id: string): Promise<void> {
|
||||
const res = await apiFetch(`/api/recent/${encodeURIComponent(kind)}/${encodeURIComponent(id)}`, {
|
||||
method: 'DELETE',
|
||||
credentials: 'same-origin',
|
||||
headers: getCsrfHeaders()
|
||||
});
|
||||
if (!res.ok && res.status !== 404) {
|
||||
throw new Error(`remove from recent failed: ${res.status}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -753,6 +753,11 @@
|
||||
position: static;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
/* `margin: 0` overrides the legacy `.files-grid-view .file-item
|
||||
.btn-action { margin-top: var(--space-1) }` rule further down —
|
||||
inside the corner cluster the parent's `gap` handles spacing
|
||||
and any per-child margin would misalign the pills. */
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: var(--radius-full);
|
||||
@@ -1188,6 +1193,11 @@
|
||||
color: var(--color-text-dark);
|
||||
}
|
||||
|
||||
/* Legacy: a margin-top on `.btn-action` in grid view for the era when
|
||||
these buttons flowed at the bottom of the card. Kept for any
|
||||
free-standing use outside the corner cluster; reset inside
|
||||
`.action-cell` (line ~745) so the broom / restore / delete pills
|
||||
align with the kebab and star. */
|
||||
.files-grid-view .file-item .btn-action {
|
||||
margin-top: var(--space-1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user