Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix presa di mira una persona #115

Merged
merged 1 commit into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions Scoprimi/src/components/game/QuestionComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,20 @@ interface QuestionProps {

const placeholderChar = '$';

const QuestionComponent: React.FC<QuestionProps> = ({ question, selectedPlayer }) => (
<div id="questionContainer">
<h4 id="question">{question.replace(placeholderChar, selectedPlayer)}</h4>
</div>
);
const QuestionComponent: React.FC<QuestionProps> = ({ question, selectedPlayer }) => {
// Sostituisce il placeholder con il nome del giocatore e `\n` con `<br />`
const formattedQuestion = question
.replace(placeholderChar, selectedPlayer)
.replace(/\n/g, '<br />');

return (
<div id="questionContainer">
<h4
id="question"
dangerouslySetInnerHTML={{ __html: formattedQuestion }}
/>
</div>
);
};

export default QuestionComponent;
12 changes: 6 additions & 6 deletions Server/src/questions.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@
"concert£Di quale artista $ andrebbe al concerto?"
],
"who": [
"Cosa direbbe $: Dai mamma! Esci dalla stanza che mi sto ...!?",
"Cosa direbbe $: Il peggior film da mettere quando vuoi fare Netflix & Chill",
"Cosa direbbe $: Un risultato notevole che non metteresti sul curriculum",
"Cosa direbbe $: L'ultima cosa che vedi prima di saltare in aria",
"Cosa direbbe $: Non volevo ucciderlo! È solo che ...",
"Cosa direbbe $: Il nome di un insegnante che sai che odieresti all'istante"
"Cosa risponderebbe $? \n Dai mamma! Esci dalla stanza che mi sto ...!?",
"Cosa risponderebbe $? \n Il peggior film da mettere quando vuoi fare Netflix & Chill",
"Cosa risponderebbe $? \n Un risultato notevole che non metteresti sul curriculum",
"Cosa risponderebbe $? \n L'ultima cosa che vedi prima di saltare in aria",
"Cosa risponderebbe $? \n Non volevo ucciderlo! È solo che ...",
"Cosa risponderebbe $? \n Il nome di un insegnante che sai che odieresti all'istante"
]
}
Loading