forked from microbit-foundation/cctd-ml-machine
-
Notifications
You must be signed in to change notification settings - Fork 4
Add additional recording options #450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
5ef648e
Brief recording complete state
microbit-grace e21c473
Get is basically working mechanically
microbit-robert 8da0971
Working with dodgy looking 'more' button
microbit-robert 79daa32
Theme hack to make button red
microbit-robert f865096
Add text for num recordings remaining
microbit-robert ace13ad
Merge branch 'main' into recording-options
microbit-robert 8a50c27
Merge branch 'recording-done' into recording-options
microbit-robert c8f26a4
Update done text and reduce time shown
microbit-robert 7633bd0
More hacking to get the counter right on dialog open
microbit-robert 1c741e8
Tweak recording button and available options
microbit-robert 662acb8
Translatable text, update icon
microbit-robert b8010c7
Fix time difference
microbit-robert 9bed1b3
Refactor
microbit-robert 902be47
Another icon
microbit-robert 9bbafd2
Update text
microbit-robert 3e15a6f
Tweak text again
microbit-robert 6f3618c
Text tweaks and sample count
microbit-robert 39ccec2
User select none on recording status text
microbit-robert 00e8072
Use isRecording state for live graph overlays
microbit-robert 27bc39c
Fix overlays for continous recording
microbit-robert 2b17f6f
Pass RecordingOptions object through components
microbit-robert 4e902a9
More recording options aria label text
microbit-robert 8bfd1f2
Merge branch 'main' into recording-options
microbit-robert 357f8aa
Bump theme version and add button variant to default theme
microbit-robert b3b471d
Add stop recording text for continuous recording
microbit-robert f64efa9
Trigger tour only once recording dialog has closed
microbit-robert 9f5a970
Bump theme version and tweak default recordOutline variant
microbit-robert 82c7434
Spacing tweak (#455)
microbit-matt-hillsdon 3a82936
Additional spacing tweak
microbit-robert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,12 @@ | ||
| import { Box, HStack, Icon, Text } from "@chakra-ui/react"; | ||
| import { useSize } from "@chakra-ui/react-use-size"; | ||
| import { useEffect, useMemo, useRef, useState } from "react"; | ||
| import { AccelerometerDataEvent } from "@microbit/microbit-connection"; | ||
| import React, { useEffect, useMemo, useRef, useState } from "react"; | ||
| import { RiArrowDropLeftFill } from "react-icons/ri"; | ||
| import { SmoothieChart, TimeSeries } from "smoothie"; | ||
| import { useConnectActions } from "../connect-actions-hooks"; | ||
| import { useConnectionStage } from "../connection-stage-hooks"; | ||
| import { AccelerometerDataEvent } from "@microbit/microbit-connection"; | ||
| import { ConnectionStatus } from "../connect-status-hooks"; | ||
| import { RiArrowDropLeftFill } from "react-icons/ri"; | ||
| import React from "react"; | ||
| import { useConnectionStage } from "../connection-stage-hooks"; | ||
| import { LabelConfig, getUpdatedLabelConfig } from "../live-graph-label-config"; | ||
| import { useStore } from "../store"; | ||
|
|
||
|
|
@@ -85,30 +84,21 @@ const LiveGraph = () => { | |
| } | ||
| }, [chart, isConnected, status]); | ||
|
|
||
| // Draw on graph to display that users are recording | ||
| // Ideally we'd do this without timing the recording again! | ||
| const [isTimingRecording, setIsTimingRecording] = useState<boolean>(false); | ||
| const dataWindow = useStore((s) => s.dataWindow); | ||
| // Draw on graph to display that users are recording. | ||
| const isRecording = useStore((s) => s.isRecording); | ||
| useEffect(() => { | ||
| if (isRecording && !isTimingRecording) { | ||
| { | ||
| // Set the start recording line | ||
| const now = new Date().getTime(); | ||
| recordLines.append(now - 1, -2, false); | ||
| recordLines.append(now, 2.3, false); | ||
| setIsTimingRecording(true); | ||
| } | ||
|
|
||
| setTimeout(() => { | ||
| // Set the end recording line | ||
| const now = new Date().getTime(); | ||
| recordLines.append(now - 1, 2.3, false); | ||
| recordLines.append(now, -2, false); | ||
| setIsTimingRecording(false); | ||
| }, dataWindow.duration); | ||
| if (isRecording) { | ||
| // Set the start recording line | ||
| const now = new Date().getTime(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd feel better about this if this could get the timestamps from the code that controls the recording. We can look at this in a follow up PR. |
||
| recordLines.append(now - 1, -2, false); | ||
| recordLines.append(now, 2.3, false); | ||
| } else { | ||
| // Set the end recording line | ||
| const now = new Date().getTime(); | ||
| recordLines.append(now - 1, 2.3, false); | ||
| recordLines.append(now, -2, false); | ||
| } | ||
| }, [isTimingRecording, recordLines, isRecording, dataWindow.duration]); | ||
| }, [isRecording, recordLines]); | ||
|
|
||
| const [labelConfigs, setLabelConfigs] = | ||
| useState<LabelConfig[]>(initialLabelConfigs); | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would have prefered to do this on recording dialog close, but the latest version of the gesture recordings aren't available at that point.