more pwa styles added

This commit is contained in:
Daniel Shleifman
2022-06-19 18:42:04 +03:00
parent f4a9eee631
commit 12ce3299b8
16 changed files with 87 additions and 48 deletions

View File

@@ -1,14 +1,13 @@
import axios from 'axios' import axios from 'axios'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import Button from '@material-ui/core/Button' import Button from '@material-ui/core/Button'
import Dialog from '@material-ui/core/Dialog'
import InfoIcon from '@material-ui/icons/Info' import InfoIcon from '@material-ui/icons/Info'
import ListItemIcon from '@material-ui/core/ListItemIcon' import ListItemIcon from '@material-ui/core/ListItemIcon'
import ListItemText from '@material-ui/core/ListItemText' import ListItemText from '@material-ui/core/ListItemText'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { useMediaQuery } from '@material-ui/core' import { useMediaQuery } from '@material-ui/core'
import { echoHost } from 'utils/Hosts' import { echoHost } from 'utils/Hosts'
import StyledMenuButtonWrapper from 'style/StyledMenuButtonWrapper' import { StyledDialog, StyledMenuButtonWrapper } from 'style/CustomMaterialUiStyles'
import { isStandaloneApp } from 'utils/Utils' import { isStandaloneApp } from 'utils/Utils'
import LinkComponent from './LinkComponent' import LinkComponent from './LinkComponent'
@@ -42,18 +41,19 @@ export default function AboutDialog() {
)} )}
</StyledMenuButtonWrapper> </StyledMenuButtonWrapper>
<Dialog <StyledDialog
open={open} open={open}
onClose={() => setOpen(false)} onClose={() => setOpen(false)}
aria-labelledby='form-dialog-title' aria-labelledby='form-dialog-title'
fullScreen={fullScreen} fullScreen={fullScreen}
maxWidth='xl' maxWidth='xl'
hideBackdrop={isStandaloneApp}
> >
<DialogWrapper> <DialogWrapper>
<HeaderSection> <HeaderSection>
<div>{t('About')}</div> <div>{t('About')}</div>
{torrServerVersion} {torrServerVersion}
<img src='/apple-touch-icon.png' alt='ts-icon' /> <img src='/apple-icon-180.png' alt='ts-icon' />
</HeaderSection> </HeaderSection>
<div style={{ overflow: 'auto' }}> <div style={{ overflow: 'auto' }}>
@@ -88,7 +88,7 @@ export default function AboutDialog() {
</Button> </Button>
</FooterSection> </FooterSection>
</DialogWrapper> </DialogWrapper>
</Dialog> </StyledDialog>
</> </>
) )
} }

View File

@@ -26,6 +26,10 @@ export const HeaderSection = styled.section`
width: 60px; width: 60px;
} }
} }
@media screen and (display-mode: standalone) {
padding-top: 30px;
}
` `
export const ThanksSection = styled.section` export const ThanksSection = styled.section`

View File

@@ -1,6 +1,5 @@
import { useCallback, useEffect, useMemo, useState } from 'react' import { useCallback, useEffect, useMemo, useState } from 'react'
import Button from '@material-ui/core/Button' import Button from '@material-ui/core/Button'
import Dialog from '@material-ui/core/Dialog'
import { torrentsHost, torrentUploadHost } from 'utils/Hosts' import { torrentsHost, torrentUploadHost } from 'utils/Hosts'
import axios from 'axios' import axios from 'axios'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
@@ -10,9 +9,10 @@ import { useMediaQuery } from '@material-ui/core'
import CircularProgress from '@material-ui/core/CircularProgress' import CircularProgress from '@material-ui/core/CircularProgress'
import usePreviousState from 'utils/usePreviousState' import usePreviousState from 'utils/usePreviousState'
import { useQuery } from 'react-query' import { useQuery } from 'react-query'
import { getTorrents } from 'utils/Utils' import { getTorrents, isStandaloneApp } from 'utils/Utils'
import parseTorrent from 'parse-torrent' import parseTorrent from 'parse-torrent'
import { ButtonWrapper, Header } from 'style/DialogStyles' import { ButtonWrapper } from 'style/DialogStyles'
import { StyledDialog, StyledHeader } from 'style/CustomMaterialUiStyles'
import { checkImageURL, getMoviePosters, checkTorrentSource, parseTorrentTitle } from './helpers' import { checkImageURL, getMoviePosters, checkTorrentSource, parseTorrentTitle } from './helpers'
import { Content } from './style' import { Content } from './style'
@@ -223,8 +223,15 @@ export default function AddDialog({
} }
return ( return (
<Dialog open onClose={handleClose} fullScreen={fullScreen} fullWidth maxWidth='md'> <StyledDialog
<Header>{t(isEditMode ? 'EditTorrent' : 'AddNewTorrent')}</Header> open
onClose={handleClose}
fullScreen={fullScreen}
fullWidth
maxWidth='md'
hideBackdrop={isStandaloneApp}
>
<StyledHeader>{t(isEditMode ? 'EditTorrent' : 'AddNewTorrent')}</StyledHeader>
<Content isEditMode={isEditMode}> <Content isEditMode={isEditMode}>
{!isEditMode && ( {!isEditMode && (
@@ -279,6 +286,6 @@ export default function AddDialog({
{isSaving ? <CircularProgress style={{ color: 'white' }} size={20} /> : t(isEditMode ? 'Save' : 'Add')} {isSaving ? <CircularProgress style={{ color: 'white' }} size={20} /> : t(isEditMode ? 'Save' : 'Add')}
</Button> </Button>
</ButtonWrapper> </ButtonWrapper>
</Dialog> </StyledDialog>
) )
} }

View File

@@ -3,7 +3,7 @@ import ListItemIcon from '@material-ui/core/ListItemIcon'
import LibraryAddIcon from '@material-ui/icons/LibraryAdd' import LibraryAddIcon from '@material-ui/icons/LibraryAdd'
import ListItemText from '@material-ui/core/ListItemText' import ListItemText from '@material-ui/core/ListItemText'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import StyledMenuButtonWrapper from 'style/StyledMenuButtonWrapper' import { StyledMenuButtonWrapper } from 'style/CustomMaterialUiStyles'
import { isStandaloneApp } from 'utils/Utils' import { isStandaloneApp } from 'utils/Utils'
import AddDialog from './AddDialog' import AddDialog from './AddDialog'

View File

@@ -1,7 +1,7 @@
import { CreditCard as CreditCardIcon } from '@material-ui/icons' import { CreditCard as CreditCardIcon } from '@material-ui/icons'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import CloseServer from 'components/CloseServer' import CloseServer from 'components/CloseServer'
import StyledMenuButtonWrapper from 'style/StyledMenuButtonWrapper' import { StyledMenuButtonWrapper } from 'style/CustomMaterialUiStyles'
import AddDialogButton from 'components/Add' import AddDialogButton from 'components/Add'
import AboutDialog from 'components/About' import AboutDialog from 'components/About'
import SettingsDialogButton from 'components/Settings' import SettingsDialogButton from 'components/Settings'

View File

@@ -1,12 +1,14 @@
import styled from 'styled-components' import styled from 'styled-components'
export const pwaFooterHeight = 90
export default styled.div` export default styled.div`
background: #575757; background: #575757;
color: #fff; color: #fff;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
height: 90px; height: ${pwaFooterHeight}px;
display: none; display: none;

View File

@@ -2,6 +2,8 @@ import { IconButton } from '@material-ui/core'
import { rgba } from 'polished' import { rgba } from 'polished'
import styled, { css } from 'styled-components' import styled, { css } from 'styled-components'
import { pwaFooterHeight } from './PWAFooter/style'
export const AppWrapper = styled.div` export const AppWrapper = styled.div`
${({ ${({
theme: { theme: {
@@ -19,7 +21,7 @@ export const AppWrapper = styled.div`
@media screen and (display-mode: standalone) { @media screen and (display-mode: standalone) {
grid-template-columns: 0 1fr; grid-template-columns: 0 1fr;
grid-template-rows: 90px 1fr 90px; grid-template-rows: ${pwaFooterHeight}px 1fr ${pwaFooterHeight}px;
height: 100vh; height: 100vh;
} }
`} `}
@@ -50,7 +52,7 @@ export const AppHeader = styled.div`
padding: 7px 16px; padding: 7px 16px;
position: fixed; position: fixed;
width: 100%; width: 100%;
height: 90px; height: ${pwaFooterHeight}px;
} }
`} `}
` `
@@ -105,7 +107,7 @@ export const TorrentListWrapper = styled.div`
} }
@media screen and (display-mode: standalone) { @media screen and (display-mode: standalone) {
height: calc(100vh - 90px); height: calc(100vh - ${pwaFooterHeight}px);
padding-bottom: 105px; padding-bottom: 105px;
} }
` `

View File

@@ -4,7 +4,7 @@ import { PowerSettingsNew as PowerSettingsNewIcon } from '@material-ui/icons'
import { shutdownHost } from 'utils/Hosts' import { shutdownHost } from 'utils/Hosts'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { isStandaloneApp } from 'utils/Utils' import { isStandaloneApp } from 'utils/Utils'
import StyledMenuButtonWrapper from 'style/StyledMenuButtonWrapper' import { StyledMenuButtonWrapper } from 'style/CustomMaterialUiStyles'
export default function CloseServer({ isOffline, isLoading }) { export default function CloseServer({ isOffline, isLoading }) {
const { t } = useTranslation() const { t } = useTranslation()

View File

@@ -1,9 +1,10 @@
import { AppBar, IconButton, makeStyles, Toolbar, Typography } from '@material-ui/core' import { AppBar, IconButton, makeStyles, Toolbar, Typography } from '@material-ui/core'
import CloseIcon from '@material-ui/icons/Close' import CloseIcon from '@material-ui/icons/Close'
import { ArrowBack } from '@material-ui/icons' import { ArrowBack } from '@material-ui/icons'
import { isStandaloneApp } from 'utils/Utils'
const useStyles = makeStyles({ const useStyles = makeStyles({
appBar: { position: 'relative' }, appBar: { position: 'relative', ...(isStandaloneApp && { paddingTop: '30px' }) },
title: { marginLeft: '5px', flex: 1 }, title: { marginLeft: '5px', flex: 1 },
}) })

View File

@@ -1,5 +1,4 @@
import axios from 'axios' import axios from 'axios'
import Dialog from '@material-ui/core/Dialog'
import Button from '@material-ui/core/Button' import Button from '@material-ui/core/Button'
import Checkbox from '@material-ui/core/Checkbox' import Checkbox from '@material-ui/core/Checkbox'
import { FormControlLabel, useMediaQuery, useTheme } from '@material-ui/core' import { FormControlLabel, useMediaQuery, useTheme } from '@material-ui/core'
@@ -11,6 +10,8 @@ import Tabs from '@material-ui/core/Tabs'
import Tab from '@material-ui/core/Tab' import Tab from '@material-ui/core/Tab'
import SwipeableViews from 'react-swipeable-views' import SwipeableViews from 'react-swipeable-views'
import CircularProgress from '@material-ui/core/CircularProgress' import CircularProgress from '@material-ui/core/CircularProgress'
import { StyledDialog } from 'style/CustomMaterialUiStyles'
import { isStandaloneApp } from 'utils/Utils'
import { SettingsHeader, FooterSection, Content } from './style' import { SettingsHeader, FooterSection, Content } from './style'
import defaultSettings from './defaultSettings' import defaultSettings from './defaultSettings'
@@ -82,7 +83,14 @@ export default function SettingsDialog({ handleClose }) {
const handleChangeIndex = index => setSelectedTab(index) const handleChangeIndex = index => setSelectedTab(index)
return ( return (
<Dialog open onClose={handleClose} fullScreen={fullScreen} fullWidth maxWidth='md'> <StyledDialog
open
onClose={handleClose}
fullScreen={fullScreen}
fullWidth
maxWidth='md'
hideBackdrop={isStandaloneApp}
>
<SettingsHeader> <SettingsHeader>
<div>{t('SettingsDialog.Settings')}</div> <div>{t('SettingsDialog.Settings')}</div>
<FormControlLabel <FormControlLabel
@@ -179,6 +187,6 @@ export default function SettingsDialog({ handleClose }) {
{t('Save')} {t('Save')}
</Button> </Button>
</FooterSection> </FooterSection>
</Dialog> </StyledDialog>
) )
} }

View File

@@ -3,7 +3,7 @@ import ListItemText from '@material-ui/core/ListItemText'
import { useState } from 'react' import { useState } from 'react'
import SettingsIcon from '@material-ui/icons/Settings' import SettingsIcon from '@material-ui/icons/Settings'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import StyledMenuButtonWrapper from 'style/StyledMenuButtonWrapper' import { StyledMenuButtonWrapper } from 'style/CustomMaterialUiStyles'
import { isStandaloneApp } from 'utils/Utils' import { isStandaloneApp } from 'utils/Utils'
import SettingsDialog from './SettingsDialog' import SettingsDialog from './SettingsDialog'

View File

@@ -1,11 +1,11 @@
import styled, { css } from 'styled-components' import styled, { css } from 'styled-components'
import { mainColors } from 'style/colors' import { mainColors } from 'style/colors'
import { Header } from 'style/DialogStyles' import { StyledHeader } from 'style/CustomMaterialUiStyles'
export const cacheBeforeReaderColor = '#b3dfc9' export const cacheBeforeReaderColor = '#b3dfc9'
export const cacheAfterReaderColor = mainColors.light.primary export const cacheAfterReaderColor = mainColors.light.primary
export const SettingsHeader = styled(Header)` export const SettingsHeader = styled(StyledHeader)`
display: grid; display: grid;
grid-auto-flow: column; grid-auto-flow: column;
align-items: center; align-items: center;

View File

@@ -5,7 +5,7 @@ import {
Close as CloseIcon, Close as CloseIcon,
Delete as DeleteIcon, Delete as DeleteIcon,
} from '@material-ui/icons' } from '@material-ui/icons'
import { getPeerString, humanizeSize, humanizeSpeed, removeRedundantCharacters } from 'utils/Utils' import { getPeerString, humanizeSize, humanizeSpeed, isStandaloneApp, removeRedundantCharacters } from 'utils/Utils'
import { playlistTorrHost, torrentsHost } from 'utils/Hosts' import { playlistTorrHost, torrentsHost } from 'utils/Hosts'
import { NoImageIcon } from 'icons' import { NoImageIcon } from 'icons'
import DialogTorrentDetailsContent from 'components/DialogTorrentDetailsContent' import DialogTorrentDetailsContent from 'components/DialogTorrentDetailsContent'
@@ -16,6 +16,7 @@ import axios from 'axios'
import ptt from 'parse-torrent-title' import ptt from 'parse-torrent-title'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import AddDialog from 'components/Add/AddDialog' import AddDialog from 'components/Add/AddDialog'
import { StyledDialog } from 'style/CustomMaterialUiStyles'
import { StyledButton, TorrentCard, TorrentCardButtons, TorrentCardDescription, TorrentCardPoster } from './style' import { StyledButton, TorrentCard, TorrentCardButtons, TorrentCardDescription, TorrentCardPoster } from './style'
@@ -121,16 +122,17 @@ const Torrent = ({ torrent }) => {
</TorrentCardDescription> </TorrentCardDescription>
</TorrentCard> </TorrentCard>
<Dialog <StyledDialog
open={isDetailedInfoOpened} open={isDetailedInfoOpened}
onClose={closeDetailedInfo} onClose={closeDetailedInfo}
fullScreen={fullScreen} fullScreen={fullScreen}
fullWidth fullWidth
maxWidth='xl' maxWidth='xl'
TransitionComponent={Transition} TransitionComponent={Transition}
hideBackdrop={isStandaloneApp}
> >
<DialogTorrentDetailsContent closeDialog={closeDetailedInfo} torrent={torrent} /> <DialogTorrentDetailsContent closeDialog={closeDetailedInfo} torrent={torrent} />
</Dialog> </StyledDialog>
<Dialog open={isDeleteTorrentOpened} onClose={closeDeleteTorrentAlert}> <Dialog open={isDeleteTorrentOpened} onClose={closeDeleteTorrentAlert}>
<DialogTitle>{t('DeleteTorrent?')}</DialogTitle> <DialogTitle>{t('DeleteTorrent?')}</DialogTitle>

View File

@@ -0,0 +1,33 @@
import { ListItem } from '@material-ui/core'
import Dialog from '@material-ui/core/Dialog'
import { pwaFooterHeight } from 'components/App/PWAFooter/style'
import styled from 'styled-components'
import { Header } from 'style/DialogStyles'
export const StyledMenuButtonWrapper = styled(ListItem).attrs({ button: true })`
@media screen and (display-mode: standalone) {
width: 100%;
height: 60px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 10px;
}
`
export const StyledDialog = styled(Dialog)`
@media screen and (display-mode: standalone) {
margin-bottom: ${pwaFooterHeight}px;
.MuiDialog-container .MuiPaper-root {
box-shadow: none;
}
}
`
export const StyledHeader = styled(Header)`
@media screen and (display-mode: standalone) {
padding-top: 47px;
}
`

View File

@@ -22,12 +22,6 @@ export default createGlobalStyle`
} }
} }
header {
@media screen and (display-mode: standalone) {
padding-top: 30px;
}
}
button { button {
font-family: "Open Sans", sans-serif; font-family: "Open Sans", sans-serif;
letter-spacing: -0.1px; letter-spacing: -0.1px;

View File

@@ -1,14 +0,0 @@
import { ListItem } from '@material-ui/core'
import styled from 'styled-components'
export default styled(ListItem).attrs({ button: true })`
@media screen and (display-mode: standalone) {
width: 100%;
height: 60px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 10px;
}
`