diff --git a/src/renderer/components/download-settings/download-settings.js b/src/renderer/components/download-settings/download-settings.js new file mode 100644 index 00000000..96c67535 --- /dev/null +++ b/src/renderer/components/download-settings/download-settings.js @@ -0,0 +1,49 @@ +import Vue from 'vue' +import FtFlexBox from '../ft-flex-box/ft-flex-box.vue' +import FtToggleSwitch from '../ft-toggle-switch/ft-toggle-switch.vue' +import FtButton from '../ft-button/ft-button.vue' +import FtInput from '../ft-input/ft-input.vue' +import { mapActions } from 'vuex' +import { ipcRenderer } from 'electron' +import { IpcChannels } from '../../../constants' + +export default Vue.extend({ + name: 'DownloadSettings', + components: { + 'ft-toggle-switch': FtToggleSwitch, + 'ft-flex-box': FtFlexBox, + 'ft-button': FtButton, + 'ft-input': FtInput + }, + data: function () { + return { + askForDownloadPath: this.$store.getters.getDownloadFolderPath === '' + } + }, + computed: { + downloadPath: function() { + return this.$store.getters.getDownloadFolderPath + } + }, + methods: { + handleDownloadingSettingChange: function (value) { + this.askForDownloadPath = value + if (value === true) { + this.updateDownloadFolderPath('') + } + }, + chooseDownloadingFolder: async function() { + // only use with electron + const folder = await ipcRenderer.invoke( + IpcChannels.SHOW_OPEN_DIALOG, + { properties: ['openDirectory'] } + ) + + this.updateDownloadFolderPath(folder.filePaths[0]) + }, + ...mapActions([ + 'updateDownloadFolderPath' + ]) + } + +}) diff --git a/src/renderer/components/download-settings/download-settings.sass b/src/renderer/components/download-settings/download-settings.sass new file mode 100644 index 00000000..330bf087 --- /dev/null +++ b/src/renderer/components/download-settings/download-settings.sass @@ -0,0 +1,8 @@ +@use "../../sass-partials/settings" + +@media only screen and (max-width: 500px) + .downloadSettingsFlexBox + justify-content: flex-start + +.folderDisplay + width: 50vh diff --git a/src/renderer/components/download-settings/download-settings.vue b/src/renderer/components/download-settings/download-settings.vue new file mode 100644 index 00000000..c55e314e --- /dev/null +++ b/src/renderer/components/download-settings/download-settings.vue @@ -0,0 +1,37 @@ + + +