-
-
-
-
-
-
-
-
+ const toggleDrawer =
+ (apiStat: string, api: ApiType, isArrow: boolean) =>
+ (_event: React.KeyboardEvent | React.MouseEvent) => {
+ if (apiStatus.currentApi !== api) {
+ if (!isArrow) {
+ const copyStatus = { ...apiStatus };
+ copyStatus.currentApi = api;
-
-
-
-
-
-
-
+ // reset all
+ copyStatus.azureTranslStatus = STATUS.AVAILABLE;
+ copyStatus.webspeechStatus = STATUS.AVAILABLE;
+ copyStatus.azureConvoStatus = STATUS.AVAILABLE;
+ copyStatus.whisperStatus = STATUS.AVAILABLE;
+ copyStatus.streamTextStatus = STATUS.AVAILABLE;
+ copyStatus.scribearServerStatus = STATUS.AVAILABLE;
+ copyStatus.playbackStatus = STATUS.AVAILABLE;
-
-
+ let apiName = '';
+ if (api === API.AZURE_TRANSLATION) {
+ apiName = 'Microsoft Azure';
+ copyStatus.azureTranslStatus = STATUS.TRANSCRIBING;
+ } else if (api === API.WHISPER) {
+ apiName = 'Whisper';
+ copyStatus.whisperStatus = STATUS.TRANSCRIBING;
+ } else if (api === API.WEBSPEECH) {
+ copyStatus.webspeechStatus = STATUS.TRANSCRIBING;
+ } else if (api === API.STREAM_TEXT) {
+ apiName = 'StreamText';
+ copyStatus.streamTextStatus = STATUS.TRANSCRIBING;
+ } else if (api === API.SCRIBEAR_SERVER) {
+ apiName = 'ScribeAR Server';
+ copyStatus.scribearServerStatus = STATUS.TRANSCRIBING;
+ } else if (api === API.PLAYBACK) {
+ apiName = 'Playback';
+ copyStatus.playbackStatus = STATUS.TRANSCRIBING;
+ }
-
-
-
-
-
-
-
-
-
+ dispatch({ type: 'CHANGE_API_STATUS', payload: copyStatus });
+ swal({
+ title: 'Success!',
+ text: 'Switching to ' + apiName,
+ icon: 'success',
+ timer: 2500,
+ });
+ } else {
+ setState((s) => ({ ...s, [apiStat]: !s[apiStat] }));
+ }
+ } else if (isArrow) {
+ setState((s) => ({ ...s, [apiStat]: !s[apiStat] }));
+ }
+ };
-
-
-
-
-
-
-
+ return (
+
+ {/* Webspeech */}
+
+
+
+
+
+
+
+
-
-
+ {/* Microsoft Azure */}
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+ {/* ScribeAR Server */}
+
+
+
+
+
+
+
+
+
-
-
+ {/* Playback */}
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
- {state.showWhisperDropdown ? : }
-
-
+ {/* StreamText */}
+
+
+
+
+
+
+
+
+
-
-
-
-
- );
-}
\ No newline at end of file
+ {/* Whisper (now matches others: button + gear on the right) */}
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/components/navbars/topbar/apiDropdown.tsx b/src/components/navbars/topbar/apiDropdown.tsx
index c5c5737..8d76c2b 100644
--- a/src/components/navbars/topbar/apiDropdown.tsx
+++ b/src/components/navbars/topbar/apiDropdown.tsx
@@ -2,6 +2,7 @@ import * as React from 'react';
import { useEffect } from "react";
import { Box, Menu, ExpandLess, ExpandMore, ThemeProvider, IconButton, Tooltip } from '../../../muiImports';
import { createTheme, useMediaQuery } from '@mui/material';
+import WhisperIcon from '../../icons/WhisperIcon';
import PickApi from './api/pickApi';
import {
@@ -90,6 +91,7 @@ export default function ApiDropdown(props) {
}, [accessToken, dispatch, mode, kioskServerAddress, serverAddress, sourceToken]);
const isMobile = useMediaQuery(currTheme.breakpoints.down('sm'));
+ const isWhisperActive = apiStatus?.currentApi === API.WHISPER || (typeof props.apiDisplayName === 'string' && props.apiDisplayName.toLowerCase().includes('whisper'));
const handleClick = (event: React.MouseEvent