diff options
| author | Brendan F <EpicWolverine@users.noreply.github.com> | 2023-07-12 22:26:34 -0700 |
|---|---|---|
| committer | Brendan F <EpicWolverine@users.noreply.github.com> | 2023-07-12 22:26:34 -0700 |
| commit | f3b2d22953ece02ec19796f1bc6184ac40f106ce (patch) | |
| tree | e3c56840accefde136cbe8234f09d1b580c72280 | |
| parent | ead998d0ad4a77e74b9107114e54e195511a3559 (diff) | |
Don't use the share sheet on Windows
| -rw-r--r-- | src/components/Result/index.tsx | 5 |
1 files changed, 4 insertions, 1 deletions
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) |
