Skip to content

Commit

Permalink
Move settings to the options page
Browse files Browse the repository at this point in the history
  • Loading branch information
ruihildt committed Aug 1, 2024
1 parent d6e8910 commit cb25795
Show file tree
Hide file tree
Showing 26 changed files with 174 additions and 510 deletions.
4 changes: 2 additions & 2 deletions src/components/Headers/HomeHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import FeCog from '@/components/Icons/FeCog.vue';
import FeGlobe from '@/components/Icons/FeGlobe.vue';
import TaRoute from '@/components/Icons/TaRoute.vue';
import { openOptions } from '@/helpers/extensionNavigation';
import { openOptions } from '@/helpers/browserExtension';
</script>

<template>
Expand All @@ -31,7 +31,7 @@ import { openOptions } from '@/helpers/extensionNavigation';

<div
class="flex flex-row items-center justify-center px-4 hover:text-white bg-[var(--blue)] cursor-pointer"
@click="openOptions"
@click="openOptions()"
>
<n-icon size="20">
<FeCog />
Expand Down
29 changes: 0 additions & 29 deletions src/components/Headers/LicenseHeader.vue

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/Headers/ProxyHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import FeCog from '@/components/Icons/FeCog.vue';
import FeGlobe from '@/components/Icons/FeGlobe.vue';
import TaRoute from '@/components/Icons/TaRoute.vue';
import { openOptions } from '@/helpers/extensionNavigation';
import { openOptions, Tab } from '@/helpers/browserExtension';
</script>

<template>
Expand All @@ -31,7 +31,7 @@ import { openOptions } from '@/helpers/extensionNavigation';

<div
class="flex flex-row items-center justify-center px-4 hover:text-white bg-[var(--blue)] cursor-pointer"
@click="openOptions"
@click="openOptions(Tab.PROXY)"
>
<n-icon size="20">
<FeCog />
Expand Down
39 changes: 0 additions & 39 deletions src/components/Headers/SettingsHeader.vue

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/NotificationsCarousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import IconLabel from '@/components/IconLabel.vue';
import FeArrowLeft from '@/components/Icons/FeArrowLeft.vue';
import FeArrowRight from '@/components/Icons/FeArrowRight.vue';
import { closePopup } from '@/helpers/extensionNavigation';
import { closePopup, openOptions, Tab } from '@/helpers/browserExtension';
import useRecommendations from '@/composables/useRecommendations/useRecommendations';
import useWarnings from '@/composables/useWarnings/useWarnings';
Expand Down Expand Up @@ -69,7 +69,7 @@ const activeNotifications = computed(() => {
>
<ExternalLinkIconLabel v-if="notification.ctaLabel" :text="notification.ctaLabel" />
</Button>
<Button :to="`/settings#${notification.id}`"> Learn more </Button>
<Button @click="openOptions(Tab.SETTINGS)"> Learn More </Button>
</div>
<div v-else class="mt-3 flex items-center">
<Button :href="notification.ctaUrl" @click="closePopup"> Read more </Button>
Expand Down
53 changes: 53 additions & 0 deletions src/components/OptionsTabs/AboutTab.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<script setup lang="ts">
import { NCard, NTag } from 'naive-ui';
import FeGithub from '@/components/Icons/FeGithub.vue';
import FeInfo from '@/components/Icons/FeInfo.vue';
import { version } from '@/helpers/browserExtension';
</script>

<template>
<div class="flex items-center p-3 pb-1">
<n-tag round :bordered="false" type="info" class="mr-4">
<a href="https://github.com/mullvad/browser-extension/releases">
{{ version }} | Changelog
</a>
<template #icon>
<FeInfo />
</template>
</n-tag>
<n-tag round :bordered="false" type="info">
<a href="https://github.com/mullvad/browser-extension"> Source code </a>
<template #icon>
<FeGithub />
</template>
</n-tag>
</div>

<n-card class="mt-4">
<p>
Mullvad Browser Extension as a whole is licensed
<a href="https://github.com/mullvad/browser-extension/blob/master/LICENSE.md"> GPLv3+</a>
except for the parts specified below:
</p>

<ul list="disc inside" class="py-2">
<li>
Open Sans -
<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
</li>
<li>
Source Sans Pro -
<a href="https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL">
Open Font License
</a>
</li>
<li>
Feather Icon -
<a href="https://github.com/feathericon/feathericon/blob/master/LICENSE"> MIT </a>
</li>
</ul>
<p>Third party extensions logos are the property of their respective owners.</p>
</n-card>
</template>
5 changes: 5 additions & 0 deletions src/components/OptionsTabs/ProxyTab.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script setup lang="ts"></script>

<template>
<div>List of the existing proxies</div>
</template>
12 changes: 12 additions & 0 deletions src/components/OptionsTabs/SettingsTab.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script setup lang="ts">
import PrivacyRecommendations from '@/components/PrivacyRecommendations/PrivacyRecommendations.vue';
import TitleCategory from '@/components/TitleCategory.vue';
import WebRTCToggle from '@/components/PrivacyRecommendations/WebRTCToggle.vue';
</script>

<template>
<WebRTCToggle class="pt-4" />

<TitleCategory title="Privacy Recommendations" class="pt-4" />
<privacy-recommendations />
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Instructions from '@/components/PrivacyRecommendations/Instructions.vue';
import RecommendationIconWithTooltip from '@/components/RecommendationIconWithTooltip.vue';
import SplitButton from '@/components/Buttons/SplitButton.vue';
import { closePopup } from '@/helpers/extensionNavigation';
import { closePopup } from '@/helpers/browserExtension';
import type { Recommendation } from '@/composables/useRecommendations/Recommendation.types';
import ExternalLinkIconLabel from '@/components/ExternalLinkIconLabel.vue';
Expand Down
2 changes: 1 addition & 1 deletion src/components/PrivacyRecommendations/WebRTCToggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Button from '@/components/Buttons/Button.vue';
import ExternalLinkIconLabel from '@/components/ExternalLinkIconLabel.vue';
import IconLabel from '@/components/IconLabel.vue';
import { closePopup } from '@/helpers/extensionNavigation';
import { closePopup } from '@/helpers/browserExtension';
import useWebRtc from '@/composables/useWebRtc';
const { setWebRTC, webRTCStatus } = useWebRtc();
Expand Down
14 changes: 14 additions & 0 deletions src/composables/useOptionsTab.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ref } from 'vue';

export function useOptionsTab() {
const currentTab = ref('');

const changeTab = (tab: string) => {
currentTab.value = tab;
};

return {
currentTab,
changeTab,
};
}
11 changes: 10 additions & 1 deletion src/composables/useStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ import { Ref } from 'vue';

import type { HistoryEntriesMap } from './useProxyHistory/HistoryEntries.types';
import { Country } from './useListProxies';
import type {
ProxyDetails,
ProxyInfoMap,
ProxyInfo,
ProxyDetailsMap,
} from '@/helpers/socksProxy.types';
import { Tab } from '@/helpers/browserExtension';

import { ProxyDetails, ProxyInfoMap, ProxyInfo, ProxyDetailsMap } from '@/helpers/socksProxy.types';
import useBrowserStorageLocal from '@/composables/useBrowserStorageLocal';

export type Store = {
Expand All @@ -17,6 +23,7 @@ export type Store = {
proxiesList: Ref<Country[]>;
randomProxyActive: Ref<boolean>;
webRTCStatus: Ref<boolean>;
optionsActiveTab: Ref<Tab>;
};

const useStore = (): Store => {
Expand All @@ -30,6 +37,7 @@ const useStore = (): Store => {
const proxiesList = useBrowserStorageLocal('proxiesList', [] as Country[]);
const randomProxyActive = useBrowserStorageLocal('randomProxyActive', false);
const webRTCStatus = useBrowserStorageLocal('webRTCStatus', true);
const optionsActiveTab = useBrowserStorageLocal('optionsActiveTab', Tab.SETTINGS);
return {
excludedHosts,
globalProxy,
Expand All @@ -38,6 +46,7 @@ const useStore = (): Store => {
hostProxiesDetails,
historyEntries,
mullvadAccount,
optionsActiveTab,
proxiesList,
randomProxyActive,
webRTCStatus,
Expand Down
22 changes: 22 additions & 0 deletions src/helpers/browserExtension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export enum Tab {
SETTINGS = 'settings',
PROXY = 'proxy',
ABOUT = 'about',
}
export const closePopup = () => {
// The delay is added to stop a new empty browser window from opening
// when installing the extension from the popup
setTimeout(() => {
window.close();
}, 100);
};

export const openOptions = async (tab?: Tab) => {
if (tab) {
await browser.storage.local.set({ optionsActiveTab: tab });
}
closePopup();
browser.runtime.openOptionsPage();
};

export const { version } = browser.runtime.getManifest();
12 changes: 0 additions & 12 deletions src/helpers/extensionNavigation.ts

This file was deleted.

12 changes: 12 additions & 0 deletions src/options/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import { useQueryProvider } from 'vue-query';
import { NConfigProvider, GlobalThemeOverrides, darkTheme } from 'naive-ui';
import Options from './Options.vue';
useQueryProvider();
const themeOverrides: GlobalThemeOverrides = {
Expand Down Expand Up @@ -28,6 +29,17 @@ const themeOverrides: GlobalThemeOverrides = {
border: '1px solid var(--blue)',
borderChecked: '1px solid var(--blue)',
},
Tabs: {
tabFontSizeLarge: '1.12rem',
tabFontWeight: '600',
tabFontWeightActive: '600',
tabColor: 'var(--blue)',
tabTextColorLine: '--light-grey',
tabTextColorHoverLine: 'var(--white)',
tabTextColorActiveLine: 'var(--white)',
tabBorderColor: 'var(--blue)',
barColor: 'var(--white)',
},
};
</script>

Expand Down
Loading

0 comments on commit cb25795

Please sign in to comment.