From 865c9cc345aa105714dfe3ccf1d1c0a9a6a75f7f Mon Sep 17 00:00:00 2001 From: piotrruss Date: Sun, 19 Sep 2021 12:47:21 +0200 Subject: youtube & player apps fixes --- components/App.js | 6 ++++-- components/Header.js | 17 +++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'components') diff --git a/components/App.js b/components/App.js index 9faa9c9..f6a297b 100644 --- a/components/App.js +++ b/components/App.js @@ -1,11 +1,13 @@ import { useEffect, useRef } from 'react' +import useApps from 'hooks/useApps' import useSettings from 'hooks/useSettings' import useMediaQuery from 'hooks/useMediaQuery' import { close, toggleMin, toggleMax, move, focus } from 'helpers/windowActions' import { faArrowUp, faExpandAlt, faTimes, faCompressAlt } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -const App = ({ children, app, setApps }) => { +const App = ({ children, app }) => { + const { apps, setApps } = useApps() const { t } = useSettings() const winRef = useRef(null) const forceMax = useMediaQuery(`(max-width: ${app.width}), (max-height: ${app.height})`) @@ -36,7 +38,7 @@ const App = ({ children, app, setApps }) => {
{children}
{app.buttons.includes('min') && ( - { e.preventDefault(); e.stopPropagation(); toggleMin(app.name, setApps) }}> + { e.preventDefault(); e.stopPropagation(); toggleMin(app.name, apps, setApps) }}> )} diff --git a/components/Header.js b/components/Header.js index 87c31e8..5e4ff12 100644 --- a/components/Header.js +++ b/components/Header.js @@ -8,7 +8,7 @@ import { focus, toggleMin, open, close } from 'helpers/windowActions' import appList from 'configs/appList' import useSettings from 'hooks/useSettings' import useApps from 'hooks/useApps' -import { faTimes } from '@fortawesome/free-solid-svg-icons' +import { faArrowUp, faTimes } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' const Header = () => { @@ -30,7 +30,7 @@ const Header = () => { const handleClick = (app, setApps) => { if (app.min) { - toggleMin(app.name, setApps) + toggleMin(app.name, apps, setApps) } focus(app.name, setApps) } @@ -54,13 +54,18 @@ const Header = () => { onClick={() => handleClick(app, setApps)} > a && a.name === app.name) === apps.length - 1 ? 'active' : '' + } style={{ - ...apps.findIndex(a => a && a.name === app.name) === apps.length - 1 ? { fontWeight: 600 } : {}, ...app.min ? { color: '#888' } : {} }} > - {t(app.name)} - close(app.name, setApps)}> + {t(app.name)} + { e.stopPropagation(); toggleMin(app.name, apps, setApps) }}> + + + { e.stopPropagation(); close(app.name, setApps) }}> @@ -69,7 +74,7 @@ const Header = () => { }) }
  • - setShowApps(false)} className='window__button'>{t('close')} +
    setShowApps(false)} className='window__button'>{t('close')}
  • -- cgit v1.2.3