show confirm dialog before opening external link

This commit is contained in:
MaysWind
2025-11-06 00:51:09 +08:00
parent df23cb8cdd
commit 952731a2d4
20 changed files with 64 additions and 17 deletions
+8 -8
View File
@@ -14,23 +14,23 @@
<f7-list strong inset dividers>
<f7-list-item :title="tt('Version')" :after="clientVersion" @click="showVersion"></f7-list-item>
<f7-list-item :title="tt('Build Time')" :after="clientBuildTime" v-if="clientBuildTime"></f7-list-item>
<f7-list-item external :title="tt('Official Website')" link="https://github.com/mayswind/ezbookkeeping" target="_blank"></f7-list-item>
<f7-list-item external :title="tt('Report Issue')" link="https://github.com/mayswind/ezbookkeeping/issues" target="_blank"></f7-list-item>
<f7-list-item external :title="tt('Getting help')" link="https://ezbookkeeping.mayswind.net" target="_blank"></f7-list-item>
<f7-list-item :title="tt('Official Website')" link="#" @click="openExternalUrl('https://github.com/mayswind/ezbookkeeping')"></f7-list-item>
<f7-list-item :title="tt('Report Issue')" link="#" @click="openExternalUrl('https://github.com/mayswind/ezbookkeeping/issues')"></f7-list-item>
<f7-list-item :title="tt('Getting help')" link="#" @click="openExternalUrl('https://ezbookkeeping.mayswind.net')"></f7-list-item>
<f7-list-item :title="tt('License')" link="#" popup-open=".license-popup"></f7-list-item>
</f7-list>
<f7-block-title class="margin-top" v-if="exchangeRatesData && !isUserCustomExchangeRates">{{ tt('Exchange Rates Data') }}</f7-block-title>
<f7-list strong inset dividers v-if="exchangeRatesData && !isUserCustomExchangeRates">
<f7-list-item external :title="tt('Provider')" :after="exchangeRatesData.dataSource"
:link="exchangeRatesData.referenceUrl" target="_blank" v-if="exchangeRatesData.referenceUrl"></f7-list-item>
<f7-list-item :title="tt('Provider')" :after="exchangeRatesData.dataSource" link="#"
@click="openExternalUrl(exchangeRatesData.referenceUrl)" v-if="exchangeRatesData.referenceUrl"></f7-list-item>
<f7-list-item :title="tt('Provider')" :after="exchangeRatesData.dataSource" v-if="!exchangeRatesData.referenceUrl"></f7-list-item>
</f7-list>
<f7-block-title class="margin-top" v-if="mapProviderName">{{ tt('Map') }}</f7-block-title>
<f7-list strong inset dividers v-if="mapProviderName">
<f7-list-item external :title="tt('Provider')" :after="mapProviderName"
:link="mapProviderWebsite" target="_blank" v-if="mapProviderWebsite"></f7-list-item>
<f7-list-item :title="tt('Provider')" :after="mapProviderName" link="#"
@click="openExternalUrl(mapProviderWebsite)" v-if="mapProviderWebsite"></f7-list-item>
<f7-list-item :title="tt('Provider')" :after="mapProviderName" v-if="!mapProviderWebsite"></f7-list-item>
</f7-list>
@@ -82,7 +82,7 @@ import { useI18nUIComponents } from '@/lib/ui/mobile.ts';
import { useAboutPageBase } from '@/views/base/AboutPageBase.ts';
const { tt } = useI18n();
const { showAlert } = useI18nUIComponents();
const { showAlert, openExternalUrl } = useI18nUIComponents();
const {
clientVersion,
clientVersionMatchServerVersion,
+10 -4
View File
@@ -37,7 +37,7 @@
<f7-list-item>
<template #title>
<small>
<f7-link external :class="{ 'disabled': loggingInByPassword || loggingInByOAuth2 }" :href="getDesktopVersionPath()">{{ tt('Switch to Desktop Version') }}</f7-link>
<f7-link :class="{ 'disabled': loggingInByPassword || loggingInByOAuth2 }" @click="switchToDesktopVersion">{{ tt('Switch to Desktop Version') }}</f7-link>
</small>
</template>
<template #after>
@@ -72,7 +72,7 @@
<div class="login-page-powered-by margin-top-half">
<span>Powered by</span>
<f7-link external href="https://github.com/mayswind/ezbookkeeping" target="_blank">ezBookkeeping</f7-link>
<f7-link @click="openExternalUrl('https://github.com/mayswind/ezbookkeeping')" target="_blank">ezBookkeeping</f7-link>
<span>{{ version }}</span>
</div>
</f7-block-footer>
@@ -83,7 +83,7 @@
<div class="login-page-powered-by margin-top-half">
<span>Powered by</span>
<f7-link external href="https://github.com/mayswind/ezbookkeeping" target="_blank">ezBookkeeping</f7-link>
<f7-link @click="openExternalUrl('https://github.com/mayswind/ezbookkeeping')" target="_blank">ezBookkeeping</f7-link>
<span>{{ version }}</span>
</div>
</f7-toolbar>
@@ -205,7 +205,7 @@ const props = defineProps<{
}>();
const { tt } = useI18n();
const { showAlert, showToast } = useI18nUIComponents();
const { showAlert, showConfirm, showToast, openExternalUrl } = useI18nUIComponents();
const rootStore = useRootStore();
@@ -247,6 +247,12 @@ const twoFAVerifyTypeSwitchName = computed<string>(() => {
}
});
function switchToDesktopVersion(): void {
showConfirm('Are you sure you want to switch to desktop version?', () => {
window.location.replace(getDesktopVersionPath());
});
}
function login(): void {
const router = props.f7router;
+3 -3
View File
@@ -32,7 +32,7 @@
<div class="login-page-powered-by margin-top-half">
<span>Powered by</span>
<f7-link external href="https://github.com/mayswind/ezbookkeeping" target="_blank">ezBookkeeping</f7-link>
<f7-link @click="openExternalUrl('https://github.com/mayswind/ezbookkeeping')" target="_blank">ezBookkeeping</f7-link>
<span>{{ version }}</span>
</div>
</f7-block-footer>
@@ -43,7 +43,7 @@
<div class="login-page-powered-by margin-top-half">
<span>Powered by</span>
<f7-link external href="https://github.com/mayswind/ezbookkeeping" target="_blank">ezBookkeeping</f7-link>
<f7-link @click="openExternalUrl('https://github.com/mayswind/ezbookkeeping')" target="_blank">ezBookkeeping</f7-link>
<span>{{ version }}</span>
</div>
</f7-toolbar>
@@ -79,7 +79,7 @@ const props = defineProps<{
}>();
const { tt } = useI18n();
const { showToast, showConfirm } = useI18nUIComponents();
const { showToast, showConfirm, openExternalUrl } = useI18nUIComponents();
const { version, pinCode, isWebAuthnAvailable, isPinCodeValid, doAfterUnlocked, doRelogin } = useUnlockPageBase();
const settingsStore = useSettingsStore();
+2 -2
View File
@@ -91,7 +91,7 @@
<f7-list-item>
<small>{{ tt('Data source') }}</small>
<small>
<f7-link external target="_blank" :href="exchangeRatesData.referenceUrl" v-if="!isUserCustomExchangeRates && exchangeRatesData.referenceUrl">{{ exchangeRatesData.dataSource }}</f7-link>
<f7-link @click="openExternalUrl(exchangeRatesData.referenceUrl)" v-if="!isUserCustomExchangeRates && exchangeRatesData.referenceUrl">{{ exchangeRatesData.dataSource }}</f7-link>
<span v-else-if="!isUserCustomExchangeRates && !exchangeRatesData.referenceUrl">{{ exchangeRatesData.dataSource }}</span>
<span v-else-if="isUserCustomExchangeRates">{{ tt('User Custom') }}</span>
</small>
@@ -159,7 +159,7 @@ const {
formatExchangeRateAmountToWesternArabicNumerals
} = useI18n();
const { showAlert, showToast } = useI18nUIComponents();
const { showAlert, showToast, openExternalUrl } = useI18nUIComponents();
const {
baseCurrency,