diff --git a/.env b/.env index 749c50d..1077b5d 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ -#VITE_APP_SNAPSERVER_HOST = localhost:1780 +#VITE_APP_SNAPSERVER_HOST=localhost:1780 +#VITE_APP_TITLE="Snapcast" VITE_APP_VERSION=$npm_package_version VITE_APP_NAME=$npm_package_name diff --git a/src/components/Client.tsx b/src/components/Client.tsx index 9d0c6d3..9b342ef 100644 --- a/src/components/Client.tsx +++ b/src/components/Client.tsx @@ -86,32 +86,42 @@ export default function Client(props: ClientProps) { } const menuitems = []; - menuitems.push( { handleDetailsClicked() }}>Details); + menuitems.push( + handleDetailsClicked()} + sx={{ minWidth: "12rem", fontSize: "large" }} + > + Details + + ); if (!props.client.connected) - menuitems.push( { props.onDelete(); setAnchorEl(null); setOpen(false); }}>Delete); + menuitems.push( + { + props.onDelete(); + setAnchorEl(null); + setOpen(false); + }} + sx={{ minWidth: "12rem", fontSize: "large" }} + > + Delete + + ); // console.debug("Render Client " + props.client.host.name + ", id: " + props.client.id); return ( - - - - - {/* item style={{ flexGrow: "1" }}> */} - - {props.client.config.name === "" ? props.client.host.name : props.client.config.name} - - - { handleMuteClicked() }}> - {props.client.config.volume.muted ? : } - - { handleVolumeChange(value as number) }} /> - - - - + + + {/* item style={{ flexGrow: "1" }}> */} + + + {props.client.config.name === "" ? props.client.host.name : props.client.config.name} + { handleOptionsClicked(event); }}> - + {menuitems} - - + + + { handleMuteClicked() }}> + {props.client.config.volume.muted ? : } + + { handleVolumeChange(value as number) }} /> + + { handleDetailsClose(false) }}> Client settings @@ -188,8 +204,8 @@ export default function Client(props: ClientProps) { /> - - + + diff --git a/src/components/Group.tsx b/src/components/Group.tsx index 3831e3a..26c7e31 100644 --- a/src/components/Group.tsx +++ b/src/components/Group.tsx @@ -245,16 +245,21 @@ export default function Group(props: GroupProps) { flexGrow: 1 }}> {/* */} - + - + { handleSettingsClicked(event); }}> - + @@ -263,13 +268,22 @@ export default function Group(props: GroupProps) { value={props.group.stream_id} label="Active stream" inputProps={{ 'aria-label': 'Active stream' }} + sx={{ minWidth: "12rem" }} onChange={(event) => { const stream: string = event.target.value; setStreamId(stream); props.snapcontrol.setStream(props.group.id, stream); }} > - {props.server.streams.map(stream => {stream.id})} + {props.server.streams.map(stream => ( + + {stream.id} + + ))} @@ -298,21 +312,40 @@ export default function Group(props: GroupProps) { alt={title + " cover"} /> - + {title} - + {artist} } {groupClients.length > 1 && - + { handleMuteClicked() }}> - {props.group.muted ? : } + {props.group.muted ? : } - { handleVolumeChange(value as number) }} onChangeCommitted={(_, value) => { handleVolumeChangeCommitted(value as number) }} /> + { handleVolumeChange(value as number) }} onChangeCommitted={(_, value) => { handleVolumeChangeCommitted(value as number) }} /> } {groupClients.length === 1 && @@ -328,16 +361,16 @@ export default function Group(props: GroupProps) { { handleSettingsClose(false) }}> - Group settings + Group Settings Stream { console.log('SetStream: ' + event.target.value); setStreamId(event.target.value) }} > - {props.server.streams.map(stream => {stream.id})} + {props.server.streams.map(stream => {stream.id})} Clients @@ -345,8 +378,8 @@ export default function Group(props: GroupProps) { - - + + {snackbar()} diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index 305644d..e1e4ce5 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -45,8 +45,8 @@ export default function SettingsDialog(props: { open: boolean, onClose: (_apply: , checked: boolean) => setShowOffline(checked)} />} label="Show offline clients" /> - - + + diff --git a/src/components/SnapWeb.tsx b/src/components/SnapWeb.tsx index 73a302e..fbdb6e6 100644 --- a/src/components/SnapWeb.tsx +++ b/src/components/SnapWeb.tsx @@ -6,32 +6,22 @@ import useMediaQuery from '@mui/material/useMediaQuery'; import { Theme, config } from "../config"; import { SnapControl, Snapcast } from '../snapcontrol'; import { SnapStream } from '../snapstream'; -import { AppBar, Box, Drawer, List, ListItem, ListItemButton, ListItemText, Toolbar, Typography, IconButton, Snackbar, Alert, Button } from '@mui/material'; +import { AppBar, Box, Drawer, List, ListItem, ListItemButton, ListItemText, Toolbar, Typography, IconButton, Snackbar, Alert, Button, Divider } from '@mui/material'; import { PlayArrow as PlayArrowIcon, Stop as StopIcon, Menu as MenuIcon } from '@mui/icons-material'; -import { createTheme, ThemeProvider } from '@mui/material/styles'; +import { createTheme, CssVarsThemeOptions, ThemeOptions, ThemeProvider } from '@mui/material/styles'; import CssBaseline from '@mui/material/CssBaseline'; import silence from '../assets/10-seconds-of-silence.mp3'; import snapcast512 from '../assets/snapcast-512.png'; +const appTitle = import.meta.env.VITE_APP_TITLE || "Snapcast"; -const lightTheme = createTheme({ - palette: { - primary: { - light: '#757ce8', - main: '#607d8b', - dark: '#002884', - contrastText: '#fff', - }, - secondary: { - light: '#ff7961', - main: '#f44336', - dark: '#ba000d', - contrastText: '#000', - }, - }, +type CreateThemeOptions = Omit & Pick & { + cssVariables?: boolean | Pick;} + +const theme: CreateThemeOptions = { typography: { subtitle1: { - fontSize: 17, + fontSize: 20, }, body1: { fontWeight: 500, @@ -46,13 +36,28 @@ const lightTheme = createTheme({ { spellCheck: false } + }, + MuiButton: { + defaultProps: { + variant: "contained", + } + }, + MuiSelect: { + defaultProps: { + slotProps: { input: { sx: { py: 1 } } } + } + }, + MuiMenuItem: { + defaultProps: { + sx: { fontSize:"large", py: 2 } + } } } -}); +}; -const darkTheme = createTheme({ +const lightTheme = createTheme({ + ...theme, palette: { - mode: 'dark', primary: { light: '#757ce8', main: '#607d8b', @@ -66,25 +71,25 @@ const darkTheme = createTheme({ contrastText: '#000', }, }, - typography: { - subtitle1: { - fontSize: 17, +}); + +const darkTheme = createTheme({ + ...theme, + palette: { + mode: 'dark', + primary: { + light: '#757ce8', + main: '#607d8b', + dark: '#002884', + contrastText: '#fff', }, - body1: { - fontWeight: 500, + secondary: { + light: '#ff7961', + main: '#f44336', + dark: '#ba000d', + contrastText: '#000', }, - h5: { - fontWeight: 300, - } }, - components: { - MuiTextField: { - defaultProps: - { - spellCheck: false - } - } - } }); @@ -305,12 +310,13 @@ export default function SnapWeb() { // onKeyDown={toggleDrawer(anchor, false)} > - + { setAboutOpen(true); setDrawerOpen(false); }}> - + + { setSettingsOpen(true); setDrawerOpen(false); }}> @@ -356,10 +362,10 @@ export default function SnapWeb() { sx={{ mr: 2 }} onClick={(_) => { setDrawerOpen(true); }} > - + - Snapcast + {appTitle} {isConnected ? { setIsPlaying(!isPlaying); }} > - {isPlaying ? : } + {isPlaying ? : } : }