Justin Haaheim commited on
Commit ·
a02a300
1
Parent(s): 34021fc
Make the react app usable on mobile devices/small screens, and clean up theme code (#167)
Browse files* Fix UI resizing as text comes in
* Get rid of unneeded font size theme code
* Get rid of zIndex hacks that we used for chrome extension
* Get rid of minHeight to remove empty bar at bottom
* WIP try to get font to shrink
* Get responsive font size working
* Wrap the volume slider for narrow vieports
* Make input source row evenly spaced
Files changed (3)
15 unmodified lines1617181920212223242515 unmodified linesborder-radius: 8px;box-shadow: 0px 24px 30px rgba(0, 0, 0, 0.3);border: 1px solid rgba(0, 0, 0, 0.05);min-height: 300px;/* max-height: 95vh; *//* max-width: 625px; *//* min-width: 580px; */overflow: hidden;}15 unmodified lines16171819202115 unmodified linesborder-radius: 8px;box-shadow: 0px 24px 30px rgba(0, 0, 0, 0.3);border: 1px solid rgba(0, 0, 0, 0.05);overflow: hidden;}
58 unmodified lines596061626364689 unmodified lines754755756757758759760761119 unmodified lines88188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395417 unmodified lines97297397497597697797897942 unmodified lines102210231024102510261027102858 unmodified linesimport debug from './debug';import DebugSection from './DebugSection';import Switch from '@mui/material/Switch';const AUDIO_STREAM_DEFAULTS: {[key in SupportedInputSource]: BrowserAudioStreamConfig;689 unmodified lines<Box// eslint-disable-next-line @typescript-eslint/ban-ts-comment// @ts-ignore Not sure why it's complaining about complexity hereminWidth={'550px'}maxWidth={'660px'}><div className="main-container-sra"><div className="top-section-sra horizontal-padding-sra"><div className="header-container-sra">119 unmodified lines</FormControl></Box><Stack direction="row" spacing={3.5}><FormControl disabled={streamFixedConfigOptionsDisabled}><RadioGrouparia-labelledby="output-modes-radio-group-label"value={outputMode}onChange={(e) =>setOutputMode(e.target.value as SupportedOutputMode)}name="output-modes-radio-buttons-group">{// TODO: Use supported modalities from agentCapabilitiesSUPPORTED_OUTPUT_MODES.map(({value, label}) => (<FormControlLabelkey={value}value={value}control={<Radio />}label={label}/>))}</RadioGroup></FormControl><Stackdirection="column"spacing={1}alignItems="flex-start"sx={{flexGrow: 1}}>{currentAgent?.dynamicParams?.includes('expressive',) && (<FormControlLabelcontrol={<Switchchecked={enableExpressive ?? false}onChange={(event: React.ChangeEvent<HTMLInputElement>,) => {const newValue = event.target.checked;setEnableExpressive(newValue);onSetDynamicConfig({expressive: newValue});}}/>}label="Expressive"/>)}{isListener && (<Boxsx={{flexGrow: 1,paddingX: 1.5,paddingY: 1.5,width: '100%',}}>{volumeSliderNode}</Box>)}</Stack></Stack></Stack><Stackdirection="row"spacing={2}justifyContent="space-between"><div><FormControl disabled={streamFixedConfigOptionsDisabled}><FormLabel id="input-source-radio-group-label">Input Source17 unmodified lines))}</RadioGroup></FormControl></div><div><FormControl disabled={streamFixedConfigOptionsDisabled}><FormLabel>Options</FormLabel><FormControlLabel42 unmodified lineslabel="Server Debug Flag"/></FormControl></div></Stack><Stack direction="row" spacing={2}>58 unmodified lines59606162636465689 unmodified lines755756757758759760761119 unmodified lines88188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296317 unmodified lines98198298398498598698798842 unmodified lines103110321033103410351036103758 unmodified linesimport debug from './debug';import DebugSection from './DebugSection';import Switch from '@mui/material/Switch';import {Grid} from '@mui/material';const AUDIO_STREAM_DEFAULTS: {[key in SupportedInputSource]: BrowserAudioStreamConfig;689 unmodified lines<Box// eslint-disable-next-line @typescript-eslint/ban-ts-comment// @ts-ignore Not sure why it's complaining about complexity heresx={{width: '100%', maxWidth: '660px', minWidth: '320px'}}><div className="main-container-sra"><div className="top-section-sra horizontal-padding-sra"><div className="header-container-sra">119 unmodified lines</FormControl></Box><Grid container><Grid item xs={12} sm={4}><FormControldisabled={streamFixedConfigOptionsDisabled}><RadioGrouparia-labelledby="output-modes-radio-group-label"value={outputMode}onChange={(e) =>setOutputMode(e.target.value as SupportedOutputMode,)}name="output-modes-radio-buttons-group">{// TODO: Use supported modalities from agentCapabilitiesSUPPORTED_OUTPUT_MODES.map(({value, label}) => (<FormControlLabelkey={value}value={value}control={<Radio />}label={label}/>))}</RadioGroup></FormControl></Grid><Grid item xs={12} sm={8}><Stackdirection="column"spacing={1}alignItems="flex-start"sx={{flexGrow: 1}}>{currentAgent?.dynamicParams?.includes('expressive',) && (<FormControlLabelcontrol={<Switchchecked={enableExpressive ?? false}onChange={(event: React.ChangeEvent<HTMLInputElement>,) => {const newValue = event.target.checked;setEnableExpressive(newValue);onSetDynamicConfig({expressive: newValue,});}}/>}label="Expressive"/>)}{isListener && (<Boxsx={{flexGrow: 1,paddingX: 1.5,paddingY: 1.5,width: '100%',}}>{volumeSliderNode}</Box>)}</Stack></Grid></Grid></Stack><Stackdirection="row"spacing={2}justifyContent="space-between"><Box sx={{flex: 1}}><FormControl disabled={streamFixedConfigOptionsDisabled}><FormLabel id="input-source-radio-group-label">Input Source17 unmodified lines))}</RadioGroup></FormControl></Box><Box sx={{flex: 1}}><FormControl disabled={streamFixedConfigOptionsDisabled}><FormLabel>Options</FormLabel><FormControlLabel42 unmodified lineslabel="Server Debug Flag"/></FormControl></Box></Stack><Stack direction="row" spacing={2}>
1234567891011121314151617181920212223242526277 unmodified lines353637383940411 unmodified line4344454647484950515253545556575859606162636465666768import {createTheme} from '@mui/material/styles';// import {red} from '@mui/material/colors';const Z_INDEX_BASE = 9999999;function getHtmlFontSize(): number | null {let fontSize: number | null = null;try {// NOTE: Even when this is not explicitly set it still returns a valueconst fontSizeString = window.getComputedStyle(document.getElementsByTagName('html')[0]).getPropertyValue('font-size');fontSize = parseInt(fontSizeString, 10);} catch (e) {console.error('Error getting font size', e);}return fontSize;}const htmlFontSize = getHtmlFontSize();const htmlFontSizeObject =htmlFontSize == null ? {} : {htmlFontSize: htmlFontSize};const themeObject = {palette: {7 unmodified linestext: {primary: '#1C2A33'},},typography: {...htmlFontSizeObject,fontFamily: ['Optimistic Text','Roboto',1 unmodified line'Arial','sans-serif',].join(','),h1: {fontSize: 16, fontWeight: '500'},body1: {fontSize: 16},},// Because our chrome extension uses a high z-index, we need to// provide that base here so MUI stuff renders correctlyzIndex: {mobileStepper: Z_INDEX_BASE + 1000,fab: Z_INDEX_BASE + 1050,speedDial: Z_INDEX_BASE + 1050,appBar: Z_INDEX_BASE + 1100,drawer: Z_INDEX_BASE + 1200,modal: Z_INDEX_BASE + 1300,snackbar: Z_INDEX_BASE + 1400,tooltip: Z_INDEX_BASE + 1500,},};console.log('themeObject', themeObject);// A custom theme for this appconst theme = createTheme(themeObject);export default theme;12347 unmodified lines1213141516171 unmodified line19202122232425262728293031323334353637383940import {createTheme} from '@mui/material/styles';const themeObject = {palette: {7 unmodified linestext: {primary: '#1C2A33'},},typography: {fontFamily: ['Optimistic Text','Roboto',1 unmodified line'Arial','sans-serif',].join(','),h1: {fontSize: '1rem', fontWeight: '500'},},};const theme = createTheme(themeObject);/*** Set up a responsive font size at the 600px breakpoint*/// default is 1rem (16px)theme.typography.body1[theme.breakpoints.down('sm')] = {fontSize: '0.875rem'};// default is 1rem (16px)theme.typography.h1[theme.breakpoints.down('sm')] = {fontSize: '0.875rem'};// default is 0.875rem (14px)theme.typography.button[theme.breakpoints.down('sm')] = {fontSize: '0.75rem'};// default is 0.875rem (14px)theme.typography.body2[theme.breakpoints.down('sm')] = {fontSize: '0.75rem'};export default theme;
streaming-react-app/src/StreamingInterface.css-4
streaming-react-app/src/StreamingInterface.tsx+75-66
streaming-react-app/src/theme.ts+13-41