Skip to content

Commit

Permalink
Fixed share tweet issue for hardcore mode
Browse files Browse the repository at this point in the history
  • Loading branch information
IyanRobles committed May 6, 2024
1 parent 3c0363b commit 5472d05
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion webapp/public/assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"play_again": "Play Again",
"go_back_button": "Go Back",
"xshare_button": "Share your results",
"tweetShare": "---- 🤔 Know and Win 🤔 ----%0A%0AI have correctly answered {{correct}}/{{total}} questions and earned {{points}} points 💪💪%0ACome and play this incredible trivia game and try to beat me!! 😎%0A"
"tweetShare": "---- 🤔 Know and Win 🤔 ----%0A%0AI have correctly answered {{xresult}} questions and earned {{points}} points 💪💪%0ACome and play this incredible trivia game and try to beat me!! 😎%0A"
}
},
"home": {
Expand Down
2 changes: 1 addition & 1 deletion webapp/public/assets/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"play_again": "Jugar de nuevo",
"go_back_button": "Volver",
"xshare_button": "Comparte tu resultado",
"tweetShare": "---- 🤔 Saber y Ganar 🤔 ----%0A%0AHe respondido correctamente {{correct}}/{{total}} preguntas y he ganado {{points}} puntos 💪💪%0AVen y juega este increíble juego de preguntas e intenta vencerme!!😎%0A"
"tweetShare": "---- 🤔 Saber y Ganar 🤔 ----%0A%0AHe respondido correctamente {{xresult}} preguntas y he ganado {{points}} puntos 💪💪%0AVen y juega este increíble juego de preguntas e intenta vencerme!!😎%0A"
}
},
"home": {
Expand Down
2 changes: 1 addition & 1 deletion webapp/public/assets/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"play_again": "Rejouer",
"go_back_button": "Retour",
"xshare_button": "Partagez vos résultats",
"tweetShare": "---- 🤔 Know and Win 🤔 ----%0A%0AJ'ai répondu correctement à {{correct}}/{{total}} questions et j'ai gagné {{points}} points 💪💪%0AViens jouer à ça jeu-questionnaire incroyable et essayez de me battre!! 😎%0A"
"tweetShare": "---- 🤔 Know and Win 🤔 ----%0A%0AJ'ai répondu correctement à {{xresult}} questions et j'ai gagné {{points}} points 💪💪%0AViens jouer à ça jeu-questionnaire incroyable et essayez de me battre!! 😎%0A"
}
},
"home": {
Expand Down
2 changes: 1 addition & 1 deletion webapp/public/assets/locales/uk/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"play_again": "Грати знову",
"go_back_button": "Повернутися",
"xshare_button": "Поділіться своїми результатами",
"tweetShare": "---- 🤔 Знай і перемагай 🤔 ----%0A%0A Я правильно відповів на {{correct}}/{{total}} запитань і заробив {{points}} балів 💪💪%0A Приходь і грай у це неймовірна дрібниця і спробуй мене перемогти 😎%0A"
"tweetShare": "---- 🤔 Знай і перемагай 🤔 ----%0A%0A Я правильно відповів на {{xresult}} запитань і заробив {{points}} балів 💪💪%0A Приходь і грай у це неймовірна дрібниця і спробуй мене перемогти 😎%0A"
}
},
"home": {
Expand Down
7 changes: 4 additions & 3 deletions webapp/src/components/FinalResult/FinalResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const FinalResult = ({ result, quizLength, points, onPlayAgain, goBack }) => {
const { t } = useTranslation()

const tweetUrl = "https://twitter.com/intent/tweet"

// https://developer.twitter.com/en/docs/twitter-for-websites/tweet-button/overview
let tweetToShare = tweetUrl + "?text=" + t("play.result.tweetShare",{correct: result, total: quizLength, points: points})
let tweetToShare = tweetUrl + "?text=" + t("play.result.tweetShare",{xresult: quizLength === 0 ? result : result + "%2F" + quizLength, points: points})
tweetToShare += "&url=https://www.kawgame.xyz%0A"
tweetToShare += "&hashtags=kaw,wikidata,know,win,game"

Expand All @@ -24,7 +24,8 @@ const FinalResult = ({ result, quizLength, points, onPlayAgain, goBack }) => {
</p>
<p>{t('play.result.points', { points: points })}</p>
<Button onClick={onPlayAgain}>{t('play.result.play_again')}</Button>
<XButton href={tweetToShare} textShare={t('play.result.xshare_button')}></XButton>
<XButton href={tweetToShare} textShare={t('play.result.xshare_button')}>
</XButton>
<Button onClick={goBack} className="danger">
{t('play.result.go_back_button')}
</Button>
Expand Down

0 comments on commit 5472d05

Please sign in to comment.