Files
loki/widget/panel-views.ts
Cato 25ae3de0e5 Make the Loki site widget one clear conversation (#1229)
* Improve widget conversation and mobile feedback flow

* Update widget layout assertion for simplified header
2026-10-16 07:50:05 +00:00

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;
}