-
Notifications
You must be signed in to change notification settings - Fork 0
Develop #71
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
Merged
Merged
Develop #71
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
adf9a21
intro page and updates
d222f04
Finalize unresolved merge
45dc0a2
login button fix, routing issue
6508f8a
triggers
OutsideofemiT 4273fc9
fixed merge conflicts
a5fe3a3
debug
OutsideofemiT c60eb2e
Dan is no longer hiding, he's not on the right, but the left will do!
OutsideofemiT 03bf879
Dr Dan is no longer hiding, he appears on the left, but it will have …
OutsideofemiT 1526354
Merge pull request #70 from Treevyy/DrDanisHiding
OutsideofemiT 221b2bf
Merge branch 'develop' into frontend/fixes
shawnachirillo 5e259ab
Merge pull request #68 from Treevyy/frontend/fixes
OutsideofemiT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // src/Utils/useBodyClass.ts | ||
| import { useEffect } from 'react'; | ||
|
|
||
| export const useBodyClass = (className: string) => { | ||
| useEffect(() => { | ||
| console.log(`✅applying body class: ${className}`); | ||
|
|
||
| document.body.classList.add(className); | ||
| return () => { | ||
| document.body.classList.remove(className); | ||
| }; | ||
| }, [className]); | ||
| }; |
This file contains hidden or 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,59 +1,56 @@ | ||
| import { useEffect, useState } from 'react'; | ||
| import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '../components/ui/dialog'; | ||
| import SoundPlayer from './SoundPlayer'; | ||
| import { useEffect, useState } from "react"; | ||
| import SoundPlayer from "./SoundPlayer"; | ||
| import ReactDOM from "react-dom"; | ||
|
|
||
| interface AnswerResultModalProps { | ||
| isOpen: boolean; | ||
| onClose: () => void; | ||
| isCorrect: boolean; | ||
| drDanQuote: string; | ||
| audioUrl?: string; | ||
| } | ||
|
|
||
| const AnswerResultModal = ({ | ||
| isOpen, | ||
| onClose, | ||
| isCorrect, | ||
| drDanQuote, | ||
| audioUrl, | ||
| }: AnswerResultModalProps) => { | ||
| const [playAudio, setPlayAudio] = useState(false); | ||
|
|
||
| // ✅ Start or stop audio based on modal open state | ||
| useEffect(() => { | ||
| if (isOpen) { | ||
| setPlayAudio(true); | ||
| } else { | ||
| setPlayAudio(false); | ||
| } | ||
| }, [isOpen]); | ||
|
|
||
| return ( | ||
| <Dialog open={isOpen} onOpenChange={(open) => { if (!open) onClose(); }}> | ||
| <DialogContent className="rounded-2xl shadow-xl text-center"> | ||
| <DialogHeader> | ||
| <DialogTitle className={`text-2xl font-bold ${isCorrect ? 'text-green-500' : 'text-red-500'}`}> | ||
| {isCorrect ? "Correct!" : "Wrong!"} | ||
| </DialogTitle> | ||
| <DialogDescription className="text-lg mt-2"> | ||
| {drDanQuote} | ||
| </DialogDescription> | ||
| </DialogHeader> | ||
|
|
||
| {/* ✅ Use Howler to play full clip, then close modal */} | ||
| {audioUrl && ( | ||
| <SoundPlayer | ||
| src={audioUrl} | ||
| playing={playAudio} | ||
| onEnd={() => { | ||
| setPlayAudio(false); | ||
| onClose(); | ||
| }} | ||
| /> | ||
| )} | ||
| </DialogContent> | ||
| </Dialog> | ||
| if (!isOpen) return null; | ||
|
|
||
| const drDanImage = isCorrect | ||
| ? "/avatars/DrDanCorrect.png" | ||
| : "/avatars/DrDanWrong.png"; | ||
|
|
||
| const modalContent = ( | ||
| <div className="fixed top-1/2 right-4 transform -translate-y-1/2 z-[9999] w-[200px] flex flex-col items-center gap-2 animate-fadeIn pointer-events-none"> | ||
| <img | ||
| src={drDanImage} | ||
| alt="Dr. Dan" | ||
| className="w-[160px] h-auto object-contain" | ||
| /> | ||
| {audioUrl && ( | ||
| <SoundPlayer | ||
| src={audioUrl} | ||
| playing={playAudio} | ||
| onEnd={() => { | ||
| setPlayAudio(false); | ||
| onClose(); | ||
| }} | ||
| /> | ||
| )} | ||
| </div> | ||
| ); | ||
|
|
||
| return ReactDOM.createPortal(modalContent, document.body); | ||
| }; | ||
|
|
||
| export default AnswerResultModal; | ||
| //commiting" | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import React, { useState, useEffect, useRef } from 'react'; | ||
| import { useNavigate } from 'react-router-dom'; | ||
| import { useBodyClass } from '../../Utils/useBodyClass'; | ||
| import "../../styles/codezilla.css"; | ||
|
|
||
| const IntroPage: React.FC = () => { | ||
| const navigate = useNavigate(); | ||
| const videoRef = useRef<HTMLVideoElement | null>(null); | ||
| const [hasClicked, setHasClicked] = useState(false); | ||
| useBodyClass('intro-background'); | ||
|
|
||
| const handleVideoEnd = () => { | ||
| navigate('/login'); | ||
| }; | ||
|
|
||
| const handleUserClick = () => { | ||
| if (videoRef.current && !hasClicked) { | ||
| videoRef.current.muted = false; | ||
| videoRef.current.play(); | ||
| setHasClicked(true); | ||
| } | ||
| }; | ||
|
|
||
| useEffect(() => { | ||
| document.addEventListener('click', handleUserClick); | ||
| return () => document.removeEventListener('click', handleUserClick); | ||
| }, [hasClicked]); | ||
|
|
||
| return ( | ||
| <div className="intro-overlay"> | ||
| <video | ||
| ref={videoRef} | ||
| className="intro-video" | ||
| autoPlay | ||
| muted | ||
| playsInline | ||
| onEnded={handleVideoEnd} | ||
| > | ||
| <source src="/codezilla_intro.mp4" type="video/mp4" /> | ||
| Your browser does not support the video tag. | ||
| </video> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default IntroPage; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a stray comment at the end of the file that appears to be unintentional. It is recommended to remove this comment to clean up the code.