mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
poster hidden if no torrent source
This commit is contained in:
@@ -23,16 +23,17 @@ import {
|
|||||||
Content,
|
Content,
|
||||||
Header,
|
Header,
|
||||||
IconWrapper,
|
IconWrapper,
|
||||||
LeftSide,
|
RightSide,
|
||||||
Poster,
|
Poster,
|
||||||
PosterSuggestions,
|
PosterSuggestions,
|
||||||
PosterSuggestionsItem,
|
PosterSuggestionsItem,
|
||||||
PosterWrapper,
|
PosterWrapper,
|
||||||
RightSide,
|
LeftSide,
|
||||||
RightSideBottomSectionFileSelected,
|
LeftSideBottomSectionFileSelected,
|
||||||
RightSideBottomSectionNoFile,
|
LeftSideBottomSectionNoFile,
|
||||||
RightSideTopSection,
|
LeftSideTopSection,
|
||||||
TorrentIconWrapper,
|
TorrentIconWrapper,
|
||||||
|
RightSideContainer,
|
||||||
} from './style'
|
} from './style'
|
||||||
import { checkImageURL, getMoviePosters } from './helpers'
|
import { checkImageURL, getMoviePosters } from './helpers'
|
||||||
|
|
||||||
@@ -173,72 +174,7 @@ export default function AddDialog({ handleClose }) {
|
|||||||
|
|
||||||
<Content>
|
<Content>
|
||||||
<LeftSide>
|
<LeftSide>
|
||||||
<TextField
|
<LeftSideTopSection active={isTorrentSourceActive}>
|
||||||
onChange={handleTitleChange}
|
|
||||||
value={title}
|
|
||||||
margin='dense'
|
|
||||||
label={t('Title')}
|
|
||||||
type='text'
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
<TextField
|
|
||||||
onChange={handlePosterUrlChange}
|
|
||||||
value={posterUrl}
|
|
||||||
margin='dense'
|
|
||||||
label={t('AddPosterLinkInput')}
|
|
||||||
type='url'
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
|
|
||||||
<PosterWrapper>
|
|
||||||
<Poster poster={+isPosterUrlCorrect}>
|
|
||||||
{isPosterUrlCorrect ? <img src={posterUrl} alt='poster' /> : <NoImageIcon />}
|
|
||||||
</Poster>
|
|
||||||
|
|
||||||
<PosterSuggestions>
|
|
||||||
{posterList
|
|
||||||
?.filter(url => url !== posterUrl)
|
|
||||||
.slice(0, 12)
|
|
||||||
.map(url => (
|
|
||||||
<PosterSuggestionsItem onClick={() => userChangesPosterUrl(url)} key={uuidv4()}>
|
|
||||||
<img src={url} alt='poster' />
|
|
||||||
</PosterSuggestionsItem>
|
|
||||||
))}
|
|
||||||
</PosterSuggestions>
|
|
||||||
|
|
||||||
{currentLang !== 'en' && (
|
|
||||||
<PosterLanguageSwitch
|
|
||||||
onClick={() => {
|
|
||||||
const newLanguage = posterSearchLanguage === 'en' ? 'ru' : 'en'
|
|
||||||
setPosterSearchLanguage(newLanguage)
|
|
||||||
posterSearch(title, newLanguage, { shouldRefreshMainPoster: true })
|
|
||||||
}}
|
|
||||||
showbutton={+isPosterUrlCorrect}
|
|
||||||
color='primary'
|
|
||||||
variant='contained'
|
|
||||||
size='small'
|
|
||||||
>
|
|
||||||
{posterSearchLanguage === 'en' ? 'EN' : 'RU'}
|
|
||||||
</PosterLanguageSwitch>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<ClearPosterButton
|
|
||||||
showbutton={+isPosterUrlCorrect}
|
|
||||||
onClick={() => {
|
|
||||||
removePoster()
|
|
||||||
setIsUserInteractedWithPoster(true)
|
|
||||||
}}
|
|
||||||
color='primary'
|
|
||||||
variant='contained'
|
|
||||||
size='small'
|
|
||||||
>
|
|
||||||
{t('Clear')}
|
|
||||||
</ClearPosterButton>
|
|
||||||
</PosterWrapper>
|
|
||||||
</LeftSide>
|
|
||||||
|
|
||||||
<RightSide>
|
|
||||||
<RightSideTopSection active={isTorrentSourceActive}>
|
|
||||||
<TextField
|
<TextField
|
||||||
onChange={handleTorrentSourceChange}
|
onChange={handleTorrentSourceChange}
|
||||||
value={torrentSource}
|
value={torrentSource}
|
||||||
@@ -252,10 +188,10 @@ export default function AddDialog({ handleClose }) {
|
|||||||
inputProps={{ autoComplete: 'off' }}
|
inputProps={{ autoComplete: 'off' }}
|
||||||
disabled={!!selectedFile}
|
disabled={!!selectedFile}
|
||||||
/>
|
/>
|
||||||
</RightSideTopSection>
|
</LeftSideTopSection>
|
||||||
|
|
||||||
{selectedFile ? (
|
{selectedFile ? (
|
||||||
<RightSideBottomSectionFileSelected>
|
<LeftSideBottomSectionFileSelected>
|
||||||
<TorrentIconWrapper>
|
<TorrentIconWrapper>
|
||||||
<TorrentIcon />
|
<TorrentIcon />
|
||||||
|
|
||||||
@@ -263,9 +199,9 @@ export default function AddDialog({ handleClose }) {
|
|||||||
<CancelIcon />
|
<CancelIcon />
|
||||||
</CancelIconWrapper>
|
</CancelIconWrapper>
|
||||||
</TorrentIconWrapper>
|
</TorrentIconWrapper>
|
||||||
</RightSideBottomSectionFileSelected>
|
</LeftSideBottomSectionFileSelected>
|
||||||
) : (
|
) : (
|
||||||
<RightSideBottomSectionNoFile isDragActive={isDragActive} {...getRootProps()}>
|
<LeftSideBottomSectionNoFile isDragActive={isDragActive} {...getRootProps()}>
|
||||||
<input {...getInputProps()} />
|
<input {...getInputProps()} />
|
||||||
<div>{t('AppendFile.Or')}</div>
|
<div>{t('AppendFile.Or')}</div>
|
||||||
|
|
||||||
@@ -273,8 +209,77 @@ export default function AddDialog({ handleClose }) {
|
|||||||
<AddItemIcon color='primary' />
|
<AddItemIcon color='primary' />
|
||||||
<div>{t('AppendFile.ClickOrDrag')}</div>
|
<div>{t('AppendFile.ClickOrDrag')}</div>
|
||||||
</IconWrapper>
|
</IconWrapper>
|
||||||
</RightSideBottomSectionNoFile>
|
</LeftSideBottomSectionNoFile>
|
||||||
)}
|
)}
|
||||||
|
</LeftSide>
|
||||||
|
|
||||||
|
<RightSide>
|
||||||
|
<RightSideContainer isHidden={!torrentSource}>
|
||||||
|
<TextField
|
||||||
|
onChange={handleTitleChange}
|
||||||
|
value={title}
|
||||||
|
margin='dense'
|
||||||
|
label={t('Title')}
|
||||||
|
type='text'
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
onChange={handlePosterUrlChange}
|
||||||
|
value={posterUrl}
|
||||||
|
margin='dense'
|
||||||
|
label={t('AddPosterLinkInput')}
|
||||||
|
type='url'
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
|
||||||
|
<PosterWrapper>
|
||||||
|
<Poster poster={+isPosterUrlCorrect}>
|
||||||
|
{isPosterUrlCorrect ? <img src={posterUrl} alt='poster' /> : <NoImageIcon />}
|
||||||
|
</Poster>
|
||||||
|
|
||||||
|
<PosterSuggestions>
|
||||||
|
{posterList
|
||||||
|
?.filter(url => url !== posterUrl)
|
||||||
|
.slice(0, 12)
|
||||||
|
.map(url => (
|
||||||
|
<PosterSuggestionsItem onClick={() => userChangesPosterUrl(url)} key={uuidv4()}>
|
||||||
|
<img src={url} alt='poster' />
|
||||||
|
</PosterSuggestionsItem>
|
||||||
|
))}
|
||||||
|
</PosterSuggestions>
|
||||||
|
|
||||||
|
{currentLang !== 'en' && (
|
||||||
|
<PosterLanguageSwitch
|
||||||
|
onClick={() => {
|
||||||
|
const newLanguage = posterSearchLanguage === 'en' ? 'ru' : 'en'
|
||||||
|
setPosterSearchLanguage(newLanguage)
|
||||||
|
posterSearch(title, newLanguage, { shouldRefreshMainPoster: true })
|
||||||
|
}}
|
||||||
|
showbutton={+isPosterUrlCorrect}
|
||||||
|
color='primary'
|
||||||
|
variant='contained'
|
||||||
|
size='small'
|
||||||
|
>
|
||||||
|
{posterSearchLanguage === 'en' ? 'EN' : 'RU'}
|
||||||
|
</PosterLanguageSwitch>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<ClearPosterButton
|
||||||
|
showbutton={+isPosterUrlCorrect}
|
||||||
|
onClick={() => {
|
||||||
|
removePoster()
|
||||||
|
setIsUserInteractedWithPoster(true)
|
||||||
|
}}
|
||||||
|
color='primary'
|
||||||
|
variant='contained'
|
||||||
|
size='small'
|
||||||
|
>
|
||||||
|
{t('Clear')}
|
||||||
|
</ClearPosterButton>
|
||||||
|
</PosterWrapper>
|
||||||
|
</RightSideContainer>
|
||||||
|
|
||||||
|
<RightSideContainer notificationMessage={t('AddTorrentSourceNotification')} isHidden={torrentSource} />
|
||||||
</RightSide>
|
</RightSide>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
||||||
|
|||||||
@@ -25,24 +25,56 @@ export const Content = styled.div`
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
export const LeftSide = styled.div`
|
|
||||||
padding: 0 20px 20px 20px;
|
|
||||||
border-right: 1px solid rgba(0, 0, 0, 0.12);
|
|
||||||
`
|
|
||||||
export const RightSide = styled.div`
|
export const RightSide = styled.div`
|
||||||
display: flex;
|
padding: 0 20px 20px 20px;
|
||||||
flex-direction: column;
|
|
||||||
`
|
`
|
||||||
|
|
||||||
export const RightSideBottomSectionBasicStyles = css`
|
export const RightSideContainer = styled.div`
|
||||||
|
${({ isHidden, notificationMessage }) => css`
|
||||||
|
height: 455px;
|
||||||
|
|
||||||
|
${notificationMessage &&
|
||||||
|
css`
|
||||||
|
position: relative;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
:before {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 300;
|
||||||
|
content: '${notificationMessage}';
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
background: #84cda7;
|
||||||
|
padding: 10px 15px;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
`};
|
||||||
|
|
||||||
|
${isHidden &&
|
||||||
|
css`
|
||||||
|
display: none;
|
||||||
|
`};
|
||||||
|
`}
|
||||||
|
`
|
||||||
|
export const LeftSide = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
border-right: 1px solid rgba(0, 0, 0, 0.12);
|
||||||
|
`
|
||||||
|
|
||||||
|
export const LeftSideBottomSectionBasicStyles = css`
|
||||||
transition: transform 0.3s;
|
transition: transform 0.3s;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: grid;
|
display: grid;
|
||||||
`
|
`
|
||||||
|
|
||||||
export const RightSideBottomSectionNoFile = styled.div`
|
export const LeftSideBottomSectionNoFile = styled.div`
|
||||||
${RightSideBottomSectionBasicStyles}
|
${LeftSideBottomSectionBasicStyles}
|
||||||
border: 4px dashed transparent;
|
border: 4px dashed transparent;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
@@ -66,8 +98,8 @@ export const RightSideBottomSectionNoFile = styled.div`
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
export const RightSideBottomSectionFileSelected = styled.div`
|
export const LeftSideBottomSectionFileSelected = styled.div`
|
||||||
${RightSideBottomSectionBasicStyles}
|
${LeftSideBottomSectionBasicStyles}
|
||||||
place-items: center;
|
place-items: center;
|
||||||
|
|
||||||
@media (max-width: 930px) {
|
@media (max-width: 930px) {
|
||||||
@@ -107,7 +139,7 @@ export const IconWrapper = styled.div`
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
export const RightSideTopSection = styled.div`
|
export const LeftSideTopSection = styled.div`
|
||||||
background: #e3f2eb;
|
background: #e3f2eb;
|
||||||
padding: 0 20px 20px 20px;
|
padding: 0 20px 20px 20px;
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
@@ -141,11 +173,13 @@ export const PosterWrapper = styled.div`
|
|||||||
export const PosterSuggestions = styled.div`
|
export const PosterSuggestions = styled.div`
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-area: suggestions;
|
grid-area: suggestions;
|
||||||
|
grid-auto-flow: column;
|
||||||
grid-template-columns: repeat(3, max-content);
|
grid-template-columns: repeat(3, max-content);
|
||||||
grid-template-rows: repeat(4, max-content);
|
grid-template-rows: repeat(4, max-content);
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
|
|
||||||
@media (max-width: 540px) {
|
@media (max-width: 540px) {
|
||||||
|
grid-auto-flow: row;
|
||||||
grid-template-columns: repeat(5, max-content);
|
grid-template-columns: repeat(5, max-content);
|
||||||
}
|
}
|
||||||
@media (max-width: 375px) {
|
@media (max-width: 375px) {
|
||||||
@@ -228,8 +262,6 @@ export const ClearPosterButton = styled(Button)`
|
|||||||
export const PosterLanguageSwitch = styled.div`
|
export const PosterLanguageSwitch = styled.div`
|
||||||
grid-area: poster;
|
grid-area: poster;
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
/* justify-self: center; */
|
|
||||||
/* transform: translateY(-50%); */
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
@@ -244,14 +276,9 @@ export const PosterLanguageSwitch = styled.div`
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
/* padding: 0; */
|
|
||||||
|
|
||||||
${({ showbutton }) => !showbutton && 'display: none'};
|
${({ showbutton }) => !showbutton && 'display: none'};
|
||||||
|
|
||||||
/* @media (max-width: 540px) {
|
|
||||||
transform: translateY(-140%);
|
|
||||||
} */
|
|
||||||
|
|
||||||
:hover {
|
:hover {
|
||||||
filter: brightness(1.1);
|
filter: brightness(1.1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,5 +102,6 @@
|
|||||||
"ClickOrDrag": "CLICK / DRAG & DROP (.torrent)"
|
"ClickOrDrag": "CLICK / DRAG & DROP (.torrent)"
|
||||||
},
|
},
|
||||||
"TorrentSourceOptions": "magnet / hash / .torrent file link",
|
"TorrentSourceOptions": "magnet / hash / .torrent file link",
|
||||||
"Clear": "Clear"
|
"Clear": "Clear",
|
||||||
|
"AddTorrentSourceNotification": "First add your torrent source"
|
||||||
}
|
}
|
||||||
@@ -102,5 +102,6 @@
|
|||||||
"ClickOrDrag": "НАЖМИТЕ / ПЕРЕТАЩИТЕ ФАЙЛ (.torrent)"
|
"ClickOrDrag": "НАЖМИТЕ / ПЕРЕТАЩИТЕ ФАЙЛ (.torrent)"
|
||||||
},
|
},
|
||||||
"TorrentSourceOptions": "магнитная ссылка / хеш / ссылка на .torrent файл",
|
"TorrentSourceOptions": "магнитная ссылка / хеш / ссылка на .torrent файл",
|
||||||
"Clear": "Очистить"
|
"Clear": "Очистить",
|
||||||
|
"AddTorrentSourceNotification": "Сначала добавьте торрент источник"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user