This commit is contained in:
Henry Jameson 2020-01-27 04:24:00 +02:00
parent 7c074b8741
commit 5313833d80
2 changed files with 71 additions and 69 deletions

View file

@ -1,74 +1,77 @@
<template> <template>
<div class="style-switcher"> <div class="style-switcher">
<div class="presets-container"> <div class="presets-container">
<div class="save-load"> <div class="save-load">
<div class="theme-warning" v-if="themeWarning"> <div
<div class="alert warning"> v-if="themeWarning"
{{ themeWarningHelp }} class="theme-warning"
</div> >
<div class="buttons"> <div class="alert warning">
<template v-if="themeWarning.type === 'snapshot_source_mismatch'"> {{ themeWarningHelp }}
<button </div>
class="btn" <div class="buttons">
@click="forceLoad" <template v-if="themeWarning.type === 'snapshot_source_mismatch'">
> <button
{{ $t('settings.style.switcher.use_source') }} class="btn"
</button> @click="forceLoad"
<button
class="btn"
@click="forceSnapshot"
>
{{ $t('settings.style.switcher.use_snapshot') }}
</button>
</template>
<template v-else-if="themeWarning.noActionsPossible">
<button
class="btn"
@click="dismissWarning"
>
{{ $t('general.dismiss') }}
</button>
</template>
<template v-else>
<button
class="btn"
@click="forceLoad"
>
{{ $t('settings.style.switcher.load_theme') }}
</button>
<button
class="btn"
@click="dismissWarning"
>
{{ $t('settings.style.switcher.keep_as_is') }}
</button>
</template>
</div>
</div>
<ExportImport
:export-object="exportedTheme"
:export-label="$t(&quot;settings.export_theme&quot;)"
:import-label="$t(&quot;settings.import_theme&quot;)"
:import-failed-text="$t(&quot;settings.invalid_theme_imported&quot;)"
:on-import="onImport"
:validator="importValidator"
>
<template slot="before">
<div class="presets">
{{ $t('settings.presets') }}
<label
for="preset-switcher"
class="select"
> >
<select {{ $t('settings.style.switcher.use_source') }}
id="preset-switcher" </button>
v-model="selected" <button
class="preset-switcher" class="btn"
@click="forceSnapshot"
>
{{ $t('settings.style.switcher.use_snapshot') }}
</button>
</template>
<template v-else-if="themeWarning.noActionsPossible">
<button
class="btn"
@click="dismissWarning"
>
{{ $t('general.dismiss') }}
</button>
</template>
<template v-else>
<button
class="btn"
@click="forceLoad"
>
{{ $t('settings.style.switcher.load_theme') }}
</button>
<button
class="btn"
@click="dismissWarning"
>
{{ $t('settings.style.switcher.keep_as_is') }}
</button>
</template>
</div>
</div>
<ExportImport
:export-object="exportedTheme"
:export-label="$t(&quot;settings.export_theme&quot;)"
:import-label="$t(&quot;settings.import_theme&quot;)"
:import-failed-text="$t(&quot;settings.invalid_theme_imported&quot;)"
:on-import="onImport"
:validator="importValidator"
>
<template slot="before">
<div class="presets">
{{ $t('settings.presets') }}
<label
for="preset-switcher"
class="select"
>
<select
id="preset-switcher"
v-model="selected"
class="preset-switcher"
> >
<option <option
v-for="style in availableStyles" v-for="style in availableStyles"
:key="style.name" :key="style.name"
:value="style" :value="style"
:style="{ :style="{
backgroundColor: style[1] || (style.theme || style.source).colors.bg, backgroundColor: style[1] || (style.theme || style.source).colors.bg,
color: style[3] || (style.theme || style.source).colors.text color: style[3] || (style.theme || style.source).colors.text

View file

@ -86,5 +86,4 @@ describe('Theme Data utility functions', () => {
expect(out.indexOf('a')).to.be.below(out.indexOf('c')) expect(out.indexOf('a')).to.be.below(out.indexOf('c'))
}) })
}) })
}) })