Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

refactor: use smart confirm modal instead of native confirm modal

liyasthomas85c8171aa840
diff --git a/packages/hoppscotch-app/components/teams/Team.vue b/packages/hoppscotch-app/components/teams/Team.vue
index e3b598e3d..fe472548a 100644
--- a/packages/hoppscotch-app/components/teams/Team.vue
+++ b/packages/hoppscotch-app/components/teams/Team.vue
@@ -90,7 +90,7 @@
:label="t('action.delete')"
@click.native="
() => {
- deleteTeam()
+ confirmRemove = true
$refs.options.tippy().hide()
}
"
@@ -101,7 +101,7 @@
:label="t('team.exit')"
@click.native="
() => {
- exitTeam()
+ confirmExit = true
$refs.options.tippy().hide()
}
"
@@ -109,10 +109,23 @@
</tippy>
</span>
</div>
+ <SmartConfirmModal
+ :show="confirmRemove"
+ :title="t('confirm.remove_team')"
+ @hide-modal="confirmRemove = false"
+ @resolve="deleteTeam()"
+ />
+ <SmartConfirmModal
+ :show="confirmExit"
+ :title="t('confirm.exit_team')"
+ @hide-modal="confirmExit = false"
+ @resolve="exitTeam()"
+ />
</div>
</template>
<script setup lang="ts">
+import { ref } from "@nuxtjs/composition-api"
import { pipe } from "fp-ts/function"
import * as TE from "fp-ts/TaskEither"
import { TeamMemberRole } from "~/helpers/backend/graphql"
@@ -146,9 +159,10 @@ const emit = defineEmits<{
const toast = useToast()
-const deleteTeam = () => {
- if (!confirm(`${t("confirm.remove_team")}`)) return
+const confirmRemove = ref(false)
+const confirmExit = ref(false)
+const deleteTeam = () => {
pipe(
backendDeleteTeam(props.teamID),
TE.match(
@@ -165,8 +179,6 @@ const deleteTeam = () => {
}
const exitTeam = () => {
- if (!confirm("Are you sure you want to exit this team?")) return
-
pipe(
leaveTeam(props.teamID),
TE.match(
diff --git a/packages/hoppscotch-app/locales/af.json b/packages/hoppscotch-app/locales/af.json
index a1d5fdd58..b2fd27fd8 100644
--- a/packages/hoppscotch-app/locales/af.json
+++ b/packages/hoppscotch-app/locales/af.json
@@ -110,6 +110,7 @@
"team_collections": "Spanversamelings"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Weet u seker dat u wil afmeld?",
"remove_collection": "Weet u seker dat u hierdie versameling permanent wil uitvee?",
"remove_environment": "Is u seker dat u hierdie omgewing permanent wil uitvee?",
diff --git a/packages/hoppscotch-app/locales/ar.json b/packages/hoppscotch-app/locales/ar.json
index bee666f18..dfc961767 100644
--- a/packages/hoppscotch-app/locales/ar.json
+++ b/packages/hoppscotch-app/locales/ar.json
@@ -110,6 +110,7 @@
"team_collections": "مجموعات الفريق"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "هل أنت متأكد أنك تريد تسجيل الخروج؟",
"remove_collection": "هل أنت متأكد أنك تريد حذف هذه المجموعة نهائيًا؟",
"remove_environment": "هل أنت متأكد أنك تريد حذف هذه البيئة بشكل دائم؟",
diff --git a/packages/hoppscotch-app/locales/ca.json b/packages/hoppscotch-app/locales/ca.json
index ced3e70f5..9b554e5bf 100644
--- a/packages/hoppscotch-app/locales/ca.json
+++ b/packages/hoppscotch-app/locales/ca.json
@@ -110,6 +110,7 @@
"team_collections": "Col·leccions per equips"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Esteu segur que voleu tancar la sessió?",
"remove_collection": "Esteu segur que voleu suprimir permanentment aquesta col·lecció?",
"remove_environment": "Esteu segur que voleu suprimir permanentment aquest entorn?",
diff --git a/packages/hoppscotch-app/locales/cn.json b/packages/hoppscotch-app/locales/cn.json
index aa70b5025..45d3e6bf3 100644
--- a/packages/hoppscotch-app/locales/cn.json
+++ b/packages/hoppscotch-app/locales/cn.json
@@ -110,6 +110,7 @@
"team_collections": "团队组合"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "你确定要登出吗?",
"remove_collection": "你确定要永久删除该组合吗?",
"remove_environment": "你确定要永久删除该环境吗?",
diff --git a/packages/hoppscotch-app/locales/cs.json b/packages/hoppscotch-app/locales/cs.json
index 8e8f49355..a17212beb 100644
--- a/packages/hoppscotch-app/locales/cs.json
+++ b/packages/hoppscotch-app/locales/cs.json
@@ -110,6 +110,7 @@
"team_collections": "Týmové sbírky"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Opravdu se chcete odhlásit?",
"remove_collection": "Opravdu chcete tuto sbírku trvale smazat?",
"remove_environment": "Opravdu chcete toto prostředí trvale odstranit?",
diff --git a/packages/hoppscotch-app/locales/da.json b/packages/hoppscotch-app/locales/da.json
index 6f2db9f46..2707c77b6 100644
--- a/packages/hoppscotch-app/locales/da.json
+++ b/packages/hoppscotch-app/locales/da.json
@@ -110,6 +110,7 @@
"team_collections": "Teamsamlinger"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Er du sikker på, at du vil logge af?",
"remove_collection": "Er du sikker på, at du vil slette denne samling permanent?",
"remove_environment": "Er du sikker på, at du vil slette dette miljø permanent?",
diff --git a/packages/hoppscotch-app/locales/de.json b/packages/hoppscotch-app/locales/de.json
index 8b27ec44c..7338f47e6 100644
--- a/packages/hoppscotch-app/locales/de.json
+++ b/packages/hoppscotch-app/locales/de.json
@@ -110,6 +110,7 @@
"team_collections": "Teamsammlungen"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Möchten Sie sich wirklich abmelden?",
"remove_collection": "Möchten Sie diese Sammlung wirklich endgültig löschen?",
"remove_environment": "Möchten Sie diese Umgebung wirklich dauerhaft löschen?",
diff --git a/packages/hoppscotch-app/locales/el.json b/packages/hoppscotch-app/locales/el.json
index 6e8d61d93..466308ef3 100644
--- a/packages/hoppscotch-app/locales/el.json
+++ b/packages/hoppscotch-app/locales/el.json
@@ -110,6 +110,7 @@
"team_collections": "Συλλογές ομάδων"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Είστε βέβαιοι ότι θέλετε να αποσυνδεθείτε?",
"remove_collection": "Είστε βέβαιοι ότι θέλετε να διαγράψετε οριστικά αυτήν τη συλλογή;",
"remove_environment": "Είστε βέβαιοι ότι θέλετε να διαγράψετε οριστικά αυτό το περιβάλλον;",
diff --git a/packages/hoppscotch-app/locales/en.json b/packages/hoppscotch-app/locales/en.json
index bb44bd205..d9868e493 100644
--- a/packages/hoppscotch-app/locales/en.json
+++ b/packages/hoppscotch-app/locales/en.json
@@ -110,6 +110,7 @@
"team_collections": "Team Collections"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Are you sure you want to logout?",
"remove_collection": "Are you sure you want to permanently delete this collection?",
"remove_environment": "Are you sure you want to permanently delete this environment?",
diff --git a/packages/hoppscotch-app/locales/es.json b/packages/hoppscotch-app/locales/es.json
index 7ab676d0d..554b02dc2 100644
--- a/packages/hoppscotch-app/locales/es.json
+++ b/packages/hoppscotch-app/locales/es.json
@@ -110,6 +110,7 @@
"team_collections": "Colecciones de equipo"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "¿Está seguro de que desea cerrar la sesión?",
"remove_collection": "¿Está seguro de que desea eliminar esta colección de forma permanente?",
"remove_environment": "¿Está seguro de que desea eliminar este entorno de forma permanente?",
diff --git a/packages/hoppscotch-app/locales/fi.json b/packages/hoppscotch-app/locales/fi.json
index 2936a3495..d893a3fd9 100644
--- a/packages/hoppscotch-app/locales/fi.json
+++ b/packages/hoppscotch-app/locales/fi.json
@@ -110,6 +110,7 @@
"team_collections": "Joukkuekokoelmat"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Haluatko varmasti kirjautua ulos?",
"remove_collection": "Haluatko varmasti poistaa tämän kokoelman pysyvästi?",
"remove_environment": "Haluatko varmasti poistaa tämän ympäristön pysyvästi?",
diff --git a/packages/hoppscotch-app/locales/fr.json b/packages/hoppscotch-app/locales/fr.json
index b155170bb..dabd2a055 100644
--- a/packages/hoppscotch-app/locales/fr.json
+++ b/packages/hoppscotch-app/locales/fr.json
@@ -110,6 +110,7 @@
"team_collections": "Collections de l'équipe"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Êtes-vous sûr de vouloir vous déconnecter?",
"remove_collection": "Voulez-vous vraiment supprimer définitivement cette collection ?",
"remove_environment": "Voulez-vous vraiment supprimer définitivement cet environnement ?",
diff --git a/packages/hoppscotch-app/locales/he.json b/packages/hoppscotch-app/locales/he.json
index daba2e798..481bfbbf1 100644
--- a/packages/hoppscotch-app/locales/he.json
+++ b/packages/hoppscotch-app/locales/he.json
@@ -110,6 +110,7 @@
"team_collections": "אוספי צוות"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "האם אתה בטוח שאתה רוצה להתנתק?",
"remove_collection": "האם אתה בטוח שברצונך למחוק את האוסף הזה לצמיתות?",
"remove_environment": "האם אתה בטוח שברצונך למחוק סביבה זו לצמיתות?",
diff --git a/packages/hoppscotch-app/locales/hu.json b/packages/hoppscotch-app/locales/hu.json
index 5160b198b..7a3da7b7d 100644
--- a/packages/hoppscotch-app/locales/hu.json
+++ b/packages/hoppscotch-app/locales/hu.json
@@ -110,6 +110,7 @@
"team_collections": "Csapatgyűjtemények"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Biztosan ki szeretne jelentkezni?",
"remove_collection": "Biztosan véglegesen törölni szeretné ezt a gyűjteményt?",
"remove_environment": "Biztosan véglegesen törölni szeretné ezt a környezetet?",
diff --git a/packages/hoppscotch-app/locales/it.json b/packages/hoppscotch-app/locales/it.json
index 6558dd793..be20a1e7f 100644
--- a/packages/hoppscotch-app/locales/it.json
+++ b/packages/hoppscotch-app/locales/it.json
@@ -110,6 +110,7 @@
"team_collections": "Raccolte di team"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Sei sicuro di voler uscire?",
"remove_collection": "Sei sicuro di voler eliminare definitivamente questa raccolta?",
"remove_environment": "Sei sicuro di voler eliminare definitivamente questo ambiente?",
diff --git a/packages/hoppscotch-app/locales/ja.json b/packages/hoppscotch-app/locales/ja.json
index 913f67fa8..ac68bbf5d 100644
--- a/packages/hoppscotch-app/locales/ja.json
+++ b/packages/hoppscotch-app/locales/ja.json
@@ -110,6 +110,7 @@
"team_collections": "チームコレクション"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "ログアウトしてもよろしいですか?",
"remove_collection": "このコレクションを完全に削除してもよろしいですか?",
"remove_environment": "この環境を完全に削除してもよろしいですか?",
diff --git a/packages/hoppscotch-app/locales/ko.json b/packages/hoppscotch-app/locales/ko.json
index f9659c37f..f9798db34 100644
--- a/packages/hoppscotch-app/locales/ko.json
+++ b/packages/hoppscotch-app/locales/ko.json
@@ -110,6 +110,7 @@
"team_collections": "팀 모음집"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "로그아웃하시겠습니까?",
"remove_collection": "이 모음집을 영구적으로 삭제하시겠습니까?",
"remove_environment": "이 환경을 영구적으로 삭제하시겠습니까?",
diff --git a/packages/hoppscotch-app/locales/nl.json b/packages/hoppscotch-app/locales/nl.json
index 18f5184e0..0b5480aac 100644
--- a/packages/hoppscotch-app/locales/nl.json
+++ b/packages/hoppscotch-app/locales/nl.json
@@ -110,6 +110,7 @@
"team_collections": "Teamcollecties"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Weet u zeker dat u wilt uitloggen?",
"remove_collection": "Weet je zeker dat je deze collectie definitief wilt verwijderen?",
"remove_environment": "Weet u zeker dat u deze omgeving permanent wilt verwijderen?",
diff --git a/packages/hoppscotch-app/locales/no.json b/packages/hoppscotch-app/locales/no.json
index 7b95f9527..4f727ea59 100644
--- a/packages/hoppscotch-app/locales/no.json
+++ b/packages/hoppscotch-app/locales/no.json
@@ -110,6 +110,7 @@
"team_collections": "Lagsamlinger"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Er du sikker på at du vil logge deg av?",
"remove_collection": "Er du sikker på at du vil slette denne samlingen permanent?",
"remove_environment": "Er du sikker på at du vil slette dette miljøet for godt?",
diff --git a/packages/hoppscotch-app/locales/pl.json b/packages/hoppscotch-app/locales/pl.json
index b717764d8..1c656e73c 100644
--- a/packages/hoppscotch-app/locales/pl.json
+++ b/packages/hoppscotch-app/locales/pl.json
@@ -110,6 +110,7 @@
"team_collections": "Kolekcje zespołowe"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Czy na pewno chcesz się wylogować?",
"remove_collection": "Czy na pewno chcesz trwale usunąć tę kolekcję?",
"remove_environment": "Czy na pewno chcesz trwale usunąć to środowisko?",
diff --git a/packages/hoppscotch-app/locales/pt-br.json b/packages/hoppscotch-app/locales/pt-br.json
index f334d100f..6cdb5bc86 100644
--- a/packages/hoppscotch-app/locales/pt-br.json
+++ b/packages/hoppscotch-app/locales/pt-br.json
@@ -110,6 +110,7 @@
"team_collections": "Coleções da equipe"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Tem certeza que deseja sair?",
"remove_collection": "Tem certeza de que deseja excluir esta coleção permanentemente?",
"remove_environment": "Tem certeza de que deseja excluir este ambiente permanentemente?",
diff --git a/packages/hoppscotch-app/locales/pt.json b/packages/hoppscotch-app/locales/pt.json
index f334d100f..6cdb5bc86 100644
--- a/packages/hoppscotch-app/locales/pt.json
+++ b/packages/hoppscotch-app/locales/pt.json
@@ -110,6 +110,7 @@
"team_collections": "Coleções da equipe"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Tem certeza que deseja sair?",
"remove_collection": "Tem certeza de que deseja excluir esta coleção permanentemente?",
"remove_environment": "Tem certeza de que deseja excluir este ambiente permanentemente?",
diff --git a/packages/hoppscotch-app/locales/ro.json b/packages/hoppscotch-app/locales/ro.json
index ab50f052b..55aa54b10 100644
--- a/packages/hoppscotch-app/locales/ro.json
+++ b/packages/hoppscotch-app/locales/ro.json
@@ -110,6 +110,7 @@
"team_collections": "Colecții de echipă"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Sigur doriți să vă deconectați?",
"remove_collection": "Sigur doriți să ștergeți definitiv această colecție?",
"remove_environment": "Sigur doriți să ștergeți definitiv acest mediu?",
diff --git a/packages/hoppscotch-app/locales/ru.json b/packages/hoppscotch-app/locales/ru.json
index 9f9873184..589b4e533 100644
--- a/packages/hoppscotch-app/locales/ru.json
+++ b/packages/hoppscotch-app/locales/ru.json
@@ -110,6 +110,7 @@
"team_collections": "Коллекции команд"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Вы действительно хотите выйти?",
"remove_collection": "Вы уверены, что хотите навсегда удалить эту коллекцию?",
"remove_environment": "Вы действительно хотите удалить эту среду без возможности восстановления?",
diff --git a/packages/hoppscotch-app/locales/sr.json b/packages/hoppscotch-app/locales/sr.json
index 27647b743..f91541239 100644
--- a/packages/hoppscotch-app/locales/sr.json
+++ b/packages/hoppscotch-app/locales/sr.json
@@ -110,6 +110,7 @@
"team_collections": "Збирке тима"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Јесте ли сигурни да се желите одјавити?",
"remove_collection": "Јесте ли сигурни да желите трајно да избришете ову колекцију?",
"remove_environment": "Јесте ли сигурни да желите трајно да избришете ово окружење?",
diff --git a/packages/hoppscotch-app/locales/sv.json b/packages/hoppscotch-app/locales/sv.json
index 3823d6288..524f3b5fc 100644
--- a/packages/hoppscotch-app/locales/sv.json
+++ b/packages/hoppscotch-app/locales/sv.json
@@ -110,6 +110,7 @@
"team_collections": "Lagsamlingar"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Är du säker på att du vill logga ut?",
"remove_collection": "Är du säker på att du vill radera denna samling permanent?",
"remove_environment": "Är du säker på att du vill ta bort den här miljön permanent?",
diff --git a/packages/hoppscotch-app/locales/tr.json b/packages/hoppscotch-app/locales/tr.json
index 78144841c..551c9e5c2 100644
--- a/packages/hoppscotch-app/locales/tr.json
+++ b/packages/hoppscotch-app/locales/tr.json
@@ -110,6 +110,7 @@
"team_collections": "Takım Koleksiyonları"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Oturumu kapatmak istediğinizden emin misiniz?",
"remove_collection": "Bu koleksiyonu kalıcı olarak silmek istediğinizden emin misiniz?",
"remove_environment": "Bu ortamı kalıcı olarak silmek istediğinizden emin misiniz?",
diff --git a/packages/hoppscotch-app/locales/tw.json b/packages/hoppscotch-app/locales/tw.json
index a814ce2ba..0d722a0dd 100644
--- a/packages/hoppscotch-app/locales/tw.json
+++ b/packages/hoppscotch-app/locales/tw.json
@@ -110,6 +110,7 @@
"team_collections": "團隊組合"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "你確定要登出嗎?",
"remove_collection": "你確定要永久刪除該組合嗎?",
"remove_environment": "你確定要永久刪除該環境嗎?",
diff --git a/packages/hoppscotch-app/locales/uk.json b/packages/hoppscotch-app/locales/uk.json
index 6865da507..642282304 100644
--- a/packages/hoppscotch-app/locales/uk.json
+++ b/packages/hoppscotch-app/locales/uk.json
@@ -110,6 +110,7 @@
"team_collections": "Колекції команд"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Ви впевнені, що хочете вийти?",
"remove_collection": "Ви впевнені, що хочете назавжди видалити цю колекцію?",
"remove_environment": "Ви впевнені, що хочете назавжди видалити це середовище?",
diff --git a/packages/hoppscotch-app/locales/vi.json b/packages/hoppscotch-app/locales/vi.json
index 785bd5446..cd3c4ceb2 100644
--- a/packages/hoppscotch-app/locales/vi.json
+++ b/packages/hoppscotch-app/locales/vi.json
@@ -110,6 +110,7 @@
"team_collections": "Bộ sưu tập nhóm"
},
"confirm": {
+ "exit_team": "Are you sure you want to leave this team?",
"logout": "Bạn có chắc chắn bạn muốn thoát?",
"remove_collection": "Bạn có chắc chắn muốn xóa vĩnh viễn bộ sưu tập này không?",
"remove_environment": "Bạn có chắc chắn muốn xóa vĩnh viễn môi trường này không?",