From 1e035105d1462fba19570ec197a1c0b204822edf Mon Sep 17 00:00:00 2001 From: Preston Date: Mon, 31 Aug 2020 17:35:22 -0400 Subject: [PATCH] Finish Profile Logic and working subscriptions --- src/renderer/App.js | 7 +- src/renderer/App.vue | 3 + .../ft-profile-selector.css | 65 ++++++++ .../ft-profile-selector.js | 79 ++++++++++ .../ft-profile-selector.vue | 57 +++++++ .../ft-progress-bar/ft-progress-bar.css | 9 ++ .../ft-progress-bar/ft-progress-bar.js | 10 ++ .../ft-progress-bar/ft-progress-bar.vue | 9 ++ src/renderer/components/side-nav/side-nav.css | 44 +++++- src/renderer/components/side-nav/side-nav.js | 24 +++ src/renderer/components/side-nav/side-nav.vue | 28 +++- src/renderer/components/top-nav/top-nav.js | 4 +- src/renderer/components/top-nav/top-nav.sass | 3 + src/renderer/components/top-nav/top-nav.vue | 2 +- .../watch-video-info/watch-video-info.js | 100 +++++++++++- src/renderer/store/modules/profile.js | 43 ++++- src/renderer/store/modules/subscriptions.js | 71 +++------ src/renderer/store/modules/utils.js | 49 ++++++ src/renderer/views/Channel/Channel.js | 100 +++++++++++- src/renderer/views/Channel/Channel.vue | 2 +- src/renderer/views/Playlist/Playlist.js | 3 - .../views/ProfileEdit/ProfileEdit.css | 6 + src/renderer/views/ProfileEdit/ProfileEdit.js | 99 +++++++++++- .../views/ProfileEdit/ProfileEdit.vue | 21 ++- .../views/ProfileSettings/ProfileSettings.css | 6 + .../views/ProfileSettings/ProfileSettings.js | 11 +- .../views/ProfileSettings/ProfileSettings.vue | 10 +- .../views/Subscriptions/Subscriptions.js | 149 ++++++++++++++++++ .../views/Subscriptions/Subscriptions.vue | 29 +++- static/locales/en-US.yaml | 2 + 30 files changed, 957 insertions(+), 88 deletions(-) create mode 100644 src/renderer/components/ft-profile-selector/ft-profile-selector.css create mode 100644 src/renderer/components/ft-profile-selector/ft-profile-selector.js create mode 100644 src/renderer/components/ft-profile-selector/ft-profile-selector.vue create mode 100644 src/renderer/components/ft-progress-bar/ft-progress-bar.css create mode 100644 src/renderer/components/ft-progress-bar/ft-progress-bar.js create mode 100644 src/renderer/components/ft-progress-bar/ft-progress-bar.vue diff --git a/src/renderer/App.js b/src/renderer/App.js index 0e4e2922..efe9cc85 100644 --- a/src/renderer/App.js +++ b/src/renderer/App.js @@ -3,6 +3,7 @@ import { ObserveVisibility } from 'vue-observe-visibility' import TopNav from './components/top-nav/top-nav.vue' import SideNav from './components/side-nav/side-nav.vue' import FtToast from './components/ft-toast/ft-toast.vue' +import FtProgressBar from './components/ft-progress-bar/ft-progress-bar.vue' import $ from 'jquery' let useElectron @@ -23,11 +24,15 @@ export default Vue.extend({ components: { TopNav, SideNav, - FtToast + FtToast, + FtProgressBar }, computed: { isOpen: function () { return this.$store.getters.getIsSideNavOpen + }, + showProgressBar: function () { + return this.$store.getters.getShowProgressBar } }, mounted: function () { diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 2bb16c04..67ab34f4 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -15,6 +15,9 @@ + diff --git a/src/renderer/components/ft-profile-selector/ft-profile-selector.css b/src/renderer/components/ft-profile-selector/ft-profile-selector.css new file mode 100644 index 00000000..f630dc0c --- /dev/null +++ b/src/renderer/components/ft-profile-selector/ft-profile-selector.css @@ -0,0 +1,65 @@ +.colorOption { + width: 50px; + height: 50px; + margin: 10px; + cursor: pointer; + border-radius: 200px 200px 200px 200px; + -webkit-border-radius: 200px 200px 200px 200px; +} + +.initial { + font-size: 25px; + text-align: center; + position: relative; + bottom: 27px; +} + +#profileList { + display: none; + position: absolute; + top: 60px; + right: 10px; + min-width: 250px; + height: 300px; + padding: 5px; + background-color: var(--card-bg-color); + box-shadow: 0 1px 2px rgba(0,0,0,.1); +} + +#profileList:focus { + display: inline; + outline: none; +} + +.profileWrapper { + margin-top: 60px; + height: 240px; + overflow-y: auto; +} + +.profile { + cursor: pointer; +} + +.profile:hover { + background-color: var(--side-nav-hover-color); +} + +.profile .colorOption { + float: left; + position: relative; + bottom: 5px; +} + +.profileListTitle { + position: absolute; + top: -15px; + left: 10px; +} + +.profileSettings { + float: right; + position: absolute; + top: 10px; + right: 5px; +} diff --git a/src/renderer/components/ft-profile-selector/ft-profile-selector.js b/src/renderer/components/ft-profile-selector/ft-profile-selector.js new file mode 100644 index 00000000..f63d5aa0 --- /dev/null +++ b/src/renderer/components/ft-profile-selector/ft-profile-selector.js @@ -0,0 +1,79 @@ +import Vue from 'vue' +import { mapActions } from 'vuex' +import $ from 'jquery' + +import FtCard from '../../components/ft-card/ft-card.vue' +import FtIconButton from '../../components/ft-icon-button/ft-icon-button.vue' + +export default Vue.extend({ + name: 'FtProfileSelector', + components: { + 'ft-card': FtCard, + 'ft-icon-button': FtIconButton + }, + data: function () { + return { + showProfileList: false + } + }, + computed: { + profileList: function () { + return this.$store.getters.getProfileList + }, + activeProfile: function () { + return this.$store.getters.getActiveProfile + }, + defaultProfile: function () { + return this.$store.getters.getDefaultProfile + }, + activeProfileInitial: function () { + return this.activeProfile.name.slice(0, 1).toUpperCase() + }, + profileInitials: function () { + return this.profileList.map((profile) => { + return profile.name.slice(0, 1).toUpperCase() + }) + } + }, + mounted: function () { + $('#profileList').focusout(() => { + $('#profileList')[0].style.display = 'none' + }) + }, + methods: { + toggleProfileList: function () { + $('#profileList')[0].style.display = 'inline' + $('#profileList').focus() + }, + + openProfileSettings: function () { + this.$router.push({ + path: '/settings/profile/' + }) + $('#profileList').focusout() + }, + + setActiveProfile: function (profile) { + if (this.profileList[this.activeProfile]._id === profile._id) { + return + } + const index = this.profileList.findIndex((x) => { + return x._id === profile._id + }) + + if (index === -1) { + return + } + this.updateActiveProfile(index) + this.showToast({ + message: `${profile.name} is now the active profile` + }) + $('#profileList').focusout() + }, + + ...mapActions([ + 'showToast', + 'updateActiveProfile' + ]) + } +}) diff --git a/src/renderer/components/ft-profile-selector/ft-profile-selector.vue b/src/renderer/components/ft-profile-selector/ft-profile-selector.vue new file mode 100644 index 00000000..e8c864d3 --- /dev/null +++ b/src/renderer/components/ft-profile-selector/ft-profile-selector.vue @@ -0,0 +1,57 @@ + + +