diff --git a/CHANGELOG.md b/CHANGELOG.md index e2c2abe6c..6d6809ea9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ The backend (`fastapi_backend`) and the frontend (`nextjs-frontend`) are version ## Unreleased +- **The Ask button no longer covers buttons.** The floating Ask button at the bottom right used to sit on whatever was + there, such as Import on the Import page. Now, when a button or field is under it and scrolling can't move it clear + (a row of buttons pinned to the bottom of the screen, or the last button on a page scrolled to its end), the Ask + button rises above it, and steps out of sight when there's no room to rise. Dialogs, drawers and toasts drawn over + it don't move it. The clicks survey now fails a journey whose control the Ask button covers, and checks every page + for it ([Chat on any page](docs/assistant.md)). - **Google Calendar as a sensor.** Add a Google Calendar connection on the Sources page (or `POST /api/v1/sources` with type `gcal`): each calendar is a folder and each event becomes text, as an iCal feed's do, read-only through Google's Calendar API. It signs in as a Google account (an OAuth client's authorized user JSON) or as a service diff --git a/ci/clicks/README.md b/ci/clicks/README.md index 943ed2a92..cb2b5dac1 100644 --- a/ci/clicks/README.md +++ b/ci/clicks/README.md @@ -32,10 +32,13 @@ rclone must be on the PATH, as it is in the Lens image (the Clicks workflow copi navigation). - **Outside the browser**: steps in the terminal, the assistant being connected or the browser's print dialog are counted on the page `(outside the browser)`. -- A step whose control is covered by something else (the floating Ask button) is still one click, marked - "covered" in the steps. +- A step whose control is covered by something else (a toast) is still one click, marked "covered" in the steps. A + control the floating Ask button covers fails the journey: the button rises above controls in its corner, or steps + aside, so that's a bug. - **Per page**: reach is clicks from Home through the sidebar (sections and tabs are two); controls are the buttons, - links and fields in the page's main area on a fresh install, not counting navigation. + links and fields in the page's main area on a fresh install, not counting navigation. Each page is also scrolled to + its end and checked for controls the floating Ask button lies over; any fails the run ("Covered by the Ask button" + in the results). Journeys run in order on the same Lens, each from Home unless it continues the one before (setup does). A journey that can't be done at all (on a phone, say, where a control is hidden) fails with the reason; it is in the baseline diff --git a/ci/clicks/journeys.mjs b/ci/clicks/journeys.mjs index e42d83845..c8d181513 100644 --- a/ci/clicks/journeys.mjs +++ b/ci/clicks/journeys.mjs @@ -670,6 +670,10 @@ export const JOURNEYS = [ from: "/", async run(ctx) { const { page, meter } = ctx; + // An entity is in the graph once something links it twice (graph.min_edge_weight), which takes import-file's + // pi-episode as well; a slow machine can still be reading it here, so wait for the jobs to finish (not counted) + const idle = page.getByRole("button", { name: /^Activity: (Nothing running|\d+ failed)$/ }); + await madeInBackground(ctx, "/", idle, "/", "the imports' jobs finished"); await go(ctx, "Graph"); const find = page.getByRole("combobox", { name: "Find in graph" }); await page.getByRole("region", { name: "Graph" }).waitFor(); diff --git a/ci/clicks/meter.mjs b/ci/clicks/meter.mjs index 4101cd142..effbcb8e9 100644 --- a/ci/clicks/meter.mjs +++ b/ci/clicks/meter.mjs @@ -29,6 +29,13 @@ function hasFocus(el) { return Boolean(el.isContentEditable && active?.contains(el) && caret && el.contains(caret)); } +/** The floating Ask button lies over the middle of `el`, where a click lands. */ +function coveredByAsk(el) { + const r = el.getBoundingClientRect(); + const top = document.elementFromPoint(r.left + r.width / 2, r.top + r.height / 2); + return Boolean(top?.closest("[data-ask-button]")); +} + export class Meter { /** `touch`: a phone, where clicks are taps and bringing a control into view takes a swipe. */ constructor(page, { touch = false } = {}) { @@ -103,9 +110,11 @@ export class Meter { try { await this.tapOrClick(locator, { trial: true, timeout: 2000 }); } catch { - // Something still lies over it (the floating Ask button, a toast). The step notes it; the click still counts - // one, done here with the keyboard so it reaches the control rather than what covers it. + // The floating Ask button rises above controls (or steps aside), so it covering one is a failure. Anything else + // lying over it (a toast) is noted in the step; the click still counts one, done here with the keyboard so it + // reaches the control rather than what covers it. await locator.waitFor({ state: "visible" }); + if (await locator.evaluate(coveredByAsk)) throw new Error(`${what} is covered by the floating Ask button`); const step = this.journey?.steps.at(-1); if (step) step.what += " (covered by something else on the page)"; await locator.focus(); diff --git a/ci/clicks/report.mjs b/ci/clicks/report.mjs index 276a465db..7e34efba1 100644 --- a/ci/clicks/report.mjs +++ b/ci/clicks/report.mjs @@ -100,6 +100,11 @@ export function markdown(result, base) { lines.push( `| **All** | **${result.journeys.length} features** | **${sum.clicks}** | **${sum.keys}** | **${sum.prompts}** |${sw(`**${sum.swipes}**`)} **${sum.clicks + sum.keys + sum.prompts + sum.swipes}** | |`, ); + const covered = (result.pages || []).filter((p) => p.askCovers?.length); + if (covered.length) { + lines.push("", "## Covered by the Ask button", "", "With the page at its end, the floating Ask button lies over these:", ""); + for (const p of covered) lines.push(`- ${p.label} (\`${p.page}\`): ${p.askCovers.join(", ")}`); + } lines.push("", "## Per module", "", `| Module | Features | ${Clicks} | Keys | Prompts |${sw("Swipes")}`, `|---|--:|--:|--:|--:|${sw("--:")}`); for (const m of modules) { const js = result.journeys.filter((x) => x.module === m); diff --git a/ci/clicks/survey.mjs b/ci/clicks/survey.mjs index 4bae8c1bc..3aea07b87 100644 --- a/ci/clicks/survey.mjs +++ b/ci/clicks/survey.mjs @@ -87,6 +87,41 @@ async function surveyPages(page, base, phone) { return seen.filter((el) => el.offsetParent !== null && !el.closest("[hidden], nav, details:not([open]) > :not(summary)")).length; }); const settle = () => page.waitForTimeout(1200); + // The controls the floating Ask button covers with the page (and anything scrolling in it) at its end, where + // scrolling can't carry them clear: it should rise above them or step aside, so any is a failure. + const askCovers = async () => { + await page.evaluate(() => { + window.scrollTo(0, document.documentElement.scrollHeight); + for (const el of document.querySelectorAll("main *")) + if (el.scrollHeight > el.clientHeight && /(auto|scroll)/.test(getComputedStyle(el).overflowY)) el.scrollTop = el.scrollHeight; + }); + await page.waitForTimeout(600); // the button moves on the next frame, then slides + return page.evaluate(() => { + const ask = document.querySelector("[data-ask-button]"); + if (!ask || getComputedStyle(ask).visibility === "hidden") return []; + const a = ask.getBoundingClientRect(); + const out = []; + const all = "a[href], button, input:not([type=hidden]), select, textarea, [role=tab], [role=switch], [role=checkbox], [role=radio]"; + for (const el of document.querySelectorAll(all)) { + if (el.closest("[data-ask-button], [data-page-chat]")) continue; + const r = el.getBoundingClientRect(); + if (r.height > innerHeight / 3) continue; // a big field: the button covers a corner of it (ask-place.ts) + const [x0, x1, y0, y1] = [Math.max(r.left, a.left), Math.min(r.right, a.right), Math.max(r.top, a.top), Math.min(r.bottom, a.bottom)]; + if (x1 - x0 < 4 || y1 - y0 < 4) continue; + // the button is on top there, and right under it is this control (not one a closed fold keeps out of sight) + const [top, ...under] = document.elementsFromPoint((x0 + x1) / 2, (y0 + y1) / 2); + const next = under.find((e) => !e.closest("[data-ask-button]")); + if (top?.closest("[data-ask-button]") && next && el.contains(next)) + out.push((el.getAttribute("aria-label") || el.textContent || el.tagName).replace(/\s+/g, " ").trim().slice(0, 60)); + } + return out; + }); + }; + const visit = async (entry) => { + entry.askCovers = await askCovers(); + if (entry.askCovers.length) console.log(`FAIL ${entry.page}: the Ask button covers ${entry.askCovers.join(", ")}`); + pages.push(entry); + }; await page.goto(base + "/", { waitUntil: "domcontentloaded" }); await settle(); if (phone) await page.getByRole("button", { name: "Open navigation" }).tap(); @@ -108,7 +143,7 @@ async function surveyPages(page, base, phone) { await page.waitForLoadState("domcontentloaded"); await settle(); const key = pageKey(page.url()); - pages.push({ page: key, label: item.label, reach: 1 + menu, controls: await controls() }); + await visit({ page: key, label: item.label, reach: 1 + menu, controls: await controls() }); // a second level: settings sections, and tabs that are links (Admin, Sensors, Pipelines) const sub = await page .locator("main") @@ -120,7 +155,7 @@ async function surveyPages(page, base, phone) { if (!s.href || pages.some((p) => p.page === pageKey(base + s.href))) continue; await page.goto(base + s.href, { waitUntil: "domcontentloaded" }); await settle(); - pages.push({ page: pageKey(page.url()), label: `${item.label} › ${s.label}`, reach: 2 + menu, controls: await controls() }); + await visit({ page: pageKey(page.url()), label: `${item.label} › ${s.label}`, reach: 2 + menu, controls: await controls() }); } } return pages; @@ -214,7 +249,7 @@ async function main() { for (const d of worse) console.log(`worse: ${d.id} ${d.what}`); if (worse.length && a.failOnRegression) process.exitCode = 1; } - if (failed) process.exitCode = 1; + if (failed || pages.some((p) => p.askCovers.length)) process.exitCode = 1; } await main(); diff --git a/docs/assistant.md b/docs/assistant.md index b99b1d390..b472f0fe2 100644 --- a/docs/assistant.md +++ b/docs/assistant.md @@ -45,7 +45,9 @@ then. question (up to 12,000 characters of page text and 4,000 of the highlight) as what the person is looking at, not as citable excerpts. The question keeps the page's address, title and highlight, shown above it; the page's text isn't stored. A recording's transcript and document keep their own selection toolbar, whose Ask in chat goes to the - recording's chat. + recording's chat. The Ask button stays clear of the page's own buttons: when one is under it and scrolling can't + move it away (a row of buttons pinned to the bottom of the screen, or the last button with the page at its end), it + rises above them, or steps out of sight when there's no room to rise. - **No model configured:** chat returns the best-matching passages instead. Anyone signed in can see whether a model is set up, and which (`GET /chats/capabilities`), so the app says so before the first question. diff --git a/docs/frontend.md b/docs/frontend.md index bb22efac8..5d445c44b 100644 --- a/docs/frontend.md +++ b/docs/frontend.md @@ -64,7 +64,13 @@ four-colour loop (Transcribe blue, Diarize red, Analyze green, Summarize and Rep namespace switcher sits at the top of the menu, Import is an icon in the top bar, settings sections open as a list from the current section's name, tabs wrap, and wide tables (sensors, connections) become cards. A form's main buttons take `phone-actions` (`app/globals.css`) to stay pinned at the bottom of the screen, clear of the floating Ask button; - a Dialog's actions stay in sight on their own. The [clicks + a Dialog's actions stay in sight on their own. +* **The floating Ask button** (`components/page-chat/ask-place.ts`) finds what it would cover with the browser's own + hit testing, through a transparent probe just under it, and rises above any control there that scrolling can't + carry clear (one in a bar that's fixed or stuck to the bottom, or with the page at its end), or steps out of sight + when that would take it past the middle of the screen, so a new page needn't leave room for it (`phone-actions` and + the Settings save row still do, and it stays put there). The clicks survey fails a journey whose control it covers, + and checks every page with the page scrolled to its end. The [clicks survey](https://github.com/adeelahmad/lense/blob/main/ci/clicks/README.md) measures every journey on a phone too. * **The role rule:** actions a person can't take stay visible, disabled, with a tooltip saying who can (`needRole()`); namespaces they have no role in never appear. `useArchive()` gives `can(role, ns)` and the diff --git a/nextjs-frontend/__tests__/ask-place.test.tsx b/nextjs-frontend/__tests__/ask-place.test.tsx new file mode 100644 index 000000000..d8c8c68fe --- /dev/null +++ b/nextjs-frontend/__tests__/ask-place.test.tsx @@ -0,0 +1,197 @@ +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { act, render, screen } from "@testing-library/react"; +import "@testing-library/jest-dom"; + +import { Chats } from "@/app/openapi-client"; +import { + AT_REST, + ASK_GAP, + blockersUnder, + controlAround, + placeAsk, + samplePoints, + stuckBar, + type Box, +} from "@/components/page-chat/ask-place"; +import { PageChat } from "@/components/page-chat/page-chat"; +import { TooltipProvider } from "@/components/ui/tooltip"; + +jest.mock("@/app/openapi-client", () => ({ + Chats: { createChat: jest.fn(), getChat: jest.fn(), chatCapabilities: jest.fn(), stopAnswer: jest.fn() }, +})); +jest.mock("next-auth/react", () => ({ useSession: () => ({ data: { accessToken: "t" } }) })); +jest.mock("next/navigation", () => ({ + usePathname: () => "/import", + useSearchParams: () => new URLSearchParams(""), +})); + +// A 1400x900 screen; the button rests 20px from the bottom-right corner, 100x48. +const VIEW = 900; +const box = (top: number, bottom: number, left = 1280, right = 1380): Box => ({ + top, + bottom, + left, + right, + height: bottom - top, +}); +const REST = box(VIEW - 68, VIEW - 20); +/** What getBoundingClientRect gives for a box at (x, y), w by h. */ +const rectAt = (x: number, y: number, w: number, h: number) => + ({ x, y, left: x, top: y, width: w, height: h, right: x + w, bottom: y + h }) as DOMRect; + +describe("placing the Ask button", () => { + it("stays in its corner when nothing is under it", () => { + expect(placeAsk(() => ({ box: REST, blockers: [] }), VIEW)).toEqual(AT_REST); + }); + + it("rises above a row of buttons it would cover, with a gap", () => { + const row = box(VIEW - 70, VIEW); // a sticky Import row, 70px tall + const seen: number[] = []; + const place = placeAsk((lift) => { + seen.push(lift); + const at = box(REST.top - lift, REST.bottom - lift); + return { box: at, blockers: at.bottom > row.top ? [row] : [] }; + }, VIEW); + expect(place).toEqual({ lift: REST.bottom - row.top + ASK_GAP, hidden: false }); + expect(seen).toEqual([0, 62]); // and checks it's clear up there + }); + + it("keeps rising over what it covers next", () => { + const row = box(VIEW - 70, VIEW); + const field = box(VIEW - 130, VIEW - 90); // a field just above the row + const place = placeAsk((lift) => { + const at = box(REST.top - lift, REST.bottom - lift); + return { box: at, blockers: [row, field].filter((b) => at.bottom > b.top && at.top < b.bottom) }; + }, VIEW); + expect(place).toEqual({ lift: REST.bottom - field.top + ASK_GAP, hidden: false }); + }); + + it("steps out of sight rather than rise past the middle of the screen", () => { + const panel = box(VIEW / 2 - 40, VIEW); // controls reaching up past the middle + expect(placeAsk(() => ({ box: REST, blockers: [panel] }), VIEW)).toEqual({ lift: 0, hidden: true }); + }); + + it("samples the whole of its area", () => { + const pts = samplePoints(REST); + expect(pts).toHaveLength(15); + expect(pts[0]).toEqual([REST.left + 3, REST.top + 3]); + expect(pts[14]).toEqual([REST.right - 3, REST.bottom - 3]); + }); +}); + +describe("what counts as covered", () => { + afterEach(() => { + document.body.innerHTML = ""; + }); + + it("knows controls, and clickable rows by their pointer", () => { + // (the word's pointer is the row's, inherited in a browser; jsdom doesn't inherit it) + document.body.innerHTML = `
Row
+

Words

`; + const el = (id: string) => document.getElementById(id)!; + expect(controlAround(el("icon"))).toBe(el("b")); + expect(controlAround(el("word"))).toBe(el("row")); + expect(controlAround(el("i"))).toBe(el("i")); + expect(controlAround(el("l"))).toBeNull(); // the empty end of a label isn't somewhere people tap + expect(controlAround(el("text"))).toBeNull(); + }); + + it("finds the bar a control stays put in: fixed, or sticky to the bottom and stuck there", () => { + document.body.innerHTML = `
+
+
`; + const el = (id: string) => document.getElementById(id)!; + el("bottom").getBoundingClientRect = () => rectAt(0, VIEW - 60, 1400, 60); + Object.defineProperty(window, "innerHeight", { value: VIEW, configurable: true }); + expect(stuckBar(el("a"))).toBe(el("fixed")); + expect(stuckBar(el("b"))).toBeNull(); + expect(stuckBar(el("c"))).toBe(el("bottom")); + // the same sticky row sitting up the page, where scrolling still moves it, isn't stuck + el("bottom").getBoundingClientRect = () => rectAt(0, 300, 1400, 60); + expect(stuckBar(el("c"))).toBeNull(); + }); + + it("covers only what's drawn under the button, and what scrolling can't carry clear", () => { + document.body.innerHTML = `
+
`; + const el = (id: string) => document.getElementById(id)!; + const rect = (top: number, h: number) => () => rectAt(1200, top, 200, h); + el("bar").getBoundingClientRect = rect(VIEW - 70, 70); + el("import").getBoundingClientRect = rect(VIEW - 56, 40); + el("mid").getBoundingClientRect = rect(VIEW - 60, 40); + Object.defineProperty(window, "innerHeight", { value: VIEW, configurable: true }); + const probe = el("probe"); + const under = (stack: Element[]) => { + document.elementsFromPoint = () => stack; + return blockersUnder(probe, REST); + }; + // the sticky row: the button clears the whole row + expect(under([probe, el("import"), el("bar"), document.body])).toEqual([ + { top: VIEW - 70, bottom: VIEW, left: 1200, right: 1400, height: 70 }, + ]); + // drawn over the button (a toast): not its business + expect(under([el("toast").firstElementChild!, probe, document.body])).toEqual([]); + // a button in the page with more page below it: scrolling carries it clear + Object.defineProperty(document.documentElement, "scrollHeight", { value: 3000, configurable: true }); + Object.defineProperty(document.documentElement, "clientHeight", { value: VIEW, configurable: true }); + expect(under([probe, el("mid"), document.body])).toEqual([]); + // the same button with the page at its end: it's covered + Object.defineProperty(document.documentElement, "scrollHeight", { value: VIEW, configurable: true }); + expect(under([probe, el("mid"), document.body])).toEqual([ + { top: VIEW - 60, bottom: VIEW - 20, left: 1200, right: 1400, height: 40 }, + ]); + }); +}); + +describe("the Ask button on a page", () => { + const original = document.elementsFromPoint; + afterEach(() => { + document.elementsFromPoint = original; + localStorage.clear(); + }); + + it("rises above the page's sticky Import row, and settles back when it goes", async () => { + (Chats.chatCapabilities as jest.Mock).mockReturnValue(new Promise(() => {})); + Object.defineProperty(window, "innerHeight", { value: VIEW, configurable: true }); + let rowShown = true; + const qc = new QueryClient(); + const view = render( + + +
+
+ +
+
+ +
+
, + ); + const row = screen.getByTestId("row"); + const importButton = screen.getByRole("button", { name: "Import 2 files" }); + row.getBoundingClientRect = () => rectAt(0, VIEW - 70, 1400, 70); + importButton.getBoundingClientRect = () => rectAt(1240, VIEW - 55, 140, 40); + const ask = screen.getByRole("button", { name: "Chat about this page" }); + const probe = ask.previousElementSibling as HTMLElement; + // the probe sits where the button would be, raised by whatever it's been moved by + probe.getBoundingClientRect = () => { + const lift = -parseFloat((probe.style.translate || "0 0px").split(" ")[1]); + return rectAt(1280, VIEW - 68 - lift, 100, 48); + }; + document.elementsFromPoint = (_x: number, y: number) => + rowShown && y >= VIEW - 70 ? [probe, importButton, row, document.body] : [probe, document.body]; + + act(() => window.dispatchEvent(new Event("resize"))); + await act(() => new Promise((r) => requestAnimationFrame(r))); + expect(ask).toHaveAttribute("data-place", "raised"); + expect(ask.style.translate).toBe(`0 -${VIEW - 20 - (VIEW - 70) + ASK_GAP}px`); + expect(ask).toBeVisible(); + + rowShown = false; + act(() => window.dispatchEvent(new Event("scroll"))); + await act(() => new Promise((r) => requestAnimationFrame(r))); + expect(ask).toHaveAttribute("data-place", "rest"); + expect(ask.style.translate).toBe(""); + view.unmount(); + }); +}); diff --git a/nextjs-frontend/__tests__/update-banner.test.tsx b/nextjs-frontend/__tests__/update-banner.test.tsx new file mode 100644 index 000000000..c3997328f --- /dev/null +++ b/nextjs-frontend/__tests__/update-banner.test.tsx @@ -0,0 +1,29 @@ +import { fireEvent, render, screen } from "@testing-library/react"; +import "@testing-library/jest-dom"; + +import { UpdateBanner } from "@/components/app-shell/update-banner"; + +jest.mock("@/components/settings/updates-panel", () => ({ + useUpdates: () => ({ data: { available: true, current: "0.9.0", latest: { tag: "v0.10.0" }, agent: false } }), +})); + +const room = () => document.documentElement.style.getPropertyValue("--lens-banner"); + +describe("the update banner", () => { + beforeEach(() => localStorage.clear()); + + it("tells pages that fill the screen how much room it takes, and gives it back when dismissed", () => { + render(); + expect(screen.getByText("Lens v0.10.0 is out (this is 0.9.0).")).toBeInTheDocument(); + expect(room()).toMatch(/^\d+px$/); + fireEvent.click(screen.getByRole("button", { name: /dismiss/i })); + expect(screen.queryByText(/is out/)).not.toBeInTheDocument(); + expect(room()).toBe(""); + }); + + it("takes no room for people who aren't admins", () => { + render(); + expect(screen.queryByText(/is out/)).not.toBeInTheDocument(); + expect(room()).toBe(""); + }); +}); diff --git a/nextjs-frontend/components/app-shell/update-banner.tsx b/nextjs-frontend/components/app-shell/update-banner.tsx index b10aca643..ca32df1dc 100644 --- a/nextjs-frontend/components/app-shell/update-banner.tsx +++ b/nextjs-frontend/components/app-shell/update-banner.tsx @@ -1,7 +1,7 @@ "use client"; import Link from "next/link"; -import { useEffect, useState } from "react"; +import { type ReactNode, useEffect, useRef, useState } from "react"; import { useUpdates } from "@/components/settings/updates-panel"; import { Banner } from "@/components/ui/banner"; @@ -12,6 +12,7 @@ const KEY = "lens-update-dismissed"; export function UpdateBanner({ admin }: { admin: boolean }) { const { data: s } = useUpdates(admin); const [dismissed, setDismissed] = useState(null); + const room = useRef(null); useEffect(() => { try { setDismissed(localStorage.getItem(KEY)); @@ -19,35 +20,62 @@ export function UpdateBanner({ admin }: { admin: boolean }) { // private window: shown again next time } }, []); - if (!admin || !s) return null; - const run = s.upgrade; - if (run && ["backing-up", "queued", "running"].includes(run.state) && !run.error) - return ( - + + let banner: ReactNode = null; + const run = s?.upgrade; + const tag = s?.latest?.tag; + if (!admin || !s) banner = null; + else if (run && ["backing-up", "queued", "running"].includes(run.state) && !run.error) + banner = ( + Lens restarts on its own when it’s done.{" "} Follow along ); - const tag = s.latest?.tag; - if (!s.available || !tag || dismissed === tag) return null; + else if (s.available && tag && dismissed !== tag) + banner = ( + { + setDismissed(tag); + try { + localStorage.setItem(KEY, tag); + } catch { + // fine: dismissed for this visit + } + }} + > + + {s.agent ? "See what’s new and install it" : "See what’s new"} + + + ); + + // Pages that fill the screen (Chat, the graph, a recording) leave the banner its room: --lens-banner is its height + const shown = banner != null; + useEffect(() => { + const root = document.documentElement; + const el = room.current; + if (!shown || !el) { + root.style.removeProperty("--lens-banner"); + return; + } + const set = () => root.style.setProperty("--lens-banner", `${el.offsetHeight}px`); + set(); + const watch = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(set); + watch?.observe(el); + return () => { + watch?.disconnect(); + root.style.removeProperty("--lens-banner"); + }; + }, [shown]); + + if (!banner) return null; return ( - { - setDismissed(tag); - try { - localStorage.setItem(KEY, tag); - } catch { - // fine: dismissed for this visit - } - }} - > - - {s.agent ? "See what’s new and install it" : "See what’s new"} - - +
+ {banner} +
); } diff --git a/nextjs-frontend/components/chat/chat-app.tsx b/nextjs-frontend/components/chat/chat-app.tsx index 0aee7f28a..876d5e7a8 100644 --- a/nextjs-frontend/components/chat/chat-app.tsx +++ b/nextjs-frontend/components/chat/chat-app.tsx @@ -568,7 +568,7 @@ export function ChatApp() { return (
diff --git a/nextjs-frontend/components/graph/graph-page.tsx b/nextjs-frontend/components/graph/graph-page.tsx index d1c49f37c..f49615f4a 100644 --- a/nextjs-frontend/components/graph/graph-page.tsx +++ b/nextjs-frontend/components/graph/graph-page.tsx @@ -280,7 +280,7 @@ export function GraphPage() { // an earlier version is for looking: edits go to the graph as it is now const onEdit = asOf ? undefined : setEditing; return ( -
+

Graph