From 031c1ede21d9e845c32597e30f93c7d2a2d951c8 Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Mon, 4 Jan 2021 03:45:09 +0530 Subject: [PATCH] Add Voice Wave Animation for recording and show recorded text --- src/Core.js | 15 ++++-- src/components/VoiceBars.js | 79 ++++++++++++++++++++++++++++++ src/plugins/Accident.js | 2 +- src/plugins/GenericPageWithIcon.js | 2 +- 4 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 src/components/VoiceBars.js diff --git a/src/Core.js b/src/Core.js index 009ceea..d656a3b 100644 --- a/src/Core.js +++ b/src/Core.js @@ -1,12 +1,15 @@ import React from "react"; import { useSelector, useDispatch } from "react-redux"; -import { Box, Button, Clock } from "grommet"; +import { Box, Button, Clock, Text } from "grommet"; import { setPlugin, selectCore } from "./coreSlice"; +import { selectVoice } from "./voiceSlice"; +import VoiceBars from "./components/VoiceBars"; import plugins from "./plugins"; function Core() { const coreState = useSelector(selectCore); + const voiceState = useSelector(selectVoice); const dispatch = useDispatch(); const plugin = plugins[coreState.plugin]; const props = { @@ -15,6 +18,12 @@ function Core() { }; const dummyButtons = ["Maps", "Home Devices", "Phone"]; return <> + + {voiceState.recording ? : + voiceState.text === null ? null: + {voiceState.text} + } + {plugin ? React.createElement(plugin, props, null) : ( - + :