-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- now uses a markdown file per question - supports inline and block code fences - supports proper markdown parsing - add timed question option - add difficulty option - add optional intro and outro sections for questions - display the selected and correct answer if the user chooses the incorrect answer - add a share your score option to the completion and game over screens
- Loading branch information
Showing
13 changed files
with
473 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,62 @@ | ||
import React from 'react'; | ||
import { Share2 } from 'lucide-react'; | ||
import { Button } from '@/components/ui/button'; | ||
import { Card, CardContent, CardFooter, CardHeader } from '@/components/ui/card'; | ||
import { Badge } from '@/components/ui/badge'; | ||
import ConfettiCelebration from '@/components/ConfettiCelebration'; | ||
import { config } from '@/config'; | ||
|
||
interface CompletionProps { | ||
score: number; | ||
badges: string[]; | ||
onReset: () => void; | ||
} | ||
|
||
const Completion: React.FC<CompletionProps> = ({ score, badges, onReset }) => ( | ||
<div className="flex flex-col items-center justify-center h-screen bg-gray-100"> | ||
<ConfettiCelebration /> | ||
<Card className="w-full max-w-md"> | ||
<CardHeader> | ||
<h1 className="text-2xl font-bold text-center">🎉 Congratulations! 🎉</h1> | ||
</CardHeader> | ||
<CardContent> | ||
<p className="text-center mb-4">You've become an OpenEHR Integration Master!</p> | ||
<p className="text-center mb-4"> | ||
Final Score: | ||
{score} | ||
</p> | ||
<div className="mt-4"> | ||
You've earned the following badges: | ||
<div className="flex flex-wrap gap-2 mt-4"> | ||
{badges.map(badge => ( | ||
<Badge key={`badge-${badge}`} variant="secondary"> | ||
{badge} | ||
</Badge> | ||
))} | ||
const Completion: React.FC<CompletionProps> = ({ score, badges, onReset }) => { | ||
const shareResults = () => { | ||
const badgeText = badges.length === 1 ? 'badge' : 'badges'; | ||
const text = `I just completed the ${config.title} with a score of ${score} and earned ${badges.length} ${badgeText}! Create your own quest here https://github.com/gmickel/codequest or try to beat my score?`; | ||
const url = config.url; | ||
const shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}&url=${encodeURIComponent(url)}&hashtags=CodeQuest`; | ||
window.open(shareUrl, '_blank'); | ||
}; | ||
return ( | ||
<div className="flex flex-col items-center justify-center h-screen bg-gray-100"> | ||
<ConfettiCelebration /> | ||
<Card className="w-full max-w-md"> | ||
<CardHeader> | ||
<h1 className="text-2xl font-bold text-center">🎉 Congratulations! 🎉</h1> | ||
</CardHeader> | ||
<CardContent> | ||
<p className="text-center mb-4">You've become an OpenEHR Integration Master!</p> | ||
<p className="text-center mb-4"> | ||
Final Score: | ||
{score} | ||
</p> | ||
<div className="mt-4"> | ||
You've earned the following badges: | ||
<div className="flex flex-wrap gap-2 mt-4"> | ||
{badges.map(badge => ( | ||
<Badge key={`badge-${badge}`} variant="secondary"> | ||
{badge} | ||
</Badge> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
</CardContent> | ||
<CardFooter> | ||
<Button onClick={onReset} className="w-full"> | ||
Play Again | ||
</Button> | ||
</CardFooter> | ||
</Card> | ||
</div> | ||
); | ||
</CardContent> | ||
<CardFooter className="flex flex-col space-y-2"> | ||
<Button onClick={shareResults} className="w-full bg-blue-500 hover:bg-blue-600 text-white"> | ||
<Share2 className="mr-2 h-4 w-4" /> | ||
{' '} | ||
Share Results | ||
</Button> | ||
<Button onClick={onReset} variant="outline" className="w-full"> | ||
Play Again | ||
</Button> | ||
</CardFooter> | ||
</Card> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Completion; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,50 @@ | ||
import React from 'react'; | ||
import { Share2 } from 'lucide-react'; | ||
import { Button } from '@/components/ui/button'; | ||
import { Card, CardContent, CardFooter, CardHeader } from '@/components/ui/card'; | ||
import { config } from '@/config'; | ||
|
||
interface GameOverProps { | ||
score: number; | ||
badges: string[]; | ||
onReset: () => void; | ||
} | ||
|
||
const GameOver: React.FC<GameOverProps> = ({ score, onReset }) => ( | ||
<div className="flex flex-col items-center justify-center h-screen bg-gray-100"> | ||
<Card className="w-full max-w-md"> | ||
<CardHeader> | ||
<h1 className="text-2xl font-bold text-center">Game Over</h1> | ||
</CardHeader> | ||
<CardContent> | ||
<p className="text-center mb-4">Your OpenEHR journey has come to an end.</p> | ||
<p className="text-center mb-4"> | ||
Final Score: | ||
{score} | ||
</p> | ||
</CardContent> | ||
<CardFooter> | ||
<Button onClick={onReset} className="w-full"> | ||
Try Again | ||
</Button> | ||
</CardFooter> | ||
</Card> | ||
</div> | ||
); | ||
const GameOver: React.FC<GameOverProps> = ({ score, onReset, badges }) => { | ||
const shareResults = () => { | ||
const badgeText = badges.length === 1 ? 'badge' : 'badges'; | ||
const text = `I just completed the ${config.title} with a score of ${score} and earned ${badges.length} ${badgeText}! Create your own quest here https://github.com/gmickel/codequest or try to beat my score?`; | ||
const url = config.url; | ||
const shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}&url=${encodeURIComponent(url)}&hashtags=CodeQuest`; | ||
window.open(shareUrl, '_blank'); | ||
}; | ||
|
||
return ( | ||
<div className="flex flex-col items-center justify-center h-screen bg-gray-100"> | ||
<Card className="w-full max-w-md"> | ||
<CardHeader> | ||
<h1 className="text-2xl font-bold text-center">Game Over</h1> | ||
</CardHeader> | ||
<CardContent> | ||
<p className="text-center mb-4">Your OpenEHR journey has come to an end.</p> | ||
<p className="text-center mb-4"> | ||
Final Score: | ||
{score} | ||
</p> | ||
</CardContent> | ||
<CardFooter className="flex flex-col space-y-2"> | ||
<Button onClick={shareResults} className="w-full bg-blue-500 hover:bg-blue-600 text-white"> | ||
<Share2 className="mr-2 h-4 w-4" /> | ||
{' '} | ||
Share Results | ||
</Button> | ||
<Button onClick={onReset} variant="outline" className="w-full"> | ||
Try Again | ||
</Button> | ||
</CardFooter> | ||
</Card> | ||
</div> | ||
); | ||
}; | ||
|
||
export default GameOver; |
Oops, something went wrong.