Skip to content

Commit d2dab8e

Browse files
committed
Improve connection check display in popup
1 parent 82d5805 commit d2dab8e

19 files changed

+236
-212
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<script lang="ts" setup>
2+
import { inject, ref } from 'vue';
3+
import { NCard, NCollapseTransition, NIcon } from 'naive-ui';
4+
5+
import ConnectionDetails from '@/components/ConnectionCheck/ConnectionDetails.vue';
6+
import ConnectionLocation from '@/components/ConnectionCheck/ConnectionLocation.vue';
7+
import FeChevronDown from '@/components/Icons/FeChevronDown.vue';
8+
import FeChevronUp from '@/components/Icons/FeChevronUp.vue';
9+
import IconLabel from '@/components/IconLabel.vue';
10+
import WebTRCDetails from '@/components/ConnectionCheck/WebTRCDetails.vue';
11+
12+
import { ConnectionKey, defaultConnection } from '@/composables/useConnection';
13+
import { DnsServer } from '@/composables/useCheckDnsLeaks';
14+
15+
defineProps<{
16+
dnsServers: DnsServer[];
17+
isErrorDNS: boolean;
18+
isLoadingDNS: boolean;
19+
}>();
20+
21+
const { isLoading, isError } = inject(ConnectionKey, defaultConnection);
22+
23+
const showDetails = ref(true);
24+
</script>
25+
26+
<template>
27+
<n-card :bordered="false">
28+
<div v-if="isLoading || isError">
29+
<p class="mb-2">
30+
<IconLabel v-if="isLoading" text="Checking connection" type="spinner" />
31+
<IconLabel v-if="isError" text="Couldn't get connection details" type="warning" />
32+
</p>
33+
</div>
34+
35+
<div v-else>
36+
<div>
37+
<ConnectionLocation />
38+
<n-icon size="20" class="cursor-pointer" @click="showDetails = !showDetails">
39+
<FeChevronUp v-if="showDetails" />
40+
<FeChevronDown v-else />
41+
</n-icon>
42+
</div>
43+
44+
<div>
45+
<n-collapse-transition :show="showDetails">
46+
<ConnectionDetails :dnsServers :isErrorDNS :isLoadingDNS />
47+
<WebTRCDetails />
48+
</n-collapse-transition>
49+
</div>
50+
</div>
51+
</n-card>
52+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<script lang="ts" setup>
2+
import { inject } from 'vue';
3+
4+
import FeCheckCircle from '@/components/Icons/FeCheckCircle.vue';
5+
import FeDrop from '@/components/Icons/FeDrop.vue';
6+
import FeXCircle from '@/components/Icons/FeXCircle.vue';
7+
import FeWarning from '@/components/Icons/FeWarning.vue';
8+
import MuSpinner from '@/components/Icons/MuSpinner.vue';
9+
10+
import { ConnectionKey, defaultConnection } from '@/composables/useConnection';
11+
import { DnsServer } from '@/composables/useCheckDnsLeaks';
12+
13+
defineProps<{
14+
dnsServers: DnsServer[];
15+
isErrorDNS: boolean;
16+
isLoadingDNS: boolean;
17+
}>();
18+
19+
const { connection } = inject(ConnectionKey, defaultConnection);
20+
</script>
21+
22+
<template>
23+
<div class="ml-30px">
24+
<div>
25+
<h4 class="font-semibold inline-block">IP</h4>
26+
<span class="ml-2"
27+
>{{ connection.ip }} <span v-if="connection.ipv6"> / {{ connection.ipv6 }}</span></span
28+
>
29+
</div>
30+
<div>
31+
<h4 class="font-semibold inline-block">Provider</h4>
32+
<span class="ml-2">{{ connection.provider }}</span>
33+
</div>
34+
<div v-if="connection.isMullvad">
35+
<h4 class="font-semibold inline-block">Server</h4>
36+
<span class="ml-2">{{ connection.server }}</span>
37+
</div>
38+
<div class="flex flex-row">
39+
<h4 class="font-semibold mr-2">DNS</h4>
40+
41+
<div>
42+
<div v-if="isLoadingDNS" class="flex items-center">
43+
<MuSpinner />
44+
</div>
45+
<div v-if="isErrorDNS" class="flex items-center">
46+
<FeWarning class="text-warning" />
47+
<span class="ml-1">Couldn't determine DNS</span>
48+
</div>
49+
<div v-for="dnsServer in dnsServers" :key="dnsServer.ip" class="flex flex-row">
50+
<div class="inline-flex items-center">
51+
<FeDrop v-if="connection.isMullvad && !dnsServer.mullvad_dns" class="text-error" />
52+
<FeCheckCircle v-if="dnsServer.mullvad_dns" class="text-success" />
53+
<FeXCircle v-if="!connection.isMullvad && !dnsServer.mullvad_dns" class="text-error" />
54+
<span class="ml-1">
55+
{{ dnsServer.ip }}
56+
({{
57+
dnsServer.mullvad_dns_hostname ||
58+
dnsServer.hostname ||
59+
dnsServer.organization ||
60+
'unknown'
61+
}})
62+
</span>
63+
</div>
64+
</div>
65+
</div>
66+
</div>
67+
</div>
68+
</template>

src/components/ConnectionLocation/ConnectionLocation.test.ts src/components/ConnectionCheck/ConnectionLocation.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ref } from 'vue';
22
import { mount } from '@vue/test-utils';
3-
import ConnectionLocation from '@/components/ConnectionLocation/ConnectionLocation.vue';
3+
import ConnectionLocation from '@/components/ConnectionCheck/ConnectionLocation.vue';
44
import { ConnectionKey } from '@/composables/useConnection';
55

66
describe('ConnectionLocation.vue', function () {

src/components/ConnectionDetails/AdvancedDns.vue

-44
This file was deleted.

src/components/ConnectionDetails/AdvancedInfo.vue

-26
This file was deleted.

src/components/ConnectionDetails/ConnectionDetails.vue

-56
This file was deleted.

src/components/ConnectionStatus/ConnectionStatus.vue

-9
This file was deleted.

src/components/ConnectionStatus/DnsLeakStatus.vue

-31
This file was deleted.

src/components/ConnectionStatus/UsingMullvadConnectionStatus.vue

-16
This file was deleted.

src/components/Icons/FeXCircle.vue

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template>
2+
<svg
3+
width="1em"
4+
height="1em"
5+
viewBox="0 0 24 24"
6+
fill="none"
7+
stroke="currentColor"
8+
stroke-width="2"
9+
stroke-linecap="round"
10+
stroke-linejoin="round"
11+
>
12+
<circle cx="12" cy="12" r="10"></circle>
13+
<line x1="15" y1="9" x2="9" y2="15"></line>
14+
<line x1="9" y1="9" x2="15" y2="15"></line>
15+
</svg>
16+
</template>

src/components/NotificationsCarousel.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts" setup>
2-
import { computed } from 'vue';
2+
import { computed, inject } from 'vue';
33
import { NCard, NCarousel, NIcon, NImage } from 'naive-ui';
44
55
import Button from '@/components/Buttons/Button.vue';
@@ -10,9 +10,11 @@ import FeArrowRight from '@/components/Icons/FeArrowRight.vue';
1010
1111
import { closePopup, openOptions, Tab } from '@/helpers/browserExtension';
1212
13+
import { ConnectionKey, defaultConnection } from '@/composables/useConnection';
1314
import useRecommendations from '@/composables/useRecommendations/useRecommendations';
1415
import useWarnings from '@/composables/useWarnings/useWarnings';
1516
17+
const { isError, isLoading } = inject(ConnectionKey, defaultConnection);
1618
const { activeRecommendations } = useRecommendations();
1719
const { activeWarnings } = useWarnings();
1820
@@ -22,7 +24,7 @@ const activeNotifications = computed(() => {
2224
</script>
2325

2426
<template>
25-
<div v-if="activeNotifications.length > 0" class="mb-4 z-50">
27+
<div v-if="!isLoading && !isError && activeNotifications.length > 0" class="mt-4 z-50">
2628
<n-carousel :show-arrow="activeNotifications.length > 1" :show-dots="false">
2729
<template #arrow="{ prev, next }">
2830
<div v-if="activeNotifications.length > 1" class="arrows-custom">

src/components/OptionsTabs/ProxyTab.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { NCard } from 'naive-ui';
44
import Button from '@/components/Buttons/Button.vue';
55
import CustomProxies from '@/components/Proxy/CustomProxies.vue';
66
import IconLabel from '@/components/IconLabel.vue';
7-
import LocationDrawer from '@/components/ConnectionDetails/LocationDrawer.vue';
7+
import LocationDrawer from '@/components/LocationDrawer.vue';
88
import ProxyAutoReload from '@/components/Proxy/ProxyAutoReload.vue';
99
import RandomProxyMode from '@/components/Proxy/RandomProxyMode.vue';
1010
import TitleCategory from '@/components/TitleCategory.vue';

0 commit comments

Comments
 (0)