From 84ccc6e1ebb904704aa0a6ac29cfbb8d92e51876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Delattre?= Date: Tue, 25 Jun 2019 13:07:13 +0200 Subject: [PATCH] Remove the download button to add clickable badges BTW, let's create a polochon metadata component --- frontend/js/components/buttons/download.js | 67 +++++++++++++--------- frontend/js/components/buttons/polochon.js | 29 ++++++++++ frontend/js/components/list/details.js | 49 ++++++---------- frontend/js/components/movies/buttons.js | 7 --- frontend/js/components/shows/details.js | 52 ++++++----------- frontend/scss/app.scss | 4 +- 6 files changed, 108 insertions(+), 100 deletions(-) create mode 100644 frontend/js/components/buttons/polochon.js diff --git a/frontend/js/components/buttons/download.js b/frontend/js/components/buttons/download.js index ba4e40e..1b044b7 100644 --- a/frontend/js/components/buttons/download.js +++ b/frontend/js/components/buttons/download.js @@ -3,55 +3,68 @@ import PropTypes from "prop-types" import { List } from "immutable" import Modal from "react-bootstrap/Modal" -import Dropdown from "react-bootstrap/Dropdown" -import SplitButton from "react-bootstrap/SplitButton" -const DownloadButton = (props) => { - if (props.url === "") { return null; } - const size = props.xs ? "sm" : ""; +export const DownloadAndStream = ({ url, name, subtitles }) => { + if (!url || url === "") { return null; } + return ( + + + + + ); +} +DownloadAndStream.propTypes = { + url: PropTypes.string, + name: PropTypes.string, + subtitles: PropTypes.instanceOf(List), +}; + +const DownloadButton = ({ url }) => ( +
+ + Download + +
+); +DownloadButton.propTypes = { url: PropTypes.string.isRequired }; + +const StreamButton = ({ name, url, subtitles }) => { const [showModal, setShowModal] = useState(false); return ( - - setShowModal(true)}> - - Stream in browser - - - +
+ { e.preventDefault(); setShowModal(true) }}> + Play + +
setShowModal(false)} size="lg" centered> - {props.name} + {name} - +
); } -DownloadButton.propTypes = { - name: PropTypes.string, - xs: PropTypes.bool, +StreamButton.propTypes = { + name: PropTypes.string.isRequired, url: PropTypes.string.isRequired, 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); return (
@@ -118,29 +130,6 @@ TrackingLabel.propTypes = { trackedEpisode: PropTypes.number, }; -const PolochonMetadata = (props) => { - if (!props.quality || props.quality === "") { - return null; - } - - return ( -

- {props.quality} - {props.container} - {props.videoCodec} - {props.audioCodec} - {props.releaseGroup} -

- ); -} -PolochonMetadata.propTypes = { - quality: PropTypes.string, - container: PropTypes.string, - videoCodec: PropTypes.string, - audioCodec: PropTypes.string, - releaseGroup: PropTypes.string, -}; - const Genres = (props) => { if (props.genres === undefined) { return null; diff --git a/frontend/js/components/movies/buttons.js b/frontend/js/components/movies/buttons.js index 621bb58..b910fad 100644 --- a/frontend/js/components/movies/buttons.js +++ b/frontend/js/components/movies/buttons.js @@ -2,7 +2,6 @@ import React from "react" import PropTypes from "prop-types" import { Map } from "immutable" -import DownloadButton from "../buttons/download" import SubtitlesButton from "../buttons/subtitles" import ImdbButton from "../buttons/imdb" import TorrentsButton from "./torrents" @@ -30,12 +29,6 @@ const MovieButtons = (props) => ( addTorrent={props.addTorrent} /> - - {props.movie.get("polochon_url") !== "" && { - if (!props.quality || props.quality === "") { return null } - return ( - - {props.quality} - {props.container} - {props.videoCodec} - {props.audioCodec} - {props.releaseGroup} - - ); -} -PolochonMetadata.propTypes = { - quality: PropTypes.string, - container: PropTypes.string, - videoCodec: PropTypes.string, - audioCodec: PropTypes.string, - releaseGroup: PropTypes.string, -}; - const Episode = (props) => (
{props.data.get("episode")} {props.data.get("title")} - + + + +
{props.data.get("polochon_url") !== "" && ( /> ) })} - div { .video-details { font-size: $font-size-sm; - p { + div, p { margin-bottom: .3rem; } @@ -85,7 +85,7 @@ div.show.dropdown.nav-item > div { @include media-breakpoint-up(sm) { .video-details { font-size: $font-size-base; - p { + div, p { margin-bottom: $paragraph-margin-bottom; } }