Skip to content

Commit

Permalink
chore: reinstate readaloud controls
Browse files Browse the repository at this point in the history
  • Loading branch information
emcelroy committed Nov 22, 2024
1 parent a64b79e commit 32fc688
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
21 changes: 11 additions & 10 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ChatInputComponent } from "./chat-input";
import { ChatTranscriptComponent } from "./chat-transcript";
import { ChatTranscript, ChatMessage } from "../types";
import { timeStamp } from "../utils";
import { ReadAloudMenu } from "./readaloud-menu";

import "./App.css";

Expand All @@ -27,8 +28,8 @@ const mockAiResponse = (): ChatMessage => {
export const App = () => {
const greeting = "Hello! I'm DAVAI, your Data Analysis through Voice and Artificial Intelligence partner.";
const [chatTranscript, setChatTranscript] = useState<ChatTranscript>({messages: [{speaker: "DAVAI", content: greeting, timestamp: timeStamp()}]});
// const [readAloudEnabled, setReadAloudEnabled] = useState(false);
// const [playbackSpeed, setPlaybackSpeed] = useState(1);
const [readAloudEnabled, setReadAloudEnabled] = useState(false);
const [playbackSpeed, setPlaybackSpeed] = useState(1);

useEffect(() => {
initializePlugin({pluginName: kPluginName, version: kVersion, dimensions: kInitialDimensions});
Expand All @@ -38,13 +39,13 @@ export const App = () => {
selectSelf();
};

// const handleSetReadAloudEnabled = () => {
// setReadAloudEnabled(!readAloudEnabled);
// };
const handleSetReadAloudEnabled = () => {
setReadAloudEnabled(!readAloudEnabled);
};

// const handleSetPlaybackSpeed = (speed: number) => {
// setPlaybackSpeed(speed);
// };
const handleSetPlaybackSpeed = (speed: number) => {
setPlaybackSpeed(speed);
};

const handleChatInputSubmit = (messageText: string) => {
setChatTranscript(prevTranscript => ({
Expand All @@ -68,12 +69,12 @@ export const App = () => {
</header>
<ChatTranscriptComponent chatTranscript={chatTranscript} />
<ChatInputComponent onSubmit={handleChatInputSubmit} onKeyboardShortcut={handleFocusShortcut} />
{/* <ReadAloudMenu
<ReadAloudMenu
enabled={readAloudEnabled}
onToggle={handleSetReadAloudEnabled}
playbackSpeed={playbackSpeed}
onPlaybackSpeedSelect={handleSetPlaybackSpeed}
/> */}
/>
</div>
);
};
2 changes: 1 addition & 1 deletion src/components/readaloud-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
label {
cursor: pointer;
line-height: 1.4;
font-size: pxToRem(16);
font-size: .75rem;
user-select: none;
font-weight: bold;
white-space: nowrap;
Expand Down
6 changes: 3 additions & 3 deletions src/components/readaloud-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export const ReadAloudMenu = (props: IReadAloudMenuProps) => {
};

return (
<div className="readaloud-controls" role="menu">
<div role="menuitem" className="toggle">
<div className="readaloud-controls">
<div className="toggle">
<label htmlFor="readaloud-toggle" data-testid="toggle-label">
Tap text to listen
</label>
Expand All @@ -32,7 +32,7 @@ export const ReadAloudMenu = (props: IReadAloudMenuProps) => {
onChange={onToggle}
/>
</div>
<div role="menuitem">
<div className="select-playback-speed">
<label
data-testid="speed-label"
className="visually-hidden"
Expand Down

0 comments on commit 32fc688

Please sign in to comment.