From f3b2d22953ece02ec19796f1bc6184ac40f106ce Mon Sep 17 00:00:00 2001
From: Brendan F <EpicWolverine@users.noreply.github.com>
Date: Wed, 12 Jul 2023 22:26:34 -0700
Subject: Don't use the share sheet on Windows

---
 src/components/Result/index.tsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/components/Result/index.tsx')

diff --git a/src/components/Result/index.tsx b/src/components/Result/index.tsx
index 68636d8..259525b 100644
--- a/src/components/Result/index.tsx
+++ b/src/components/Result/index.tsx
@@ -48,7 +48,10 @@ function ShareButton({
   const result = scoreToEmoji(guesses);
   const [buttonText, setButtonText] = useState('Share Results');
   const handleClick = React.useCallback(() => {
-    if (navigator.share !== undefined) {
+    // The Windows share sheet is dumb and doesn't have a copy function.
+    const windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'];
+    const onWindows = windowsPlatforms.indexOf(window.navigator.platform) !== -1;
+    if (navigator.share !== undefined && !onWindows) {
       navigator.share({text: result})
     } else if (navigator.clipboard !== undefined) {
       navigator.clipboard.writeText(result)
-- 
cgit v1.2.3

