From e6605cb9e38b1929af5de8b5f412c528bee24dac Mon Sep 17 00:00:00 2001 From: Rohid Date: Sat, 17 Aug 2024 16:09:06 +0600 Subject: [PATCH 1/3] fix: close the options window after clicking save --- src/components/Options.tsx | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/src/components/Options.tsx b/src/components/Options.tsx index 46c11e5..689f1ea 100644 --- a/src/components/Options.tsx +++ b/src/components/Options.tsx @@ -1,5 +1,3 @@ -import { Toast } from 'bootstrap'; -import classNames from 'classnames'; import React, { useEffect, useRef, useState } from 'react'; import config, { SuccessOrFailType } from '../config/config'; import apiKeyInvalid from '../utils/apiKey'; @@ -38,8 +36,6 @@ export default function Options(): JSX.Element { whitelist: '', }); - const liveToastRef = useRef(null); - const loggingStyleRef = useRef(null); const restoreSettings = async (): Promise => { @@ -131,9 +127,8 @@ export default function Options(): JSX.Element { trackSocialMedia, whitelist, }); - // eslint-disable-next-line - Toast.getOrCreateInstance(liveToastRef?.current ?? '')?.show(); await logUserIn(state.apiKey); + window.close(); }; const updateBlacklistState = (sites: string) => { @@ -363,30 +358,6 @@ export default function Options(): JSX.Element { -
- -
From c5576b01caea0abab5c34e81b43645ab94931547 Mon Sep 17 00:00:00 2001 From: Rohid Date: Sat, 17 Aug 2024 16:11:56 +0600 Subject: [PATCH 2/3] fix: remove double scroll bar --- src/components/Options.tsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/components/Options.tsx b/src/components/Options.tsx index 689f1ea..67c751a 100644 --- a/src/components/Options.tsx +++ b/src/components/Options.tsx @@ -175,15 +175,7 @@ export default function Options(): JSX.Element { const isApiKeyValid = apiKeyInvalid(state.apiKey) === ''; return ( -
+
From 6c304bcc5fe715cae2dff71d24e672b4464910bd Mon Sep 17 00:00:00 2001 From: Rohid Date: Sat, 17 Aug 2024 16:29:33 +0600 Subject: [PATCH 3/3] fix: only close the options window if it's a chrome extension --- src/components/Options.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Options.tsx b/src/components/Options.tsx index 67c751a..156f264 100644 --- a/src/components/Options.tsx +++ b/src/components/Options.tsx @@ -1,5 +1,6 @@ import React, { useEffect, useRef, useState } from 'react'; import config, { SuccessOrFailType } from '../config/config'; +import { IS_CHROME } from '../utils'; import apiKeyInvalid from '../utils/apiKey'; import { logUserIn } from '../utils/user'; import SitesList from './SitesList'; @@ -128,7 +129,9 @@ export default function Options(): JSX.Element { whitelist, }); await logUserIn(state.apiKey); - window.close(); + if (IS_CHROME) { + window.close(); + } }; const updateBlacklistState = (sites: string) => {