File tree 1 file changed +27
-2
lines changed
1 file changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -128,10 +128,14 @@ function Game(props: GameProps) {
128
128
setGameNumber ( ( x ) => x + 1 ) ;
129
129
} ;
130
130
131
- async function share ( copiedHint : string , text ?: string ) {
131
+ async function share (
132
+ copiedHint : string ,
133
+ text ?: string ,
134
+ customTarget ?: string
135
+ ) {
132
136
const url = seed
133
137
? window . location . origin + window . location . pathname + currentSeedParams ( )
134
- : getChallengeUrl ( target ) ;
138
+ : getChallengeUrl ( customTarget ? customTarget : target ) ;
135
139
const body = url + ( text ? "\n\n" + text : "" ) ;
136
140
if (
137
141
/ a n d r o i d | i p h o n e | i p a d | i p o d | w e b o s / i. test ( navigator . userAgent ) &&
@@ -355,6 +359,27 @@ function Game(props: GameProps) {
355
359
</ button >
356
360
) }
357
361
</ p >
362
+ < p >
363
+ < button
364
+ onClick = { ( ) => {
365
+ if ( currentGuess . length >= minLength ) {
366
+ if ( dictionary . includes ( currentGuess ) ) {
367
+ share (
368
+ `Link for word "${ currentGuess . toUpperCase ( ) } " copied to clipboard!` ,
369
+ "I created this challenge for you!" ,
370
+ currentGuess
371
+ ) ;
372
+ } else {
373
+ setHint ( "Not a valid word" ) ;
374
+ }
375
+ } else {
376
+ setHint ( "Please make a guess first" ) ;
377
+ }
378
+ } }
379
+ >
380
+ Create a custom game from last guess
381
+ </ button >
382
+ </ p >
358
383
</ div >
359
384
) ;
360
385
}
You can’t perform that action at this time.
0 commit comments