change remainder of "confirm" calls to better UX

This commit is contained in:
2024-04-24 20:11:38 -06:00
parent eeaacaf202
commit f4f5fc7730
5 changed files with 169 additions and 119 deletions

View File

@@ -562,7 +562,7 @@
<div v-if="showContactImport()">
<button
class="block text-center text-md uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md mb-6"
@click="submitFile()"
@click="confirmSubmitFile()"
>
Import Settings & Contacts
<br />
@@ -1082,6 +1082,23 @@ export default class AccountViewView extends Vue {
return !!inputFileNameRef.value;
}
confirmSubmitFile() {
if (inputFileNameRef.value != null) {
this.$notify(
{
group: "modal",
type: "confirm",
title: "Replace All",
text:
"This will replace all settings and contacts, so we recommend you first do the backup step above." +
" Are you sure you want to import and replace all contacts and settings?",
onYes: this.submitFile,
},
-1,
);
}
}
/**
* Asynchronously imports the database from a downloadable JSON file.
*
@@ -1089,17 +1106,10 @@ export default class AccountViewView extends Vue {
*/
async submitFile() {
if (inputFileNameRef.value != null) {
if (
confirm(
"This will replace all settings and contacts, so we recommend you first do the backup step above." +
" Are you sure you want to import and replace all contacts and settings?",
)
) {
await db.delete();
await Dexie.import(inputFileNameRef.value, {
progressCallback: this.progressCallback,
});
}
await db.delete();
await Dexie.import(inputFileNameRef.value, {
progressCallback: this.progressCallback,
});
}
}