From 8d2b006d60d5f83bb1ae3b391df60e62e0b4556c Mon Sep 17 00:00:00 2001 From: David <33458145+davidmcpowell@users.noreply.github.com> Date: Mon, 24 Jun 2024 10:00:51 +0100 Subject: [PATCH] Merge pull request #19070 from overleaf/dp-remove-useWaitForGrammarlyCheck Remove grammarly check in writefull promo GitOrigin-RevId: 30994c1960232afe3bede1fd6649606e191dd3d4 --- .../hooks/use-wait-for-grammarly-check.ts | 29 ------------------- 1 file changed, 29 deletions(-) delete mode 100644 services/web/frontend/js/shared/hooks/use-wait-for-grammarly-check.ts diff --git a/services/web/frontend/js/shared/hooks/use-wait-for-grammarly-check.ts b/services/web/frontend/js/shared/hooks/use-wait-for-grammarly-check.ts deleted file mode 100644 index 57499ef803..0000000000 --- a/services/web/frontend/js/shared/hooks/use-wait-for-grammarly-check.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { useEffect, useState } from 'react' - -/** - * - * @param {number} delay how long to wait before checking for grammarly in ms - * @param {boolean} initialState the initial state we should set grammarlyInstalled to before checking after the delay - * @returns {boolean} a stateful boolean which is initially false, then updates to reflect whether grammarly is installed after the delay to check - */ -export default function useWaitForGrammarlyCheck({ - delay = 3000, - initialState = false, -}) { - const [grammarlyInstalled, setGrammarlyInstalled] = useState(() => { - return initialState - }) - - useEffect(() => { - const timer = setTimeout( - () => setGrammarlyInstalled(grammarlyExtensionPresent()), - delay - ) - return () => clearTimeout(timer) - }, [delay]) - return grammarlyInstalled -} - -function grammarlyExtensionPresent() { - return !!document.querySelector('grammarly-desktop-integration') -}