Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lang/ui.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@
"defaultMessage": "WebUSB connection dialog with BBC micro:bit entry labelled 1 and Connect button labelled 2",
"description": "Alt text for image in connect help dialog"
},
"connect-or-import": {
"defaultMessage": "<link1>Connect a data collection micro:bit</link1> or <link2>import data samples</link2>",
"description": "Empty data samples page text"
},
"connect-to-record-body": {
"defaultMessage": "Connect a micro:bit to record a data sample.",
"description": "Insufficient data modal content"
},
"connect-to-record-title": {
"defaultMessage": "You don't have a micro:bit connected",
"description": "Connect to record modal title"
},
"connectFailed.bluetooth1": {
"defaultMessage": "The connection to the micro:bit could not be established.",
"description": ""
Expand Down Expand Up @@ -859,6 +871,10 @@
"defaultMessage": "More edit in MakeCode options",
"description": "Aria label for the additional actions menu to the right of the Edit in MakeCode button"
},
"no-data-samples": {
"defaultMessage": "No data samples",
"description": "Empty data samples page status text"
},
"not-found": {
"defaultMessage": "micro:bit AI creator home page",
"description": "Page not found link text"
Expand Down
11 changes: 4 additions & 7 deletions src/components/AddDataGridRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ interface AddDataGridRowProps {
gesture: GestureData;
selected: boolean;
onSelectRow: () => void;
startRecording: () => void;
onRecord: () => void;
showWalkThrough: boolean;
}

const DataSampleGridRow = ({
gesture,
selected,
onSelectRow,
startRecording,
onRecord,
showWalkThrough,
}: AddDataGridRowProps) => {
const intl = useIntl();
Expand Down Expand Up @@ -55,18 +55,15 @@ const DataSampleGridRow = ({
readOnly={false}
/>
{showWalkThrough ? (
<AddDataGridWalkThrough
gesture={gesture}
startRecording={startRecording}
/>
<AddDataGridWalkThrough gesture={gesture} onRecord={onRecord} />
) : (
<>
{gesture.name.length > 0 || gesture.recordings.length > 0 ? (
<DataRecordingGridItem
data={gesture}
selected={selected}
onSelectRow={onSelectRow}
startRecording={startRecording}
onRecord={onRecord}
/>
) : (
// Empty grid item to fill column space
Expand Down
6 changes: 3 additions & 3 deletions src/components/AddDataGridWalkThrough.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import UpCurveArrow from "./UpCurveArrow";

interface AddDataGridWalkThrough {
gesture: GestureData;
startRecording: () => void;
onRecord: () => void;
}

const AddDataGridWalkThrough = ({
gesture,
startRecording,
onRecord,
}: AddDataGridWalkThrough) => {
return (
<>
Expand All @@ -30,7 +30,7 @@ const AddDataGridWalkThrough = ({
<DataRecordingGridItem
data={gesture}
selected={true}
startRecording={startRecording}
onRecord={onRecord}
/>
{/* Empty grid item to fill first column of grid */}
<GridItem />
Expand Down
41 changes: 0 additions & 41 deletions src/components/ConnectFirstView.tsx

This file was deleted.

58 changes: 58 additions & 0 deletions src/components/ConnectToRecordDialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {
Button,
Modal,
ModalBody,
ModalCloseButton,
ModalContent,
ModalFooter,
ModalHeader,
ModalOverlay,
Text,
} from "@chakra-ui/react";
import { ComponentProps, useCallback } from "react";
import { FormattedMessage } from "react-intl";
import { useConnectionStage } from "../connection-stage-hooks";

const ConnectToRecordDialog = ({
onClose,
...rest
}: Omit<ComponentProps<typeof Modal>, "children">) => {
const { actions } = useConnectionStage();

const handleConnect = useCallback(() => {
onClose();
actions.startConnect();
}, [actions, onClose]);

return (
<Modal
closeOnOverlayClick={false}
motionPreset="none"
size="md"
isCentered
onClose={onClose}
{...rest}
>
<ModalOverlay>
<ModalContent>
<ModalHeader>
<FormattedMessage id="connect-to-record-title" />
</ModalHeader>
<ModalBody>
<ModalCloseButton />
<Text>
<FormattedMessage id="connect-to-record-body" />
</Text>
</ModalBody>
<ModalFooter justifyContent="flex-end">
<Button variant="primary" onClick={handleConnect}>
<FormattedMessage id="footer.connectButton" />
</Button>
</ModalFooter>
</ModalContent>
</ModalOverlay>
</Modal>
);
};

export default ConnectToRecordDialog;
8 changes: 4 additions & 4 deletions src/components/DataRecordingGridItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ interface DataRecordingGridItemProps {
data: GestureData;
selected: boolean;
onSelectRow?: () => void;
startRecording: () => void;
onRecord: () => void;
}

const DataRecordingGridItem = ({
data,
selected,
onSelectRow,
startRecording,
onRecord,
}: DataRecordingGridItemProps) => {
const intl = useIntl();
const deleteGestureRecording = useStore((s) => s.deleteGestureRecording);
Expand Down Expand Up @@ -62,14 +62,14 @@ const DataRecordingGridItem = ({
height="fit-content"
width="fit-content"
rounded="full"
onClick={startRecording}
onClick={onRecord}
variant="ghost"
_hover={{ backgroundColor: "transparent" }}
aria-label={intl.formatMessage(
{ id: "content.data.recordAction" },
{ action: data.name }
)}
isDisabled={!isConnected}
opacity={isConnected ? 1 : 0.5}
icon={
<Icon
as={RecordIcon}
Expand Down
Loading
Loading