Add Basic Menu options to video list object

This commit is contained in:
Preston 2020-06-10 20:21:31 -04:00
parent 864d792ffc
commit 879f00321d
7 changed files with 118 additions and 8 deletions

View File

@ -18,7 +18,7 @@ Enough of the rewrite has been done to hopefully provide code examples of what w
## What Needs to be Done? ## What Needs to be Done?
Like I mentioned above, there are a lot of things that need to be done. I have created some issues over at the [issues](#) page to give a quick rundown on what needs to be done as well as what the requirements are in order for those issues to be considered complete. I will make more issues with more requirements as progress is made. Like I mentioned above, there are a lot of things that need to be done. I have created some issues over at the [issues](https://github.com/FreeTubeApp/FreeTube-Vue/issues) page to give a quick rundown on what needs to be done as well as what the requirements are in order for those issues to be considered complete. I will make more issues with more requirements as progress is made.
At this time, here is the list of things to do/need to do: At this time, here is the list of things to do/need to do:
@ -26,7 +26,7 @@ At this time, here is the list of things to do/need to do:
- [x] Basic App Structure and Layout - [x] Basic App Structure and Layout
- [x] Video Layout (Along with Channel and Playlist Layout) - [x] Video Layout (Along with Channel and Playlist Layout)
- [x] Search / Search View (Along with Filters) - [x] Search / Search View (Along with Filters)
- [ ] Search Suggestions - [x] Search Suggestions
- [x] Channel View - [x] Channel View
- [x] Channel Search - [x] Channel Search
- [x] Trending Page - [x] Trending Page
@ -42,7 +42,7 @@ At this time, here is the list of things to do/need to do:
- [ ] History Page and Logic - [ ] History Page and Logic
- [ ] Profile Page and Logic - [ ] Profile Page and Logic
- [ ] Misc. Adjustments and Settings - [ ] Misc. Adjustments and Settings
- [ ] Packagaing and Testing - [ ] Packaging and Testing
This list is somewhat in order of when I plan on working on each thing. Obviously things can change and anyone is welcome to work on whatever they like. This list is somewhat in order of when I plan on working on each thing. Obviously things can change and anyone is welcome to work on whatever they like.

View File

@ -11,13 +11,16 @@
padding: 10px; padding: 10px;
font-size: 20px; font-size: 20px;
border-radius: 50%; border-radius: 50%;
box-shadow: 0 1px 2px rgba(0,0,0,.5);
cursor: pointer; cursor: pointer;
-moz-transition: background 0.2s ease-out; -moz-transition: background 0.2s ease-out;
-o-transition: background 0.2s ease-out; -o-transition: background 0.2s ease-out;
transition: background 0.2s ease-out; transition: background 0.2s ease-out;
} }
.shadow {
box-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.iconButton:hover { .iconButton:hover {
-moz-transition: background 0.2s ease-in; -moz-transition: background 0.2s ease-in;
-o-transition: background 0.2s ease-in; -o-transition: background 0.2s ease-in;
@ -105,9 +108,9 @@
} }
.left { .left {
right: 100%; right: 50%;
} }
.right { .right {
left: 100%; left: 50%;
} }

View File

@ -15,6 +15,10 @@ export default Vue.extend({
type: String, type: String,
default: 'base' default: 'base'
}, },
useShadow: {
type: Boolean,
default: true
},
dropdownPosition: { dropdownPosition: {
type: String, type: String,
default: 'center' default: 'center'

View File

@ -7,7 +7,8 @@
:class="{ :class="{
base: theme === 'base', base: theme === 'base',
primary: theme === 'primary', primary: theme === 'primary',
secondary: theme === 'secondary' secondary: theme === 'secondary',
shadow: useShadow
}" }"
@click="handleIconClick" @click="handleIconClick"
/> />

View File

@ -83,6 +83,15 @@
cursor: pointer; cursor: pointer;
} }
/deep/ .iconButton {
font-size: 15px;
padding: 8px;
}
/deep/ .iconDropdown {
margin-top: 30px;
}
.grid { .grid {
width: 240px; width: 240px;
height: 250px; height: 250px;
@ -105,8 +114,15 @@
height: 110px; height: 110px;
} }
.grid .optionsButton {
margin-top: 10px;
margin-left: 210px;
position: absolute;
}
.grid .videoTitle { .grid .videoTitle {
max-height: 55px; max-height: 55px;
width: 210px;
overflow-y: hidden; overflow-y: hidden;
margin-bottom: -15px; margin-bottom: -15px;
} }
@ -144,6 +160,10 @@
height: 130px; height: 130px;
} }
.list .optionsButton {
float: right;
}
.list .videoTitle { .list .videoTitle {
margin-left: 250px; margin-left: 250px;
margin-top: 5px; margin-top: 5px;

View File

@ -1,7 +1,11 @@
import Vue from 'vue' import Vue from 'vue'
import FtIconButton from '../ft-icon-button/ft-icon-button.vue'
export default Vue.extend({ export default Vue.extend({
name: 'FtListVideo', name: 'FtListVideo',
components: {
'ft-icon-button': FtIconButton
},
props: { props: {
data: { data: {
type: Object, type: Object,
@ -30,10 +34,30 @@ export default Vue.extend({
progressPercentage: 0, progressPercentage: 0,
isLive: false, isLive: false,
isFavorited: false, isFavorited: false,
hideViews: false hideViews: false,
optionsNames: [
'Open in YouTube',
'Copy YouTube Link',
'Open YouTube Embedded Player',
'Copy YouTube Embedded Player Link',
'Open in Invidious',
'Copy Invidious Link'
],
optionsValues: [
'openYoutube',
'copyYoutube',
'openYoutubeEmbed',
'copyYoutubeEmbed',
'openInvidious',
'copyInvidious'
]
} }
}, },
computed: { computed: {
usingElectron: function () {
return this.$store.getters.getUsingElectron
},
listType: function () { listType: function () {
return this.$store.getters.getListType return this.$store.getters.getListType
}, },
@ -50,6 +74,18 @@ export default Vue.extend({
return this.$store.getters.getInvidiousInstance return this.$store.getters.getInvidiousInstance
}, },
invidiousUrl: function () {
return `${this.invidiousInstance}/watch?v=${this.id}`
},
youtubeUrl: function () {
return `https://www.youtube.com/watch?v=${this.id}`
},
youtubeEmbedUrl: function () {
return `https://www.youtube-nocookie.com/embed/${this.id}`
},
thumbnail: function () { thumbnail: function () {
let baseUrl let baseUrl
if (this.backendPreference === 'invidious') { if (this.backendPreference === 'invidious') {
@ -113,6 +149,42 @@ export default Vue.extend({
console.log('TODO: ft-list-video method toggleSave') console.log('TODO: ft-list-video method toggleSave')
}, },
handleOptionsClick: function (option) {
console.log('Handling share')
console.log(option)
switch (option) {
case 'copyYoutube':
navigator.clipboard.writeText(this.youtubeUrl)
break
case 'openYoutube':
if (this.usingElectron) {
const shell = require('electron').shell
shell.openExternal(this.youtubeUrl)
}
break
case 'copyYoutubeEmbed':
navigator.clipboard.writeText(this.youtubeEmbedUrl)
break
case 'openYoutubeEmbed':
if (this.usingElectron) {
const shell = require('electron').shell
shell.openExternal(this.youtubeEmbedUrl)
}
break
case 'copyInvidious':
navigator.clipboard.writeText(this.invidiousUrl)
break
case 'openInvidious':
if (this.usingElectron) {
console.log('using electron')
const shell = require('electron').shell
shell.openExternal(this.invidiousUrl)
}
break
}
},
// For Invidious data, as duration is sent in seconds // For Invidious data, as duration is sent in seconds
calculateVideoDuration: function (lengthSeconds) { calculateVideoDuration: function (lengthSeconds) {
let durationText = '' let durationText = ''

View File

@ -37,6 +37,16 @@
:style="{width: progressPercentage + '%'}" :style="{width: progressPercentage + '%'}"
/> />
</div> </div>
<ft-icon-button
class="optionsButton"
title="More Options"
theme="base"
:use-shadow="false"
dropdown-position="left"
:dropdown-names="optionsNames"
:dropdown-values="optionsValues"
@click="handleOptionsClick"
/>
<p <p
class="videoTitle" class="videoTitle"
@click="play(id)" @click="play(id)"