Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/submit issue with movie/show #37

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
127 changes: 110 additions & 17 deletions src/components/Movie.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,28 @@

<!-- SIDEBAR ACTIONS -->
<div class="movie__actions" v-if="movie">

<sidebar-list-element :iconRef="'#iconNot_exsits'" :active="matched"
:iconRefActive="'#iconExists'" :textActive="'Already in plex 🎉'">

<sidebar-list-element :iconRef="'#iconNot_exsits'" :active="requested"
:iconRefActive="'#iconExists'" :textActive="'Already in plex 🎉'" :class="requested ? 'rotate-180' : null">
Not yet in plex
</sidebar-list-element>

<sidebar-list-element @click="sendRequest" :iconRef="'#iconSent'"
:active="requested" :textActive="'Requested to be downloaded'">

Request to be downloaded?
</sidebar-list-element>

<sidebar-list-element v-if="admin" @click="showTorrents=!showTorrents"
:iconRef="'#icon_torrents'" :active="showTorrents"
:supplementaryText="numberOfTorrentResults">

Search for torrents
</sidebar-list-element>

<sidebar-list-element @click="showIssueForm = !showIssueForm"
:iconRef="null"
:active="showIssueForm">
&nbsp;⚠️ &nbsp;Report an issue!
</sidebar-list-element>

<sidebar-list-element @click="openTmdb" :iconRef="'#icon_info'">
See more info
</sidebar-list-element>
Expand All @@ -64,14 +69,16 @@

<!-- MOVIE INFO -->
<div class="movie__info">
<div class="movie__description" v-if="movie"> {{ movie.overview }}</div>

<!-- Loading placeholder -->
<div v-else class="movie__description">
<div v-if="!movie" class="movie__description">
<loading-placeholder :count="12" />
</div>

<div class="movie__details" v-if="movie">
<div class="movie__details" v-if="movie && !showIssueForm">
<div class="movie__description">
{{ movie.overview }}
</div>
<div v-if="movie.year" class="movie__details-block">
<h2 class="movie__details-title">Release Date</h2>
<div class="movie__details-text">{{ movie.year }}</div>
Expand All @@ -93,6 +100,17 @@
</div>
</div>



<div v-if="showIssueForm" class="issueForm">
<h2 class="movie__details-title">Report an issue</h2>
<RadioButtons class="issueOptions"
:options="issueOptions"
:value.sync="selectedIssue" />
<TextArea title="Additional information" :rows="3"
placeholder="Placeholder text" />
<SeasonedButton @click="reportIssue">Report issue</SeasonedButton>
</div>
</div>

<!-- TODO: change this classname, this is general -->
Expand Down Expand Up @@ -122,12 +140,23 @@ import Person from './Person'
import SidebarListElement from './ui/sidebarListElem'
import store from '@/store'
import LoadingPlaceholder from './ui/LoadingPlaceholder'
import RadioButtons from './ui/RadioButtons'
import TextArea from './ui/TextArea'
import SeasonedButton from './ui/SeasonedButton'

import { getMovie, getShow, request, getRequestStatus } from '@/api'

export default {
props: ['id', 'type'],
components: { TorrentList, Person, LoadingPlaceholder, SidebarListElement },
components: {
TorrentList,
Person,
LoadingPlaceholder,
SidebarListElement,
RadioButtons,
TextArea,
SeasonedButton
},
directives: { img: img }, // TODO decide to remove or use
data(){
return{
Expand All @@ -142,7 +171,9 @@ export default {
requested: false,
admin: localStorage.getItem('admin'),
showTorrents: false,
compact: false
compact: false,
showIssueForm: false,
selectedIssue: null
}
},
methods: {
Expand Down Expand Up @@ -177,6 +208,15 @@ export default {
const tmdbType = this.type === 'show' ? 'tv' : this.type
window.location.href = 'https://www.themoviedb.org/' + tmdbType + '/' + this.id
},
reportIssue() {
if (this.showIssueForm) {
this.$notifications.success({
title: 'Issue successfully submitted',
description: 'Reported issue: Missing subtitles',
timeout: 300000
})
}
}
},
watch: {
id: function(val){
Expand All @@ -191,6 +231,35 @@ export default {
numberOfTorrentResults: () => {
let numTorrents = store.getters['torrentModule/resultCount']
return numTorrents !== null ? numTorrents + ' results' : null
},
issueOptions: function() {
return [{
value: 'playback',
text: 'Unable to play'
}, {
value: 'missing-episode',
text: 'Missing Episode',
subElements: this.seasonOptions
}, {
value: 'missing-subtitle',
text: 'Missing subtitles'
}]
},
seasonOptions: function() {
if (this.movie.type !== 'show') {
return []
}

const options = []
const length = this.movie.seasons;

for (var i = 0; i < length; i++) {
options.push({
value: i+1,
text: `Season ${i+1}`
})
}
return options;
}
},
beforeDestroy() {
Expand Down Expand Up @@ -224,6 +293,9 @@ export default {
@import "./src/scss/media-queries";

.movie {
background-color: $background-color;
color: $text-color;

&__wrap {
display: flex;
&--header {
Expand All @@ -237,9 +309,6 @@ export default {
@include tablet-min{
flex-direction: row;
}

background-color: $background-color;
color: $text-color;
}
}
&__header {
Expand Down Expand Up @@ -360,15 +429,19 @@ export default {
font-size: 13px;
line-height: 1.8;
margin-bottom: 20px;
flex: 0 0 100%;

@include tablet-min {
margin-bottom: 30px;
font-size: 14px;
}
}
&__details {
&-block {
float: left;
}
display: flex;
width: 100%;
flex-direction: row;
flex-wrap: wrap;

&-block:not(:last-child) {
margin-bottom: 20px;
margin-right: 20px;
Expand Down Expand Up @@ -417,4 +490,24 @@ export default {
}
}
}

.issueForm {
// padding: 40px;

.issueOptions {
margin-top: 1rem;
}

.seasonOptions {
margin-top: 2rem;

h2 {
margin-bottom: 1rem;
}

> :not(h2) {
margin-left: 1rem;
}
}
}
</style>
133 changes: 133 additions & 0 deletions src/components/ui/RadioButtons.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<template>
<div>
<label v-for="option in options" class="radio" @click="selected = option.value">
<input type="radio" v-model="selected" :value="option.value" />
<label>{{ option.text }}</label>


<div class="sub-radios" v-if="option.subElements && selected === option.value">
<label class="radio" v-for="elem in option.subElements">
<input type="radio" v-model="selectedSubItem" :value="option.value + '-' + elem.value" />
<label>{{ elem.text }}</label>
</label>
</div>
</label>
</div>
</template>

<script>
export default {
props: {
options: {
type: Array,
required: true
},
value: {
required: false,
default: undefined
}
},
data() {
return {
selected: this.value || this.options[0].value,
selectedSubItem: null
};
},
beforeMount() {
this.handleChange()
},
watch: {
selected() {
this.handleChange();
}
},
methods: {
handleChange() {
if (this.value !== undefined) {
this.$emit("update:value", this.selected);
} else {
this.$emit("changed", this.selected);
}
}
}
};
</script>

<style lang="scss" scoped>
@import "./src/scss/variables.scss";

$radioSize: 16px;
$ui-border-width: 2px;

.sub-radios {
display: flex;
flex-direction: column;
flex: 0 0 100%;
margin-left: 1rem;

&:first-of-type {
margin-top: 1rem;
}
}

.radio {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-bottom: 14px;
width: max-content;

input[type="radio"] {
display: block;
opacity: 0;

+ label {
position: relative;
display: inline-block;
cursor: pointer;
padding-left: 1.25rem;
font-weight: 300;

&::before {
content: "";
display: inline-block;
position: absolute;
left: -($radioSize / 4) * 4;
border-radius: 50%;
border: $ui-border-width solid $text-color-70;
width: $radioSize;
height: $radioSize;
}

&::after {
content: "";
position: absolute;
display: inline-block;
left: -($radioSize / 4) * 3;
top: $radioSize / 4;
border-radius: 50%;
width: ($radioSize / 4) * 3;
height: ($radioSize / 4) * 3;
}
}

&:checked,
&:hover {
+ label::after {
background-color: $green;
}
+ label::before {
border-color: $text-color;
}
}

&:focus {
+ label::before {
outline: $ui-border-width solid Highlight;
outline-style: auto;
outline-color: -webkit-focus-ring-color;
}
}
}
}
</style>
2 changes: 1 addition & 1 deletion src/components/ui/SeasonedButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
font-size: 11px;
line-height: 2;
height: 45px;
letter-spacing: 0.5px;
letter-spacing: 1.2px;
padding: 5px 20px 4px 20px;
margin: 0;
margin-right: 0.3rem;
Expand Down
Loading