Remove the download button to add clickable badges
BTW, let's create a polochon metadata component
This commit is contained in:
parent
eae4598c88
commit
84ccc6e1eb
@ -3,55 +3,68 @@ import PropTypes from "prop-types"
|
|||||||
import { List } from "immutable"
|
import { List } from "immutable"
|
||||||
|
|
||||||
import Modal from "react-bootstrap/Modal"
|
import Modal from "react-bootstrap/Modal"
|
||||||
import Dropdown from "react-bootstrap/Dropdown"
|
|
||||||
import SplitButton from "react-bootstrap/SplitButton"
|
|
||||||
|
|
||||||
const DownloadButton = (props) => {
|
export const DownloadAndStream = ({ url, name, subtitles }) => {
|
||||||
if (props.url === "") { return null; }
|
if (!url || url === "") { return null; }
|
||||||
const size = props.xs ? "sm" : "";
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<React.Fragment>
|
||||||
|
<DownloadButton url={url} />
|
||||||
|
<StreamButton url={url} name={name} subtitles={subtitles} />
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
DownloadAndStream.propTypes = {
|
||||||
|
url: PropTypes.string,
|
||||||
|
name: PropTypes.string,
|
||||||
|
subtitles: PropTypes.instanceOf(List),
|
||||||
|
};
|
||||||
|
|
||||||
|
const DownloadButton = ({ url }) => (
|
||||||
|
<h5 className="d-inline">
|
||||||
|
<a href={url} className="badge badge-pill badge-primary m-1">
|
||||||
|
<span className="fa fa-download"> </span> Download
|
||||||
|
</a>
|
||||||
|
</h5>
|
||||||
|
);
|
||||||
|
DownloadButton.propTypes = { url: PropTypes.string.isRequired };
|
||||||
|
|
||||||
|
const StreamButton = ({ name, url, subtitles }) => {
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<SplitButton
|
<h5 className="d-inline">
|
||||||
drop="up"
|
<a
|
||||||
variant="danger"
|
href="#"
|
||||||
href={props.url}
|
className="badge badge-pill badge-primary m-1 clickable"
|
||||||
title="Download"
|
onClick={(e) => { e.preventDefault(); setShowModal(true) }}>
|
||||||
size={size}
|
<span className="fa fa-play-circle"> </span> Play
|
||||||
id="download-button-id">
|
</a>
|
||||||
<Dropdown.Item eventKey="1" onClick={() => setShowModal(true)}>
|
</h5>
|
||||||
<span>
|
|
||||||
<i className="fa fa-globe"></i> Stream in browser
|
|
||||||
</span>
|
|
||||||
</Dropdown.Item>
|
|
||||||
</SplitButton>
|
|
||||||
|
|
||||||
<Modal show={showModal} onHide={() => setShowModal(false)} size="lg" centered>
|
<Modal show={showModal} onHide={() => setShowModal(false)} size="lg" centered>
|
||||||
<Modal.Header closeButton>{props.name}</Modal.Header>
|
<Modal.Header closeButton>{name}</Modal.Header>
|
||||||
<Modal.Body>
|
<Modal.Body>
|
||||||
<Player url={props.url} subtitles={props.subtitles} />
|
<Player url={url} subtitles={subtitles} />
|
||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
</Modal>
|
</Modal>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
DownloadButton.propTypes = {
|
StreamButton.propTypes = {
|
||||||
name: PropTypes.string,
|
name: PropTypes.string.isRequired,
|
||||||
xs: PropTypes.bool,
|
|
||||||
url: PropTypes.string.isRequired,
|
url: PropTypes.string.isRequired,
|
||||||
subtitles: PropTypes.instanceOf(List),
|
subtitles: PropTypes.instanceOf(List),
|
||||||
};
|
};
|
||||||
export default DownloadButton;
|
|
||||||
|
|
||||||
const Player = (props) => {
|
|
||||||
const subtitles = props.subtitles;
|
const Player = ({ url, subtitles }) => {
|
||||||
const hasSubtitles = !(subtitles === undefined || subtitles === null || subtitles.size === 0);
|
const hasSubtitles = !(subtitles === undefined || subtitles === null || subtitles.size === 0);
|
||||||
return (
|
return (
|
||||||
<div className="embed-responsive embed-responsive-16by9">
|
<div className="embed-responsive embed-responsive-16by9">
|
||||||
<video className="embed-responsive-item" controls>
|
<video className="embed-responsive-item" controls>
|
||||||
<source src={props.url} type="video/mp4"/>
|
<source src={url} type="video/mp4"/>
|
||||||
{hasSubtitles && subtitles.toIndexedSeq().map((el, index) => (
|
{hasSubtitles && subtitles.toIndexedSeq().map((el, index) => (
|
||||||
<track
|
<track
|
||||||
key={index}
|
key={index}
|
||||||
|
29
frontend/js/components/buttons/polochon.js
Normal file
29
frontend/js/components/buttons/polochon.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import React from "react"
|
||||||
|
import PropTypes from "prop-types"
|
||||||
|
|
||||||
|
export const PolochonMetadata = (props) => {
|
||||||
|
if (!props.quality || props.quality === "") {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const badgeStyle = (props.light) ? "light" : "secondary";
|
||||||
|
const className = `mx-1 badge badge-pill badge-${badgeStyle}`;
|
||||||
|
return (
|
||||||
|
<React.Fragment>
|
||||||
|
<span className={className}>{props.quality}</span>
|
||||||
|
<span className={className}>{props.container} </span>
|
||||||
|
<span className={className}>{props.videoCodec}</span>
|
||||||
|
<span className={className}>{props.audioCodec}</span>
|
||||||
|
<span className={className}>{props.releaseGroup}</span>
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
PolochonMetadata.propTypes = {
|
||||||
|
light: PropTypes.bool,
|
||||||
|
quality: PropTypes.string,
|
||||||
|
container: PropTypes.string,
|
||||||
|
videoCodec: PropTypes.string,
|
||||||
|
audioCodec: PropTypes.string,
|
||||||
|
releaseGroup: PropTypes.string,
|
||||||
|
};
|
||||||
|
|
@ -2,6 +2,9 @@ import React from "react"
|
|||||||
import { Map, List } from "immutable"
|
import { Map, List } from "immutable"
|
||||||
import PropTypes from "prop-types"
|
import PropTypes from "prop-types"
|
||||||
|
|
||||||
|
import { PolochonMetadata } from "../buttons/polochon"
|
||||||
|
import { DownloadAndStream } from "../buttons/download"
|
||||||
|
|
||||||
const ListDetails = (props) => {
|
const ListDetails = (props) => {
|
||||||
if (props.loading) { return null }
|
if (props.loading) { return null }
|
||||||
if (props.data === undefined) { return null }
|
if (props.data === undefined) { return null }
|
||||||
@ -24,6 +27,14 @@ const ListDetails = (props) => {
|
|||||||
rating={props.data.get("rating")}
|
rating={props.data.get("rating")}
|
||||||
votes={props.data.get("votes")}
|
votes={props.data.get("votes")}
|
||||||
/>
|
/>
|
||||||
|
<div>
|
||||||
|
<DownloadAndStream
|
||||||
|
url={props.data.get("polochon_url")}
|
||||||
|
name={props.data.get("title")}
|
||||||
|
subtitles={props.data.get("subtitles")}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
<PolochonMetadata
|
<PolochonMetadata
|
||||||
quality={props.data.get("quality")}
|
quality={props.data.get("quality")}
|
||||||
releaseGroup={props.data.get("release_group")}
|
releaseGroup={props.data.get("release_group")}
|
||||||
@ -31,6 +42,7 @@ const ListDetails = (props) => {
|
|||||||
audioCodec={props.data.get("audio_codec")}
|
audioCodec={props.data.get("audio_codec")}
|
||||||
videoCodec={props.data.get("video_codec")}
|
videoCodec={props.data.get("video_codec")}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
<p className="text text-break plot">{props.data.get("plot")}</p>
|
<p className="text text-break plot">{props.data.get("plot")}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="pb-1 align-self-end">
|
<div className="pb-1 align-self-end">
|
||||||
@ -118,29 +130,6 @@ TrackingLabel.propTypes = {
|
|||||||
trackedEpisode: PropTypes.number,
|
trackedEpisode: PropTypes.number,
|
||||||
};
|
};
|
||||||
|
|
||||||
const PolochonMetadata = (props) => {
|
|
||||||
if (!props.quality || props.quality === "") {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<p className="spaced-icons">
|
|
||||||
<span className="mx-1 badge badge-pill badge-secondary">{props.quality}</span>
|
|
||||||
<span className="mx-1 badge badge-pill badge-secondary">{props.container} </span>
|
|
||||||
<span className="mx-1 badge badge-pill badge-secondary">{props.videoCodec}</span>
|
|
||||||
<span className="mx-1 badge badge-pill badge-secondary">{props.audioCodec}</span>
|
|
||||||
<span className="mx-1 badge badge-pill badge-secondary">{props.releaseGroup}</span>
|
|
||||||
</p>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
PolochonMetadata.propTypes = {
|
|
||||||
quality: PropTypes.string,
|
|
||||||
container: PropTypes.string,
|
|
||||||
videoCodec: PropTypes.string,
|
|
||||||
audioCodec: PropTypes.string,
|
|
||||||
releaseGroup: PropTypes.string,
|
|
||||||
};
|
|
||||||
|
|
||||||
const Genres = (props) => {
|
const Genres = (props) => {
|
||||||
if (props.genres === undefined) {
|
if (props.genres === undefined) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -2,7 +2,6 @@ import React from "react"
|
|||||||
import PropTypes from "prop-types"
|
import PropTypes from "prop-types"
|
||||||
import { Map } from "immutable"
|
import { Map } from "immutable"
|
||||||
|
|
||||||
import DownloadButton from "../buttons/download"
|
|
||||||
import SubtitlesButton from "../buttons/subtitles"
|
import SubtitlesButton from "../buttons/subtitles"
|
||||||
import ImdbButton from "../buttons/imdb"
|
import ImdbButton from "../buttons/imdb"
|
||||||
import TorrentsButton from "./torrents"
|
import TorrentsButton from "./torrents"
|
||||||
@ -30,12 +29,6 @@ const MovieButtons = (props) => (
|
|||||||
addTorrent={props.addTorrent}
|
addTorrent={props.addTorrent}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DownloadButton
|
|
||||||
name={props.movie.get("title")}
|
|
||||||
url={props.movie.get("polochon_url")}
|
|
||||||
subtitles={props.movie.get("subtitles")}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{props.movie.get("polochon_url") !== "" &&
|
{props.movie.get("polochon_url") !== "" &&
|
||||||
<SubtitlesButton
|
<SubtitlesButton
|
||||||
fetching={props.movie.get("fetchingSubtitles")}
|
fetching={props.movie.get("fetchingSubtitles")}
|
||||||
|
@ -7,8 +7,10 @@ import { addTorrent } from "../../actions/torrents"
|
|||||||
import { refreshSubtitles } from "../../actions/subtitles"
|
import { refreshSubtitles } from "../../actions/subtitles"
|
||||||
import { addShowToWishlist, deleteShowFromWishlist, getEpisodeDetails, fetchShowDetails } from "../../actions/shows"
|
import { addShowToWishlist, deleteShowFromWishlist, getEpisodeDetails, fetchShowDetails } from "../../actions/shows"
|
||||||
|
|
||||||
|
import { DownloadAndStream } from "../buttons/download"
|
||||||
|
import { PolochonMetadata } from "../buttons/polochon"
|
||||||
|
|
||||||
import Loader from "../loader/loader"
|
import Loader from "../loader/loader"
|
||||||
import DownloadButton from "../buttons/download"
|
|
||||||
import SubtitlesButton from "../buttons/subtitles"
|
import SubtitlesButton from "../buttons/subtitles"
|
||||||
import ImdbButton from "../buttons/imdb"
|
import ImdbButton from "../buttons/imdb"
|
||||||
import RefreshIndicator from "../buttons/refresh"
|
import RefreshIndicator from "../buttons/refresh"
|
||||||
@ -183,38 +185,26 @@ Season.propTypes = {
|
|||||||
getEpisodeDetails: PropTypes.func,
|
getEpisodeDetails: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
const PolochonMetadata = (props) => {
|
|
||||||
if (!props.quality || props.quality === "") { return null }
|
|
||||||
return (
|
|
||||||
<span className="my-2 d-flex d-wrap">
|
|
||||||
<span className="badge badge-pill badge-light mx-1">{props.quality}</span>
|
|
||||||
<span className="badge badge-pill badge-light mx-1">{props.container} </span>
|
|
||||||
<span className="badge badge-pill badge-light mx-1">{props.videoCodec}</span>
|
|
||||||
<span className="badge badge-pill badge-light mx-1">{props.audioCodec}</span>
|
|
||||||
<span className="badge badge-pill badge-light mx-1">{props.releaseGroup}</span>
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
PolochonMetadata.propTypes = {
|
|
||||||
quality: PropTypes.string,
|
|
||||||
container: PropTypes.string,
|
|
||||||
videoCodec: PropTypes.string,
|
|
||||||
audioCodec: PropTypes.string,
|
|
||||||
releaseGroup: PropTypes.string,
|
|
||||||
};
|
|
||||||
|
|
||||||
const Episode = (props) => (
|
const Episode = (props) => (
|
||||||
<div className="d-flex flex-wrap flex-md-nowrap align-items-center">
|
<div className="d-flex flex-wrap flex-md-nowrap align-items-center">
|
||||||
<TrackButton data={props.data} addToWishlist={props.addToWishlist} />
|
<TrackButton data={props.data} addToWishlist={props.addToWishlist} />
|
||||||
<span className="mx-2 text">{props.data.get("episode")}</span>
|
<span className="mx-2 text">{props.data.get("episode")}</span>
|
||||||
<span className="mx-2 text text-truncate flex-fill">{props.data.get("title")}</span>
|
<span className="mx-2 text text-truncate flex-fill">{props.data.get("title")}</span>
|
||||||
|
<span>
|
||||||
<PolochonMetadata
|
<PolochonMetadata
|
||||||
quality={props.data.get("quality")}
|
quality={props.data.get("quality")}
|
||||||
releaseGroup={props.data.get("release_group")}
|
releaseGroup={props.data.get("release_group")}
|
||||||
container={props.data.get("container")}
|
container={props.data.get("container")}
|
||||||
audioCodec={props.data.get("audio_codec")}
|
audioCodec={props.data.get("audio_codec")}
|
||||||
videoCodec={props.data.get("video_codec")}
|
videoCodec={props.data.get("video_codec")}
|
||||||
|
light
|
||||||
/>
|
/>
|
||||||
|
<DownloadAndStream
|
||||||
|
name={`${props.showName} - S${pad(props.data.get("season"))}E${pad(props.data.get("episode"))}`}
|
||||||
|
url={props.data.get("polochon_url")}
|
||||||
|
subtitles={props.data.get("subtitles")}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
<div className="align-self-end btn-toolbar">
|
<div className="align-self-end btn-toolbar">
|
||||||
{props.data.get("polochon_url") !== "" &&
|
{props.data.get("polochon_url") !== "" &&
|
||||||
<SubtitlesButton
|
<SubtitlesButton
|
||||||
@ -238,12 +228,6 @@ const Episode = (props) => (
|
|||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
<DownloadButton
|
|
||||||
name={`${props.showName} - S${pad(props.data.get("season"))}E${pad(props.data.get("episode"))}`}
|
|
||||||
url={props.data.get("polochon_url")}
|
|
||||||
subtitles={props.data.get("subtitles")}
|
|
||||||
xs
|
|
||||||
/>
|
|
||||||
<GetDetailsButtonWithRouter
|
<GetDetailsButtonWithRouter
|
||||||
showName={props.showName}
|
showName={props.showName}
|
||||||
data={props.data}
|
data={props.data}
|
||||||
|
@ -77,7 +77,7 @@ div.show.dropdown.nav-item > div {
|
|||||||
|
|
||||||
.video-details {
|
.video-details {
|
||||||
font-size: $font-size-sm;
|
font-size: $font-size-sm;
|
||||||
p {
|
div, p {
|
||||||
margin-bottom: .3rem;
|
margin-bottom: .3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ div.show.dropdown.nav-item > div {
|
|||||||
@include media-breakpoint-up(sm) {
|
@include media-breakpoint-up(sm) {
|
||||||
.video-details {
|
.video-details {
|
||||||
font-size: $font-size-base;
|
font-size: $font-size-base;
|
||||||
p {
|
div, p {
|
||||||
margin-bottom: $paragraph-margin-bottom;
|
margin-bottom: $paragraph-margin-bottom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user