From f31dd4460d0e76243180ad9e6549f69b7cf2eab3 Mon Sep 17 00:00:00 2001 From: ConnorsApps Date: Wed, 25 Dec 2024 09:41:05 -0500 Subject: [PATCH 1/6] Start making surfaces larger --- src/components/Client.tsx | 4 ++-- src/components/Group.tsx | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/components/Client.tsx b/src/components/Client.tsx index 9d0c6d3..f33b14f 100644 --- a/src/components/Client.tsx +++ b/src/components/Client.tsx @@ -93,10 +93,10 @@ export default function Client(props: ClientProps) { // 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} diff --git a/src/components/Group.tsx b/src/components/Group.tsx index 3831e3a..15f6352 100644 --- a/src/components/Group.tsx +++ b/src/components/Group.tsx @@ -245,14 +245,19 @@ 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: 120, p: 1 }} 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} + + ))} From 8d3f05044aa318b9fb6f27c30c4f44d7841f6aff Mon Sep 17 00:00:00 2001 From: ConnorsApps Date: Wed, 25 Dec 2024 19:50:30 -0500 Subject: [PATCH 2/6] wip --- .env | 3 +- src/components/Client.tsx | 34 +++++++++++--- src/components/Group.tsx | 22 +++++----- src/components/Settings.tsx | 4 +- src/components/SnapWeb.tsx | 88 ++++++++++++++++++++----------------- 5 files changed, 89 insertions(+), 62 deletions(-) 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 f33b14f..a7e2530 100644 --- a/src/components/Client.tsx +++ b/src/components/Client.tsx @@ -86,9 +86,29 @@ 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); @@ -103,15 +123,15 @@ export default function Client(props: ClientProps) { { handleMuteClicked() }}> - {props.client.config.volume.muted ? : } + {props.client.config.volume.muted ? : } - { handleVolumeChange(value as number) }} /> + { handleVolumeChange(value as number) }} /> { handleOptionsClicked(event); }}> - + - - + + diff --git a/src/components/Group.tsx b/src/components/Group.tsx index 15f6352..36ba9b7 100644 --- a/src/components/Group.tsx +++ b/src/components/Group.tsx @@ -259,7 +259,7 @@ export default function Group(props: GroupProps) { alignItems="center" > { handleSettingsClicked(event); }}> - + @@ -268,7 +268,7 @@ export default function Group(props: GroupProps) { value={props.group.stream_id} label="Active stream" inputProps={{ 'aria-label': 'Active stream' }} - sx={{ minWidth: 120, p: 1 }} + sx={{ minWidth: "12rem" }} onChange={(event) => { const stream: string = event.target.value; setStreamId(stream); @@ -279,7 +279,7 @@ export default function Group(props: GroupProps) { {stream.id} @@ -322,11 +322,11 @@ export default function Group(props: GroupProps) { } {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 && @@ -342,16 +342,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 @@ -359,8 +359,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..49a8dc1 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 ? Date: Wed, 25 Dec 2024 20:04:15 -0500 Subject: [PATCH 3/6] More stuff for phone --- src/components/Client.tsx | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/components/Client.tsx b/src/components/Client.tsx index a7e2530..9b342ef 100644 --- a/src/components/Client.tsx +++ b/src/components/Client.tsx @@ -114,22 +114,12 @@ export default function Client(props: ClientProps) { 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); }}> @@ -144,8 +134,14 @@ export default function Client(props: ClientProps) { > {menuitems} - - + + + { handleMuteClicked() }}> + {props.client.config.volume.muted ? : } + + { handleVolumeChange(value as number) }} /> + + { handleDetailsClose(false) }}> Client settings From ee44d514409af49a3a29be2ae8e5ac593d0b5139 Mon Sep 17 00:00:00 2001 From: ConnorsApps Date: Sun, 29 Dec 2024 08:44:26 -0500 Subject: [PATCH 4/6] resize song titles --- src/components/Group.tsx | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/Group.tsx b/src/components/Group.tsx index 36ba9b7..465a73d 100644 --- a/src/components/Group.tsx +++ b/src/components/Group.tsx @@ -312,10 +312,29 @@ export default function Group(props: GroupProps) { alt={title + " cover"} /> - + {title} - + {artist} From 3e88b2b7580e799b06fe0e3da52f3e5ae6625e03 Mon Sep 17 00:00:00 2001 From: ConnorsApps Date: Sun, 29 Dec 2024 08:47:48 -0500 Subject: [PATCH 5/6] resize --- src/components/Group.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Group.tsx b/src/components/Group.tsx index 465a73d..26c7e31 100644 --- a/src/components/Group.tsx +++ b/src/components/Group.tsx @@ -317,7 +317,7 @@ export default function Group(props: GroupProps) { sx={{ // Resize for mobile to fit long song titles '@media (max-width:600px)': { - fontSize: '3.5vw', + fontSize: '4vw', }, }} variant="subtitle1" @@ -329,7 +329,7 @@ export default function Group(props: GroupProps) { noWrap sx={{ '@media (max-width:600px)': { - fontSize: '3vw', + fontSize: '3.5vw', }, }} variant="body1" From b07abdec634c5d4b99da15437bcc1a01f9ae7a6d Mon Sep 17 00:00:00 2001 From: ConnorsApps Date: Sun, 29 Dec 2024 08:49:12 -0500 Subject: [PATCH 6/6] use sx --- src/components/SnapWeb.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SnapWeb.tsx b/src/components/SnapWeb.tsx index 49a8dc1..fbdb6e6 100644 --- a/src/components/SnapWeb.tsx +++ b/src/components/SnapWeb.tsx @@ -362,7 +362,7 @@ export default function SnapWeb() { sx={{ mr: 2 }} onClick={(_) => { setDrawerOpen(true); }} > - + {appTitle} @@ -376,7 +376,7 @@ export default function SnapWeb() { sx={{ mr: 2 }} onClick={(_) => { setIsPlaying(!isPlaying); }} > - {isPlaying ? : } + {isPlaying ? : } : }