mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 08:58:25 +01:00
* Improve widget conversation and mobile feedback flow * Update widget layout assertion for simplified header
21 lines
728 B
TypeScript
21 lines
728 B
TypeScript
/**
|
|
* Small, self-contained panel pieces that main.ts only places. Each returns
|
|
* elements and takes callbacks; none holds panel state.
|
|
*/
|
|
import { h } from "./dom";
|
|
|
|
/** Shown after a visitor hides the launcher: how to undo it, now and later. */
|
|
export function showHideToast(root: ShadowRoot, onUndo: () => void): HTMLElement {
|
|
const toast = h("div", "toast");
|
|
toast.setAttribute("role", "status");
|
|
const undo = h("button", "toast-undo", "Undo");
|
|
undo.addEventListener("click", onUndo);
|
|
toast.append(
|
|
h("span", undefined, "Loki is hidden on this site. Add #loki to the address to bring it back."),
|
|
undo,
|
|
);
|
|
root.appendChild(toast);
|
|
window.setTimeout(() => toast.remove(), 10_000);
|
|
return toast;
|
|
}
|