From ecb47290cfc3ead053a09cb57917a36592fce78c Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Tue, 19 Nov 2024 10:03:56 +0000 Subject: [PATCH 1/5] Fix vertical scroll (data page) and icon picker position --- src/components/LedIconPicker.tsx | 55 +++++++++++++++++--------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/src/components/LedIconPicker.tsx b/src/components/LedIconPicker.tsx index e91cd9222..d7d87d123 100644 --- a/src/components/LedIconPicker.tsx +++ b/src/components/LedIconPicker.tsx @@ -6,6 +6,7 @@ import { PopoverBody, PopoverContent, PopoverTrigger, + Portal, } from "@chakra-ui/react"; import { memo, useCallback } from "react"; import { RiArrowDropDownFill } from "react-icons/ri"; @@ -28,7 +29,7 @@ const LedIconPicker = ({ onIconSelected }: LedIconPicker) => { ); return ( - + {({ onClose }) => ( <> @@ -41,31 +42,33 @@ const LedIconPicker = ({ onIconSelected }: LedIconPicker) => { - - - - - {Object.keys(makecodeIcons).map((icon, idx) => ( - handleClick(icon as MakeCodeIcon, onClose)} - variant="unstyled" - h={20} - w={20} - icon={} - /> - ))} - - - + + + + + + {Object.keys(makecodeIcons).map((icon, idx) => ( + handleClick(icon as MakeCodeIcon, onClose)} + variant="unstyled" + h={20} + w={20} + icon={} + /> + ))} + + + + )} From 1007f22820651d2034d294f3db845a1e1f50db08 Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Tue, 19 Nov 2024 10:33:50 +0000 Subject: [PATCH 2/5] Add landmark elements and regions for navigation --- lang/ui.en.json | 12 ++++++++++++ src/components/ActionBar.tsx | 2 +- src/components/DataSamplesTableRow.tsx | 12 +++++++++++- src/components/LiveGraphPanel.tsx | 6 ++++-- src/messages/ui.en.json | 26 ++++++++++++++++++++++++++ src/pages/DataSamplesPage.tsx | 20 +++++++++++++------- src/pages/HomePage.tsx | 9 ++++++++- src/pages/ImportPage.tsx | 2 +- src/pages/NewPage.tsx | 2 +- src/pages/TestingModelPage.tsx | 9 ++++++++- 10 files changed, 85 insertions(+), 15 deletions(-) diff --git a/lang/ui.en.json b/lang/ui.en.json index eb3c664ea..ac2969b88 100644 --- a/lang/ui.en.json +++ b/lang/ui.en.json @@ -31,6 +31,10 @@ "defaultMessage": "Name of action", "description": "Placeholder text for user supplied name of a movement-related action, e.g. clapping" }, + "action-region": { + "defaultMessage": "Action \"{action}\"", + "description": "Region label for action row" + }, "action-tooltip": { "defaultMessage": "The type of movement you want {appNameFull} to recognise e.g. ‘waving’ or ‘clapping’.", "description": "Tooltip explaining action" @@ -395,6 +399,10 @@ "defaultMessage": "Show data features", "description": "Show data features button text" }, + "data-samples-actions-region": { + "defaultMessage": "Data and model actions", + "description": "Region label for data samples actions" + }, "data-samples-label": { "defaultMessage": "Data samples", "description": "Heading for data samples column" @@ -1387,6 +1395,10 @@ "defaultMessage": "Terms of use", "description": "Link or menu item link to view terms of use" }, + "testing-model-actions-region": { + "defaultMessage": "Project actions", + "description": "Region label for testing model actions" + }, "testing-model-title": { "defaultMessage": "Testing model", "description": "Testing model page title" diff --git a/src/components/ActionBar.tsx b/src/components/ActionBar.tsx index 106184ec8..2154c2959 100644 --- a/src/components/ActionBar.tsx +++ b/src/components/ActionBar.tsx @@ -17,7 +17,7 @@ const ActionBar = ({ }: ActionBarProps) => { return ( deleteAction(action.ID)} onCancel={deleteConfirmDisclosure.onClose} /> - + { setSelectedActionIdx(actions.length); addNewAction(); }, [addNewAction, actions]); - + const intl = useIntl(); return ( <> @@ -55,12 +55,18 @@ const DataSamplesPage = () => { menuItems={} toolbarItemsRight={} > - + + + { } > - + { toolbarItemsRight={} menuItems={} > - + { menuItems={} > - + diff --git a/src/pages/TestingModelPage.tsx b/src/pages/TestingModelPage.tsx index c51f4654d..055605eda 100644 --- a/src/pages/TestingModelPage.tsx +++ b/src/pages/TestingModelPage.tsx @@ -1,6 +1,7 @@ import { Button, ButtonGroup, + Flex, HStack, Menu, MenuItem, @@ -119,9 +120,15 @@ const TestingModelPage = () => { stage="openEditor" onNextLoading={editorLoading} /> - + + + Date: Tue, 19 Nov 2024 13:31:16 +0000 Subject: [PATCH 3/5] Add region role to action rows on testing model page --- src/components/TestingModelTable.tsx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/components/TestingModelTable.tsx b/src/components/TestingModelTable.tsx index 47ff4c9bd..350a245ff 100644 --- a/src/components/TestingModelTable.tsx +++ b/src/components/TestingModelTable.tsx @@ -1,4 +1,5 @@ import { + Box, Grid, GridItem, GridProps, @@ -7,15 +8,16 @@ import { VStack, } from "@chakra-ui/react"; import { MakeCodeRenderBlocksProvider } from "@microbit/makecode-embed/react"; -import React, { useRef } from "react"; +import { useRef } from "react"; import { RiArrowRightLine } from "react-icons/ri"; +import { useIntl } from "react-intl"; import { useConnectionStage } from "../connection-stage-hooks"; import { useProject } from "../hooks/project-hooks"; import { mlSettings } from "../mlConfig"; import { getMakeCodeLang } from "../settings"; import { useSettings, useStore } from "../store"; -import ActionNameCard from "./ActionNameCard"; import ActionCertaintyCard from "./ActionCertaintyCard"; +import ActionNameCard from "./ActionNameCard"; import CodeViewCard from "./CodeViewCard"; import CodeViewDefaultBlockCard from "./CodeViewDefaultBlockCard"; import HeadingGrid from "./HeadingGrid"; @@ -51,6 +53,7 @@ const TestingModelTable = () => { const [{ languageId }] = useSettings(); const makeCodeLang = getMakeCodeLang(languageId); const scrollableAreaRef = useRef(null); + const intl = useIntl(); return ( { {actions.map((action, idx) => { const { requiredConfidence: threshold } = action; return ( - + { )} - + ); })} From 43fe6cbaf4c7a9b25cdbc950a9fa59c2d16c389a Mon Sep 17 00:00:00 2001 From: Matt Hillsdon Date: Tue, 19 Nov 2024 17:27:45 +0000 Subject: [PATCH 4/5] Tweak region names --- lang/ui.en.json | 4 ++-- src/messages/ui.en.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lang/ui.en.json b/lang/ui.en.json index ac2969b88..2804281de 100644 --- a/lang/ui.en.json +++ b/lang/ui.en.json @@ -400,7 +400,7 @@ "description": "Show data features button text" }, "data-samples-actions-region": { - "defaultMessage": "Data and model actions", + "defaultMessage": "Data samples toolbar", "description": "Region label for data samples actions" }, "data-samples-label": { @@ -1396,7 +1396,7 @@ "description": "Link or menu item link to view terms of use" }, "testing-model-actions-region": { - "defaultMessage": "Project actions", + "defaultMessage": "Testing model toolbar", "description": "Region label for testing model actions" }, "testing-model-title": { diff --git a/src/messages/ui.en.json b/src/messages/ui.en.json index f6c7cc2a0..4531317c8 100644 --- a/src/messages/ui.en.json +++ b/src/messages/ui.en.json @@ -680,7 +680,7 @@ "data-samples-actions-region": [ { "type": 0, - "value": "Data and model actions" + "value": "Data samples toolbar" } ], "data-samples-label": [ @@ -2458,7 +2458,7 @@ "testing-model-actions-region": [ { "type": 0, - "value": "Project actions" + "value": "Testing model toolbar" } ], "testing-model-title": [ From 62306df575f4de94c04b2d497864427f60cd4f20 Mon Sep 17 00:00:00 2001 From: Matt Hillsdon Date: Tue, 19 Nov 2024 17:32:05 +0000 Subject: [PATCH 5/5] Typo --- src/components/LiveGraphPanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/LiveGraphPanel.tsx b/src/components/LiveGraphPanel.tsx index 1266fb8b2..3efaeea65 100644 --- a/src/components/LiveGraphPanel.tsx +++ b/src/components/LiveGraphPanel.tsx @@ -68,7 +68,7 @@ const LiveGraphPanel = ({ return (