-
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.
Fortschrittsbalken hinzugefügt und Design der Learn-Komponente verbes…
…sert
- Loading branch information
1 parent
9b9e7e4
commit 03ce314
Showing
11 changed files
with
410 additions
and
159 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,191 @@ | ||
.App { | ||
text-align: center; | ||
/* src/index.css oder src/App.css */ | ||
|
||
/* Globale Styles */ | ||
body { | ||
font-family: Arial, sans-serif; | ||
margin: 0; | ||
padding: 0; | ||
background-color: #f0f0f0; | ||
} | ||
|
||
.App-logo { | ||
height: 40vmin; | ||
pointer-events: none; | ||
.container { | ||
max-width: 800px; | ||
margin: 0 auto; | ||
padding: 20px; | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
.App-logo { | ||
animation: App-logo-spin infinite 20s linear; | ||
} | ||
/* Navigation Styles */ | ||
nav ul { | ||
list-style-type: none; | ||
padding: 0; | ||
background-color: #333; | ||
} | ||
|
||
.App-header { | ||
background-color: #282c34; | ||
min-height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: calc(10px + 2vmin); | ||
nav ul li { | ||
display: inline-block; | ||
} | ||
|
||
nav ul li a, nav ul li button { | ||
color: white; | ||
text-decoration: none; | ||
padding: 10px 15px; | ||
display: inline-block; | ||
} | ||
|
||
nav ul li button { | ||
background: none; | ||
border: none; | ||
cursor: pointer; | ||
} | ||
|
||
/* Form Styles */ | ||
form { | ||
background-color: white; | ||
padding: 20px; | ||
border-radius: 5px; | ||
box-shadow: 0 0 10px rgba(0,0,0,0.1); | ||
} | ||
|
||
input[type="email"], input[type="password"] { | ||
width: 100%; | ||
padding: 10px; | ||
margin: 10px 0; | ||
border: 1px solid #ddd; | ||
border-radius: 4px; | ||
} | ||
|
||
button { | ||
background-color: #4CAF50; | ||
color: white; | ||
padding: 10px 15px; | ||
border: none; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
} | ||
|
||
button:hover { | ||
background-color: #45a049; | ||
} | ||
|
||
/* Learn Component Styles */ | ||
.learn-container { | ||
background-color: white; | ||
padding: 20px; | ||
border-radius: 5px; | ||
margin-top: 20px; | ||
} | ||
|
||
.question { | ||
margin-bottom: 20px; | ||
} | ||
|
||
.question-text { | ||
font-size: 1.2em; | ||
font-weight: bold; | ||
} | ||
|
||
.answer-list { | ||
list-style-type: none; | ||
padding: 0; | ||
} | ||
|
||
.answer-button { | ||
width: 100%; | ||
text-align: left; | ||
padding: 10px; | ||
margin: 5px 0; | ||
background-color: #e0e0e0; | ||
border: none; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
} | ||
|
||
.answer-button:hover { | ||
background-color: #d0d0d0; | ||
} | ||
|
||
.answer-button.selected { | ||
background-color: #b3e5fc; | ||
} | ||
|
||
.result { | ||
margin-top: 20px; | ||
padding: 10px; | ||
border-radius: 4px; | ||
} | ||
|
||
.result.correct { | ||
background-color: #c8e6c9; | ||
color: #2e7d32; | ||
} | ||
|
||
.result.incorrect { | ||
background-color: #ffcdd2; | ||
color: #c62828; | ||
} | ||
|
||
|
||
.progress-bar { | ||
display: flex; | ||
height: 20px; | ||
width: 100%; | ||
background-color: #e0e0e0; | ||
border-radius: 10px; | ||
overflow: hidden; | ||
margin: 20px 0; | ||
} | ||
|
||
.progress-segment { | ||
height: 100%; | ||
transition: width 0.3s ease; | ||
} | ||
|
||
.progress-segment.correct { | ||
background-color: #4caf50; | ||
} | ||
|
||
.progress-segment.incorrect { | ||
background-color: #f44336; | ||
} | ||
|
||
.progress-segment.unseen { | ||
background-color: #2196f3; | ||
} | ||
|
||
/* Verbesserungen für die Learn-Komponente */ | ||
.learn-container { | ||
background-color: white; | ||
border-radius: 8px; | ||
box-shadow: 0 2px 4px rgba(0,0,0,0.1); | ||
padding: 20px; | ||
margin-top: 20px; | ||
} | ||
|
||
.App-link { | ||
color: #61dafb; | ||
.question-text { | ||
font-size: 1.2em; | ||
font-weight: bold; | ||
margin-bottom: 15px; | ||
} | ||
|
||
@keyframes App-logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
.answer-button { | ||
transition: background-color 0.3s ease; | ||
} | ||
|
||
.answer-button:hover { | ||
background-color: #e8e8e8; | ||
} | ||
|
||
.answer-button.selected { | ||
background-color: #bbdefb; | ||
} | ||
|
||
.result { | ||
padding: 15px; | ||
border-radius: 4px; | ||
margin-top: 20px; | ||
font-weight: bold; | ||
} | ||
|
||
.next-button { | ||
margin-top: 15px; | ||
} |
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,30 +1,61 @@ | ||
import React from 'react'; | ||
import { BrowserRouter as Router, Route, Routes, Link } from 'react-router-dom'; | ||
import Home from './components/Home'; | ||
import Learn from './components/Learn'; | ||
import Quiz from './components/Quiz'; | ||
import './App.css'; | ||
import './App.css'; // oder './index.css', je nachdem, wie Ihre Datei heißt | ||
import React, { useState, useEffect } from 'react'; | ||
import { BrowserRouter as Router, Route, Routes, Link } from 'react-router-dom'; | ||
import { onAuthStateChanged, signOut } from "firebase/auth"; | ||
import { auth } from './firebase'; | ||
import Learn from './components/Learn'; | ||
import Auth from './components/Auth'; | ||
import ProgressDisplay from './components/ProgressDisplay'; | ||
|
||
function App() { | ||
return ( | ||
<Router> | ||
<div className="App"> | ||
<nav> | ||
<ul> | ||
<li><Link to="/">Home</Link></li> | ||
<li><Link to="/learn">Lernen</Link></li> | ||
<li><Link to="/quiz">Quiz</Link></li> | ||
</ul> | ||
</nav> | ||
function App() { | ||
const [user, setUser] = useState(null); | ||
|
||
<Routes> | ||
<Route path="/" element={<Home />} /> | ||
<Route path="/learn" element={<Learn />} /> | ||
<Route path="/quiz" element={<Quiz />} /> | ||
</Routes> | ||
</div> | ||
</Router> | ||
); | ||
} | ||
useEffect(() => { | ||
const unsubscribe = onAuthStateChanged(auth, (currentUser) => { | ||
setUser(currentUser); | ||
}); | ||
return () => unsubscribe(); | ||
}, []); | ||
|
||
export default App; | ||
const handleLogout = () => { | ||
signOut(auth).then(() => { | ||
setUser(null); | ||
}).catch((error) => { | ||
console.error("Logout error", error); | ||
}); | ||
}; | ||
|
||
return ( | ||
<Router> | ||
<div> | ||
{!user ? ( | ||
<Auth onLogin={setUser} /> | ||
) : ( | ||
<> | ||
<nav> | ||
<ul> | ||
<li><Link to="/">Home</Link></li> | ||
<li><Link to="/learn">Lernen</Link></li> | ||
<li><Link to="/progress">Fortschritt</Link></li> | ||
<li><button onClick={handleLogout}>Abmelden</button></li> | ||
</ul> | ||
</nav> | ||
<Routes> | ||
<Route path="/learn" element={<Learn />} /> | ||
<Route path="/progress" element={<ProgressDisplay />} /> | ||
<Route path="/" element={ | ||
<> | ||
<h1>Willkommen zur Palliative Care Learner App, {user.email}!</h1> | ||
<p>Wählen Sie "Lernen" um Fragen zu beantworten oder "Fortschritt" um Ihren Fortschritt zu sehen.</p> | ||
</> | ||
} /> | ||
</Routes> | ||
</> | ||
)} | ||
</div> | ||
</Router> | ||
); | ||
} | ||
|
||
export default App; | ||
|
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React, { useState } from 'react'; | ||
import { signInWithEmailAndPassword, createUserWithEmailAndPassword } from "firebase/auth"; | ||
import { auth } from '../firebase'; | ||
|
||
function Auth({ onLogin }) { | ||
const [email, setEmail] = useState(''); | ||
const [password, setPassword] = useState(''); | ||
const [isRegistering, setIsRegistering] = useState(false); | ||
const [error, setError] = useState(null); | ||
|
||
const handleSubmit = async (e) => { | ||
e.preventDefault(); | ||
setError(null); | ||
try { | ||
let userCredential; | ||
if (isRegistering) { | ||
userCredential = await createUserWithEmailAndPassword(auth, email, password); | ||
} else { | ||
userCredential = await signInWithEmailAndPassword(auth, email, password); | ||
} | ||
onLogin(userCredential.user); | ||
} catch (error) { | ||
setError(error.message); | ||
} | ||
}; | ||
|
||
return ( | ||
<form onSubmit={handleSubmit}> | ||
<h2>{isRegistering ? 'Registrieren' : 'Anmelden'}</h2> | ||
{error && <p style={{color: 'red'}}>{error}</p>} | ||
<div> | ||
<label htmlFor="email">E-Mail:</label> | ||
<input | ||
type="email" | ||
id="email" | ||
value={email} | ||
onChange={(e) => setEmail(e.target.value)} | ||
required | ||
/> | ||
</div> | ||
<div> | ||
<label htmlFor="password">Passwort:</label> | ||
<input | ||
type="password" | ||
id="password" | ||
value={password} | ||
onChange={(e) => setPassword(e.target.value)} | ||
required | ||
/> | ||
</div> | ||
<button type="submit">{isRegistering ? 'Registrieren' : 'Anmelden'}</button> | ||
<button type="button" onClick={() => setIsRegistering(!isRegistering)}> | ||
{isRegistering ? 'Zurück zur Anmeldung' : 'Neuen Account erstellen'} | ||
</button> | ||
</form> | ||
); | ||
} | ||
|
||
export default Auth; |
Oops, something went wrong.