Slice 12: inline command-result toasts
New <toast-host> overlay: components post 'toast' CustomEvents ({message, kind: success|error|info}) and it shows brief, auto-dismissing, bottom-right toasts (errors linger). <repo-menu> (git + coordination actions) and <pr-list> (create/merge) now post friendly success/error toasts instead of alert(); the activity feed still logs everything. Also adds the slice 11 CHANGELOG entry. Verified live: 'Checked for updates' toast shown.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -59,12 +59,17 @@ class PRList extends HTMLElement {
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.error || `HTTP ${res.status}`);
|
||||
this.#toast(`Merged & cleaned up PR #${pr.number}`, 'success');
|
||||
this.#load(this.#path); // refresh the list
|
||||
} catch (err) {
|
||||
this.#error(`Merge failed: ${err.message}`);
|
||||
this.#toast(`Merge failed: ${err.message}`, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
#toast(message, kind) {
|
||||
document.dispatchEvent(new CustomEvent('toast', { detail: { message, kind } }));
|
||||
}
|
||||
|
||||
async #create() {
|
||||
const branch = this.#repo?.branch;
|
||||
if (!branch) return;
|
||||
@@ -78,9 +83,10 @@ class PRList extends HTMLElement {
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.error || `HTTP ${res.status}`);
|
||||
this.#toast(`Opened PR #${data.number}`, 'success');
|
||||
this.#load(this.#path); // refresh so the new PR appears
|
||||
} catch (err) {
|
||||
window.alert(`Create PR failed: ${err.message}`);
|
||||
this.#toast(`Create PR failed: ${err.message}`, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user