Skip to content

Commit

Permalink
Small style and catch conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorsApps committed Dec 30, 2023
1 parent a3c0125 commit 593379f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Home = () => {
style={{ backgroundImage: `url(${theme.backgroundImage})` }}
>
<AppBar className='appBar' position="static">
<Toolbar variant="regular">
<Toolbar sx={{ paddingY: '.5rem' }} variant="regular">
<h1> {title ?? 'Snapcast Audio'} </h1>
<div className='rightOptions'>
{page === 'settings' && <theme.Selector
Expand Down
2 changes: 0 additions & 2 deletions src/Home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
}

.themeSelector {
margin-top: .5rem;

[role="button"] {
padding-top: .5rem;
}
Expand Down
7 changes: 6 additions & 1 deletion src/utils/AppContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ export const AppContextProvider = ({ children, theme }) => {
}, [setIsLoading]);

useEffect(() => {
connectToSnapcastServer(onMessage, setStatus);
try {
connectToSnapcastServer(onMessage, setStatus);
} catch (error) {
console.error(error);
}

}, [onMessage, setStatus]);

return (
Expand Down
5 changes: 5 additions & 0 deletions src/utils/WebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ const getStatus = () => {

export const connectToSnapcastServer = (onMessage, onStatus, retries = 0) => {
let hasRetried = false;
if (!host) {
onStatus(WEBSOCKET_STATUS.failed);
console.error('REACT_APP_SNAPCAST_HOST is required!');
return;
}

const retry = () => {
hasRetried = true;
Expand Down

0 comments on commit 593379f

Please sign in to comment.