diff --git a/src/Footer.js b/src/Footer.js index a6c645b..6597f70 100644 --- a/src/Footer.js +++ b/src/Footer.js @@ -67,7 +67,11 @@ const useStyles = makeStyles((theme) => ({ }, })); -function Resources(props) { +function Resources({ + getResources = () => { + return null; + }, +}) { const classes = useStyles(); const [$popover, setPopover] = React.useState(null); const [$resources, setResources] = React.useState(null); @@ -94,7 +98,7 @@ function Resources(props) { }, []); const update = async () => { - const resources = await props.resources(); + const resources = await getResources(); if (resources === null) { return; } @@ -347,12 +351,6 @@ function Resources(props) { ); } -Resources.defaultProps = { - resources: () => { - return null; - }, -}; - const initVersion = (initialVersion) => { if (!initialVersion) { initialVersion = {}; @@ -367,11 +365,18 @@ const initVersion = (initialVersion) => { return version; }; -export default function Footer(props) { +export default function Footer({ + expand = false, + app = '', + name = '', + version = initVersion(), + getResources = () => { + return null; + }, +}) { const classes = useStyles(); - const version = initVersion(props.version); - if (props.expand === true) { + if (expand === true) { return ( @@ -379,10 +384,10 @@ export default function Footer(props) { - {props.app} v{version.number} ({version.arch}) {props.name ? '- ' + props.name : ''} + {app} v{version.number} ({version.arch}) {name ? '- ' + name : ''} - + @@ -401,13 +406,3 @@ export default function Footer(props) { ); } } - -Footer.defaultProps = { - expand: false, - app: '', - name: '', - version: initVersion(), - resources: () => { - return null; - }, -}; diff --git a/src/Header.js b/src/Header.js index 0cdfffa..41e664d 100644 --- a/src/Header.js +++ b/src/Header.js @@ -160,12 +160,12 @@ const StyledMenu = styled((props) => ( }, })); -function AboutModal(props) { +function AboutModal({ open = false, onClose = () => {} }) { const classes = useStyles(); return ( - - + + @@ -215,12 +215,17 @@ function AboutModal(props) { ); } -AboutModal.defaultProps = { - open: false, - onClose: () => {}, -}; - -function HeaderMenu(props) { +function HeaderMenu({ + onChannel = () => {}, + onPlayersite = () => {}, + onSettings = () => {}, + onLogout = () => {}, + expand = true, + showPlayersite = false, + showSettings = false, + hasUpdates = false, + hasService = false, +}) { const classes = useStyles(); const [$anchorEl, setAnchorEl] = React.useState(null); @@ -238,17 +243,17 @@ function HeaderMenu(props) { Storage.Set('language', language); }; - if (props.expand === true) { + if (expand === true) { return ( - + - + - {props.hasService === true && ( + {hasService === true && ( @@ -259,18 +264,18 @@ function HeaderMenu(props) { )} - {props.showPlayersite === true && ( - + {showPlayersite === true && ( + Playersite )} - {props.showSettings === true && ( - + {showSettings === true && ( + - + System @@ -300,7 +305,7 @@ function HeaderMenu(props) { - + @@ -348,19 +353,17 @@ function HeaderMenu(props) { } } -HeaderMenu.defaultProps = { - onChannel: () => {}, - onPlayersite: () => {}, - onSettings: () => {}, - onLogout: () => {}, - expand: false, - showPlayersite: false, - showSettings: false, - hasUpdates: false, - hasService: false, -}; - -export default function Header(props) { +export default function Header({ + onChannel = () => {}, + onPlayersite = () => {}, + onSettings = () => {}, + onLogout = () => {}, + expand = true, + showPlayersite = false, + showSettings = false, + hasUpdates = false, + hasService = false, +}) { const classes = useStyles(); return ( @@ -372,14 +375,20 @@ export default function Header(props) { Restreamer - + ); } - -Header.defaultProps = { - expand: false, -}; diff --git a/src/RestreamerUI.js b/src/RestreamerUI.js index 7b22b16..6ac419d 100644 --- a/src/RestreamerUI.js +++ b/src/RestreamerUI.js @@ -40,7 +40,7 @@ const useStyles = makeStyles((theme) => ({ }, })); -export default function RestreamerUI(props) { +export default function RestreamerUI({ address = '' }) { const classes = useStyles(); const [$state, setState] = React.useState({ @@ -121,7 +121,7 @@ export default function RestreamerUI(props) { }; const handleMount = async () => { - restreamer.current = new Restreamer(props.address); + restreamer.current = new Restreamer(address); restreamer.current.AddListener((event) => { notify(event.severity, event.type, event.message); }); @@ -452,7 +452,7 @@ export default function RestreamerUI(props) { name = restreamer.current.Name(); } - let resources = () => { + let getResources = () => { return null; }; @@ -490,7 +490,7 @@ export default function RestreamerUI(props) { ); } else { view = ; - resources = handleResources; + getResources = handleResources; } } @@ -523,7 +523,7 @@ export default function RestreamerUI(props) { -