change "download" button to "save" on desktop

This commit is contained in:
undergroundwires
2020-09-14 02:03:02 +01:00
parent 50fb29038a
commit 07fc555324
2 changed files with 11 additions and 6 deletions

View File

@@ -6,7 +6,7 @@ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
/** REGULAR ICONS (PREFIX: far) */ /** REGULAR ICONS (PREFIX: far) */
import { faFolderOpen, faFolder, faSmile } from '@fortawesome/free-regular-svg-icons'; import { faFolderOpen, faFolder, faSmile } from '@fortawesome/free-regular-svg-icons';
/** SOLID ICONS (PREFIX: fas (default)) */ /** SOLID ICONS (PREFIX: fas (default)) */
import { faTimes, faFileDownload, faCopy, faSearch, faInfoCircle, faUserSecret, faDesktop, faTag, faGlobe } from '@fortawesome/free-solid-svg-icons'; import { faTimes, faFileDownload, faCopy, faSearch, faInfoCircle, faUserSecret, faDesktop, faTag, faGlobe, faSave } from '@fortawesome/free-solid-svg-icons';
export class IconBootstrapper implements IVueBootstrapper { export class IconBootstrapper implements IVueBootstrapper {
@@ -21,7 +21,7 @@ export class IconBootstrapper implements IVueBootstrapper {
faFolderOpen, faFolderOpen,
faFolder, faFolder,
faTimes, faTimes,
faFileDownload, faFileDownload, faSave,
faCopy, faCopy,
faSearch, faSearch,
faInfoCircle); faInfoCircle);

View File

@@ -1,9 +1,11 @@
<template> <template>
<div class="container" v-if="hasCode"> <div class="container" v-if="hasCode">
</IconButton>
<IconButton <IconButton
text="Download" :text="this.isDesktop ? 'Save' : 'Download'"
v-on:click="saveCodeAsync" v-on:click="saveCodeAsync"
icon-prefix="fas" icon-name="file-download"> icon-prefix="fas"
:icon-name="this.isDesktop ? 'save' : 'file-download'">
</IconButton> </IconButton>
<IconButton <IconButton
text="Copy" text="Copy"
@@ -16,9 +18,10 @@
<script lang="ts"> <script lang="ts">
import { Component } from 'vue-property-decorator'; import { Component } from 'vue-property-decorator';
import { StatefulVue } from './StatefulVue'; import { StatefulVue } from './StatefulVue';
import { SaveFileDialog, FileType } from './../infrastructure/SaveFileDialog'; import { SaveFileDialog, FileType } from '@/infrastructure/SaveFileDialog';
import { Clipboard } from './../infrastructure/Clipboard'; import { Clipboard } from '@/infrastructure/Clipboard';
import IconButton from './IconButton.vue'; import IconButton from './IconButton.vue';
import { Environment } from '@/application/Environment/Environment';
@Component({ @Component({
components: { components: {
@@ -27,9 +30,11 @@ import IconButton from './IconButton.vue';
}) })
export default class TheCodeButtons extends StatefulVue { export default class TheCodeButtons extends StatefulVue {
public hasCode = false; public hasCode = false;
public isDesktop = false;
public async mounted() { public async mounted() {
const state = await this.getCurrentStateAsync(); const state = await this.getCurrentStateAsync();
this.isDesktop = Environment.CurrentEnvironment.isDesktop;
this.hasCode = state.code.current && state.code.current.length > 0; this.hasCode = state.code.current && state.code.current.length > 0;
state.code.changed.on((code) => { state.code.changed.on((code) => {
this.hasCode = code && code.code.length > 0; this.hasCode = code && code.code.length > 0;