Compare commits

..

No commits in common. "cf82f550b75c6de63d0242a21900c13a54f9d730" and "55ce44aebfda999741106f43ede3f6194831e0f0" have entirely different histories.

6 changed files with 6 additions and 20 deletions

View file

@ -23,7 +23,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The style has been entirely reworked using Bootstrap instead of Bulma - The style has been entirely reworked using Bootstrap instead of Bulma
- It is now impossible to include the separator in the dedicated name - It is now impossible to include the separator in the dedicated name
- When adding a new account, error messages are displayed alongside each affected elements whenever possible - When adding a new account, error messages are displayed alongside each affected elements whenever possible
- By default, the new sub-address form reset button switches to the default account
## Fixed ## Fixed
- Invalid preferences are now automatically corrected - Invalid preferences are now automatically corrected

View file

@ -6,4 +6,3 @@ export const allowedLocales = [
'en', 'en',
'fr', 'fr',
]; ];
export const resetToDefaultAccount = true;

View file

@ -53,7 +53,6 @@
"title": "Preferences", "title": "Preferences",
"language": "Language", "language": "Language",
"colorMode": "Theme", "colorMode": "Theme",
"resetToDefault": "Switch to the default account when the new sub-address form is reset",
"lightTheme": "Light", "lightTheme": "Light",
"darkTheme": "Dark", "darkTheme": "Dark",
"close": "@:invariants.controls.close" "close": "@:invariants.controls.close"

View file

@ -53,7 +53,6 @@
"title": "Préférences", "title": "Préférences",
"language": "Langue", "language": "Langue",
"colorMode": "Thème", "colorMode": "Thème",
"resetToDefault": "Basculer sur le compte par défaut lorsque le formulaire de sous-adresse est réinitialisé",
"lightTheme": "Clair", "lightTheme": "Clair",
"darkTheme": "Sombre", "darkTheme": "Sombre",
"close": "@:invariants.controls.close" "close": "@:invariants.controls.close"

View file

@ -1,5 +1,4 @@
<script setup> <script setup>
import { allowedColorModes, resetToDefaultAccount } from '../const';
import { watch } from 'vue'; import { watch } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
@ -11,7 +10,10 @@ const router = useRouter();
const stored_locale = useStorage('sake-locale', ''); const stored_locale = useStorage('sake-locale', '');
const { t, locale } = useI18n({ useScope: 'global' }); const { t, locale } = useI18n({ useScope: 'global' });
const colorMode = useStorage('sake-color-mode'); const colorMode = useStorage('sake-color-mode');
const resetToDefault = useStorage('sake-reset-to-default', resetToDefaultAccount); const allowedColorModes = [
'light',
'dark',
];
const toMainView = () => { const toMainView = () => {
return router.push('/'); return router.push('/');
@ -43,12 +45,6 @@ watch(colorMode, async (newColorMode) => {
<option v-for="mode in allowedColorModes" :key="mode" :value="mode">{{ $t(`config.${mode}Theme`) }}</option> <option v-for="mode in allowedColorModes" :key="mode" :value="mode">{{ $t(`config.${mode}Theme`) }}</option>
</select> </select>
</div> </div>
<div class="mb-3">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="app-reset-to-default" v-model="resetToDefault">
<label class="form-check-label" for="app-reset-to-default">{{ $t("config.resetToDefault") }}</label>
</div>
</div>
<ButtonGroupComponent> <ButtonGroupComponent>
<button type="button" class="btn btn-secondary" @click="toMainView">{{ $t("about.close") }}</button> <button type="button" class="btn btn-secondary" @click="toMainView">{{ $t("about.close") }}</button>

View file

@ -1,6 +1,5 @@
<script setup> <script setup>
import { sortAccounts } from '../accounts'; import { sortAccounts } from '../accounts';
import { resetToDefaultAccount } from '../const';
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { RouterLink, useRouter } from 'vue-router'; import { RouterLink, useRouter } from 'vue-router';
import { useStorage } from '@vueuse/core'; import { useStorage } from '@vueuse/core';
@ -13,13 +12,11 @@ import NavBarComponent from '../components/NavBarComponent.vue';
const router = useRouter(); const router = useRouter();
const accounts = useStorage('sake-accounts', []); const accounts = useStorage('sake-accounts', []);
const resetToDefault = useStorage('sake-reset-to-default', resetToDefaultAccount);
const sortedAccounts = computed(() => sortAccounts(accounts.value)); const sortedAccounts = computed(() => sortAccounts(accounts.value));
const getDefaultAccount = () => { const selectedAccountId = ref((() => {
const def = accounts.value.find((a) => a.isDefault); const def = accounts.value.find((a) => a.isDefault);
return def ? def.id : accounts.value[0].id; return def ? def.id : accounts.value[0].id;
}; })());
const selectedAccountId = ref(getDefaultAccount());
const subAddrName = ref(''); const subAddrName = ref('');
const fromRawAccount = (raw_account) => { const fromRawAccount = (raw_account) => {
@ -59,9 +56,6 @@ const copyAddr = () => {
}; };
const resetForm = () => { const resetForm = () => {
subAddrName.value = ''; subAddrName.value = '';
if (resetToDefault.value) {
selectedAccountId.value = getDefaultAccount();
}
}; };
</script> </script>