From e3f83f58452a28ffa7ab0bd47424460d5946399a Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Fri, 20 Nov 2026 14:50:46 +0000 Subject: [PATCH 1/3] Add a notice and dialog explaining that ideas are moving Ideas can now be browsed and opened from the home page as well as from the Ideas tab. Browsing from the sidebar is to be removed later. A notice under the Ideas tab heading says so, with a dialog giving what is changing, why and when. --- lang/ui.en.json | 40 ++++++++++ src/common/AreaHeading.tsx | 5 +- .../ideas/IdeasDocumentation.tsx | 46 ++++++++++- src/documentation/ideas/IdeasMovingDialog.tsx | 80 +++++++++++++++++++ 4 files changed, 166 insertions(+), 5 deletions(-) create mode 100644 src/documentation/ideas/IdeasMovingDialog.tsx diff --git a/lang/ui.en.json b/lang/ui.en.json index 623b2f942..f3e2f8941 100644 --- a/lang/ui.en.json +++ b/lang/ui.en.json @@ -447,6 +447,46 @@ "defaultMessage": "Step counter", "description": "Title of an idea card; matches the idea name in the ideas tab" }, + "ideas-moving-notice": { + "defaultMessage": "Ideas are moving to the home page. Learn more", + "description": "Notice in the ideas tab header; the link opens a dialog explaining the change" + }, + "ideas-moving-questions": { + "defaultMessage": "Contact us at {email}", + "description": "Body of the questions section in the ideas moving dialog; {email} is the support email address" + }, + "ideas-moving-questions-heading": { + "defaultMessage": "Still have questions?", + "description": "Section heading in the ideas moving dialog" + }, + "ideas-moving-title": { + "defaultMessage": "Ideas are moving to the home page", + "description": "Title of the dialog explaining that ideas are moving out of the editor to the home page" + }, + "ideas-moving-what": { + "defaultMessage": "Ideas are now on the Home page too. When you create a project from an idea there, the editor opens with that idea in the sidebar. Later, we will remove the option to browse ideas from the sidebar.", + "description": "Body of the what is changing section in the ideas moving dialog" + }, + "ideas-moving-what-heading": { + "defaultMessage": "What is changing?", + "description": "Section heading in the ideas moving dialog" + }, + "ideas-moving-when": { + "defaultMessage": "We will remove the option to browse ideas from the sidebar in mid-2027.", + "description": "Body of the when section in the ideas moving dialog" + }, + "ideas-moving-when-heading": { + "defaultMessage": "When?", + "description": "Section heading in the ideas moving dialog" + }, + "ideas-moving-why": { + "defaultMessage": "Ideas are easier to browse on the Home page. Selecting an idea shows you a preview before you start, and the Home page has other resources and activities as well.", + "description": "Body of the why section in the ideas moving dialog" + }, + "ideas-moving-why-heading": { + "defaultMessage": "Why?", + "description": "Section heading in the ideas moving dialog" + }, "ideas-row-title": { "defaultMessage": "Ideas", "description": "Heading of the home page row of idea cards" diff --git a/src/common/AreaHeading.tsx b/src/common/AreaHeading.tsx index 63b9a9904..c253c01a3 100644 --- a/src/common/AreaHeading.tsx +++ b/src/common/AreaHeading.tsx @@ -10,14 +10,17 @@ import { Box } from "styled-system/jsx"; interface AreaHeadingProps { name: string; description: ReactNode; + /** Rendered below the description. */ + children?: ReactNode; } -const AreaHeading = ({ name, description }: AreaHeadingProps) => ( +const AreaHeading = ({ name, description, children }: AreaHeadingProps) => ( {name} {description} + {children} ); diff --git a/src/documentation/ideas/IdeasDocumentation.tsx b/src/documentation/ideas/IdeasDocumentation.tsx index 24939aeaa..1f07561a1 100644 --- a/src/documentation/ideas/IdeasDocumentation.tsx +++ b/src/documentation/ideas/IdeasDocumentation.tsx @@ -3,10 +3,11 @@ * * SPDX-License-Identifier: MIT */ -import { Link, Text } from "@microbit/ui"; -import { CSSProperties, ReactNode, useCallback, useRef } from "react"; +import { Button, Icon, Link, Text } from "@microbit/ui"; +import { CSSProperties, ReactNode, useCallback, useRef, useState } from "react"; +import { RiInformationLine } from "react-icons/ri"; import { FormattedMessage, useIntl } from "react-intl"; -import { Box, Grid, Stack } from "styled-system/jsx"; +import { Box, Grid, HStack, Stack } from "styled-system/jsx"; import AreaHeading from "../../common/AreaHeading"; import { docStylesClass, @@ -27,6 +28,7 @@ import DocumentationContent, { import ImageWithFallback from "../common/ImageWithFallback"; import { isV2Only } from "../common/model"; import IdeaCard from "./IdeaCard"; +import IdeasMovingDialog from "./IdeasMovingDialog"; import { Idea } from "./model"; import OfflineImageFallback from "../OfflineImageFallback"; import { microbitOrgMiciProjectsUrl } from "../../external-links"; @@ -149,7 +151,9 @@ const ActiveLevel = ({ + > + + } > { + const [isOpen, setIsOpen] = useState(false); + const learnMoreRef = useRef(null); + return ( + // Top-aligned so the icon stays on the first line when the text wraps. + + + + ( + + ), + }} + /> + + setIsOpen(false)} + finalFocusRef={learnMoreRef} + /> + + ); +}; + export default IdeasDocumentation; diff --git a/src/documentation/ideas/IdeasMovingDialog.tsx b/src/documentation/ideas/IdeasMovingDialog.tsx new file mode 100644 index 000000000..5b4ff9b13 --- /dev/null +++ b/src/documentation/ideas/IdeasMovingDialog.tsx @@ -0,0 +1,80 @@ +/** + * (c) 2026, Micro:bit Educational Foundation and contributors + * + * SPDX-License-Identifier: MIT + */ +import { + Button, + Link, + Modal, + ModalBody, + ModalCloseButton, + ModalFooter, + ModalHeader, + Text, +} from "@microbit/ui"; +import { RefObject } from "react"; +import { FormattedMessage } from "react-intl"; +import { Stack } from "styled-system/jsx"; + +const supportEmail = "support@microbit.org"; + +const sections = ["what", "why", "when", "questions"] as const; + +interface IdeasMovingDialogProps { + isOpen: boolean; + onClose: () => void; + finalFocusRef?: RefObject; +} + +const IdeasMovingDialog = ({ + isOpen, + onClose, + finalFocusRef, +}: IdeasMovingDialogProps) => ( + + + + + + + + {sections.map((section) => ( + + + + + + + {supportEmail} + + ), + }} + /> + + + ))} + + + + + + +); + +export default IdeasMovingDialog; From f1cd425ff71b2a06b2420c2910a069e447e61698 Mon Sep 17 00:00:00 2001 From: Matt Hillsdon Date: Fri, 20 Nov 2026 16:03:44 +0000 Subject: [PATCH 2/3] Show the ideas notice only where there is a home page Without the projects database, and in iframe controller mode, there is no home page for ideas to move to, but the notice and its dialog said they were moving there. They are now shown only where the home page exists. Also: - The questions section links to the deployment's support site in place of a hard-coded email address, and is left out where there is none. - "Home page" is capitalised throughout. - Opening the dialog is logged as ideas_notice_open. - The dialog's message ids are written out, so a search finds them. - Tests for the notice, the dialog and both cases without a home page, with accessibility scans of the two new states. --- docs/analytics-events.md | 5 + lang/ui.en.json | 8 +- .../ideas/IdeasDocumentation.tsx | 15 ++- src/documentation/ideas/IdeasMovingDialog.tsx | 101 +++++++++++------- src/e2e/documentation.test.ts | 23 ++++ src/e2e/iframe.test.ts | 13 +++ src/e2e/storage-errors.test.ts | 10 ++ 7 files changed, 132 insertions(+), 43 deletions(-) diff --git a/docs/analytics-events.md b/docs/analytics-events.md index 1b504fe02..f1a5b47cf 100644 --- a/docs/analytics-events.md +++ b/docs/analytics-events.md @@ -221,6 +221,11 @@ Fires once per search session: when results first appear after typing, not per keystroke (300ms debounce) and not again until results are cleared. No params. Search terms are deliberately not sent. +### `ideas_notice_open` + +User opened the dialog, from the notice in the Ideas tab, that explains that +ideas are moving to the home page. No params. + ## Code snippet events Moving code from the documentation into the editor. Drag and copy are the diff --git a/lang/ui.en.json b/lang/ui.en.json index f3e2f8941..a6d8538de 100644 --- a/lang/ui.en.json +++ b/lang/ui.en.json @@ -448,19 +448,19 @@ "description": "Title of an idea card; matches the idea name in the ideas tab" }, "ideas-moving-notice": { - "defaultMessage": "Ideas are moving to the home page. Learn more", + "defaultMessage": "Ideas are moving to the Home page. Learn more", "description": "Notice in the ideas tab header; the link opens a dialog explaining the change" }, "ideas-moving-questions": { - "defaultMessage": "Contact us at {email}", - "description": "Body of the questions section in the ideas moving dialog; {email} is the support email address" + "defaultMessage": "Get in touch through our support site.", + "description": "Body of the questions section in the ideas moving dialog; the link opens the support site in a new tab" }, "ideas-moving-questions-heading": { "defaultMessage": "Still have questions?", "description": "Section heading in the ideas moving dialog" }, "ideas-moving-title": { - "defaultMessage": "Ideas are moving to the home page", + "defaultMessage": "Ideas are moving to the Home page", "description": "Title of the dialog explaining that ideas are moving out of the editor to the home page" }, "ideas-moving-what": { diff --git a/src/documentation/ideas/IdeasDocumentation.tsx b/src/documentation/ideas/IdeasDocumentation.tsx index 1f07561a1..9fc12c595 100644 --- a/src/documentation/ideas/IdeasDocumentation.tsx +++ b/src/documentation/ideas/IdeasDocumentation.tsx @@ -27,6 +27,9 @@ import DocumentationContent, { } from "../common/DocumentationContent"; import ImageWithFallback from "../common/ImageWithFallback"; import { isV2Only } from "../common/model"; +import { useProjectsDatabaseActive } from "../../fs/storage-status"; +import { useIframeMode } from "../../iframe-mode-hooks"; +import { useLogging } from "../../logging/logging-hooks"; import IdeaCard from "./IdeaCard"; import IdeasMovingDialog from "./IdeasMovingDialog"; import { Idea } from "./model"; @@ -202,6 +205,13 @@ const ActiveLevel = ({ const IdeasMovingNotice = () => { const [isOpen, setIsOpen] = useState(false); const learnMoreRef = useRef(null); + const logging = useLogging(); + const iframeMode = useIframeMode(); + const projectsDatabaseActive = useProjectsDatabaseActive(); + if (iframeMode || !projectsDatabaseActive) { + // There is no home page for the ideas to move to. + return null; + } return ( // Top-aligned so the icon stays on the first line when the text wraps. @@ -216,7 +226,10 @@ const IdeasMovingNotice = () => { variant="link" // In prose, so marked by more than colour. css={{ color: "brand.500", textDecoration: "underline" }} - onPress={() => setIsOpen(true)} + onPress={() => { + logging.event({ type: "ideas_notice_open" }); + setIsOpen(true); + }} > {chunks} diff --git a/src/documentation/ideas/IdeasMovingDialog.tsx b/src/documentation/ideas/IdeasMovingDialog.tsx index 5b4ff9b13..0e474ae6c 100644 --- a/src/documentation/ideas/IdeasMovingDialog.tsx +++ b/src/documentation/ideas/IdeasMovingDialog.tsx @@ -13,13 +13,16 @@ import { ModalHeader, Text, } from "@microbit/ui"; -import { RefObject } from "react"; +import { ReactNode, RefObject } from "react"; import { FormattedMessage } from "react-intl"; import { Stack } from "styled-system/jsx"; +import { useDeployment } from "../../deployment"; -const supportEmail = "support@microbit.org"; - -const sections = ["what", "why", "when", "questions"] as const; +const sections = [ + { heading: "ideas-moving-what-heading", body: "ideas-moving-what" }, + { heading: "ideas-moving-why-heading", body: "ideas-moving-why" }, + { heading: "ideas-moving-when-heading", body: "ideas-moving-when" }, +] as const; interface IdeasMovingDialogProps { isOpen: boolean; @@ -31,50 +34,72 @@ const IdeasMovingDialog = ({ isOpen, onClose, finalFocusRef, -}: IdeasMovingDialogProps) => ( - - - - - - - - {sections.map((section) => ( - - - - - +}: IdeasMovingDialogProps) => { + const { supportLink } = useDeployment(); + return ( + + + + + + + + {sections.map(({ heading, body }) => ( +
}> + +
+ ))} + {supportLink && ( +
} + > ( - {supportEmail} + {chunks} ), }} /> - - - ))} - - - - - - +
+ )} +
+
+ + + +
+ ); +}; + +const Section = ({ + heading, + children, +}: { + heading: ReactNode; + children: ReactNode; +}) => ( + + + {heading} + + {children} + ); export default IdeasMovingDialog; diff --git a/src/e2e/documentation.test.ts b/src/e2e/documentation.test.ts index a3da31044..8aab254c3 100644 --- a/src/e2e/documentation.test.ts +++ b/src/e2e/documentation.test.ts @@ -3,6 +3,7 @@ * * SPDX-License-Identifier: MIT */ +import { expect } from "@playwright/test"; import { test } from "./app-test-fixtures.js"; test.describe("documentation", () => { @@ -79,6 +80,28 @@ test.describe("documentation", () => { ); }); + test("Ideas tab explains that ideas are moving to the home page", async ({ + app, + }) => { + await app.switchTab("Ideas"); + await expect( + app.page.getByText("Ideas are moving to the Home page.") + ).toBeVisible(); + await app.expectNoNewAccessibilityViolations(); + + const learnMore = app.page.getByRole("button", { name: "Learn more" }); + await learnMore.click(); + const dialog = app.page.getByRole("dialog"); + await expect( + dialog.getByRole("heading", { name: "Ideas are moving to the Home page" }) + ).toBeVisible(); + await app.expectNoNewAccessibilityViolations(); + + await app.page.keyboard.press("Escape"); + await expect(dialog).toBeHidden(); + await expect(learnMore).toBeFocused(); + }); + test("Select an idea", async ({ app }) => { const ideaName = "Emotion badge"; await app.switchTab("Ideas"); diff --git a/src/e2e/iframe.test.ts b/src/e2e/iframe.test.ts index e2f87707e..a96b46523 100644 --- a/src/e2e/iframe.test.ts +++ b/src/e2e/iframe.test.ts @@ -139,4 +139,17 @@ test.describe("iframe controller mode", () => { await app.closeAndExpectBeforeUnloadPrompt(); }); + + test("does not say ideas are moving, as there is no home page", async ({ + app, + }) => { + const frame = await openEmbeddedEditor(app.page); + await frame.getByRole("tab", { name: "Ideas" }).click(); + await expect( + frame.getByRole("heading", { name: "Ideas", exact: true }) + ).toBeVisible(); + await expect( + frame.getByRole("button", { name: "Learn more" }) + ).toBeHidden(); + }); }); diff --git a/src/e2e/storage-errors.test.ts b/src/e2e/storage-errors.test.ts index c89810414..9d0d755a5 100644 --- a/src/e2e/storage-errors.test.ts +++ b/src/e2e/storage-errors.test.ts @@ -57,6 +57,16 @@ test.describe("storage fallback", () => { await app.expectEditorContainText(/PASS1/); }); + test("does not say ideas are moving, as there is no home page", async ({ + app, + }) => { + await app.switchTab("Ideas"); + await app.expectDocumentationTopLevelHeading("Ideas"); + await expect( + app.page.getByRole("button", { name: "Learn more" }) + ).toBeHidden(); + }); + test("opens a #project: link at the root in the editor", async ({ app }) => { await app.page.goto(homeUrl({ fragment: heartProjectLinkFragment })); await app.expectProjectName("Hearts"); From 2538d65f8a0a2094e053244d9addc9826bbdf5bd Mon Sep 17 00:00:00 2001 From: Matt Hillsdon Date: Fri, 20 Nov 2026 16:50:03 +0000 Subject: [PATCH 3/3] Align the ideas notice's icon with its first line The icon was a fixed 16px beside 14.4px text and sat about 1.5px below the centre of the line. It now takes its size from the text and is centred in a box one line high. --- src/documentation/ideas/IdeasDocumentation.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/documentation/ideas/IdeasDocumentation.tsx b/src/documentation/ideas/IdeasDocumentation.tsx index 9fc12c595..154c64a8d 100644 --- a/src/documentation/ideas/IdeasDocumentation.tsx +++ b/src/documentation/ideas/IdeasDocumentation.tsx @@ -214,8 +214,11 @@ const IdeasMovingNotice = () => { } return ( // Top-aligned so the icon stays on the first line when the text wraps. - - + + {/* One line of the text high, to centre the icon on the first line. */} + + +