aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Result
diff options
context:
space:
mode:
authorBrendan F <EpicWolverine@users.noreply.github.com>2023-07-12 22:26:34 -0700
committerBrendan F <EpicWolverine@users.noreply.github.com>2023-07-12 22:26:34 -0700
commitf3b2d22953ece02ec19796f1bc6184ac40f106ce (patch)
treee3c56840accefde136cbe8234f09d1b580c72280 /src/components/Result
parentead998d0ad4a77e74b9107114e54e195511a3559 (diff)
Don't use the share sheet on Windows
Diffstat (limited to 'src/components/Result')
-rw-r--r--src/components/Result/index.tsx5
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)
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage