diff --git a/src/renderer/App.js b/src/renderer/App.js index 0e4e29228..efe9cc856 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 2bb16c042..67ab34f45 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 000000000..f630dc0cc --- /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 000000000..f63d5aa07 --- /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 000000000..e8c864d39 --- /dev/null +++ b/src/renderer/components/ft-profile-selector/ft-profile-selector.vue @@ -0,0 +1,57 @@ + + +