Utkarsh Gupta 2024-03-12 22:02:31 -06:00 zatwierdzone przez GitHub
commit 63bfe4d401
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 31 dodań i 2 usunięć

Wyświetl plik

@ -130,8 +130,14 @@ function Game(props: GameProps) {
setGameNumber((x) => x + 1);
};
async function share(copiedHint: string, text?: string) {
const url = seed
async function share(
copiedHint: string,
text?: string,
customTarget?: string
) {
const url = customTarget
? getChallengeUrl(customTarget)
: seed
? window.location.origin + window.location.pathname + currentSeedParams()
: getChallengeUrl(target);
const body = url + (text ? "\n\n" + text : "");
@ -359,6 +365,29 @@ function Game(props: GameProps) {
</button>
)}
</p>
<p>
<button
onClick={() => {
if (currentGuess.length >= minLength) {
if (dictionary.includes(currentGuess)) {
share(
`Link for word "${currentGuess.toUpperCase()}" copied to clipboard!`,
"I created this challenge for you!",
currentGuess
);
} else {
setHint("Not a valid word");
}
} else if (currentGuess.length > 0) {
setHint("Too short");
} else {
setHint("Please make a guess first");
}
}}
>
Create a custom game from current guess
</button>
</p>
</div>
);
}