update styling of subject page

This commit is contained in:
Eric Blommel
2024-11-18 22:13:45 +01:00
parent 32fb286728
commit 4d15af1803
7 changed files with 436 additions and 799 deletions

View File

@@ -87,7 +87,7 @@
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
} }
/* Impressum page styles */ /* Imprint page styles */
.content { .content {
margin: auto; margin: auto;
padding: 2rem; padding: 2rem;

View File

@@ -0,0 +1,399 @@
/* Subject page styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
body {
background-color: var(--bg-color);
min-height: 100vh;
display: flex;
overflow-x: hidden;
}
.sidebar {
width: 280px;
height: 100vh;
padding: 2rem;
position: fixed;
left: 0;
top: 0;
transition: transform 0.3s ease;
z-index: 50;
}
.sidebar-header {
color: white;
margin-bottom: 2rem;
display: flex;
align-items: center;
gap: 1rem;
}
.sidebar-header i {
font-size: 2rem;
}
.nav-link {
display: flex;
align-items: center;
padding: 1rem;
color: rgba(255, 255, 255, 0.8);
text-decoration: none;
border-radius: 12px;
margin-bottom: 0.5rem;
transition: all 0.2s ease;
}
.nav-link:hover {
background: rgba(255, 255, 255, 0.1);
color: white;
transform: translateX(5px);
}
.nav-link i {
margin-right: 1rem;
font-size: 1.25rem;
}
.search-container {
position: fixed;
top: 0;
right: 0;
padding: 1rem;
background: var(--card-bg);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
z-index: 40;
display: flex;
align-items: center;
gap: 1rem;
transition: all 0.3s ease;
width: auto;
}
.search-box {
flex: 1;
padding: 0.75rem 1rem;
border: 2px solid #E2E8F0;
border-radius: 12px;
outline: none;
font-size: 1rem;
transition: all 0.2s ease;
background: var(--bg-color);
}
.main-content {
margin-left: 280px;
width: calc(100% - 280px);
padding-top: 5rem;
transition: margin-left 0.3s ease;
}
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); /* Back to original 380px for desktop */
gap: 2rem; /* Back to original 2rem gap */
padding: 2rem;
max-width: 1600px;
margin: 0 auto;
width: 100%;
}
.topic-card {
background: var(--card-bg);
border-radius: 20px;
padding: 2rem;
position: relative;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
transform: translateY(0);
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.topic-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 5px;
transform: scaleX(0);
transform-origin: left;
}
.topic-card:hover {
transform: translateY(-5px);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.topic-card:hover::before {
transform: scaleX(1);
}
.topic-header {
display: flex;
align-items: center;
margin-bottom: 1.5rem;
position: relative;
}
.topic-icon {
font-size: 2.5rem;
margin-right: 1rem;
}
.topic-title {
font-size: 1.5rem;
font-weight: 600;
margin-bottom: 0.5rem;
}
.topic-description {
font-size: 1rem;
line-height: 1.7;
margin-bottom: 1.5rem;
}
.related-topics {
margin: 0;
}
.download-section {
margin-top: auto;
}
.progress-container {
margin-top: 1.5rem;
}
.download-section h4 {
margin-bottom: 1rem;
font-size: 1rem;
}
.download-links {
display: flex;
gap: 1rem;
flex-wrap: wrap;
}
.download-btn {
padding: 0.75rem 1.25rem;
border-radius: 10px;
text-decoration: none;
font-size: 0.9rem;
transition: all 0.2s ease;
backdrop-filter: blur(5px);
flex: 1;
min-width: 120px;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
transform: translateY(0); /* Set initial transform state */
transition: all 0.2s ease;
}
.download-btn:hover {
transform: translateY(-2px);
}
@media (min-width: 1025px) {
.menu-toggle {
display: none;
}
.sidebar {
transform: translateX(0);
}
.search-container {
left: 280px; /* Sidebar width */
width: calc(100% - 280px);
}
.main-content {
margin-left: 280px;
width: calc(100% - 280px);
}
}
@media (max-width: 1024px) {
.search-container {
width: 100%;
}
.menu-toggle {
display: flex !important;
}
.sidebar {
transform: translateX(-100%);
}
.sidebar.active {
transform: translateX(0);
}
.main-content {
margin-left: 0;
width: 100%;
}
}
@media (max-width: 480px) {
.search-container {
padding: 0.75rem;
}
.search-box {
font-size: 0.9rem;
padding: 0.5rem 0.75rem;
}
.download-links {
flex-direction: column;
}
.download-btn {
width: 100%;
}
.container {
padding: 0.5rem;
}
.topic-card {
margin: 0 0.5rem;
}
}
.menu-toggle {
padding: 0.75rem;
border-radius: 10px;
cursor: pointer;
display: none;
align-items: center;
justify-content: center;
color: var(--text-primary);
transition: all 0.3s ease;
}
/* Add floating animation for icons */
@keyframes float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10px); }
}
.theme-toggle:hover {
transform: rotate(45deg);
}
/* Update animation keyframes */
@keyframes cardAppear {
0% {
opacity: 0;
transform: translateY(20px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
.download-section h4 {
margin-bottom: 1rem;
font-size: 1rem;
}
.download-links {
display: flex;
gap: 1rem;
flex-wrap: wrap;
}
.download-btn {
color: white;
padding: 0.75rem 1.25rem;
border-radius: 10px;
text-decoration: none;
font-size: 0.9rem;
transition: all 0.2s ease;
backdrop-filter: blur(5px);
flex: 1;
min-width: 120px;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
}
.download-btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
/* Add these styles for the related-topics section */
.related-topics {
padding: 1.25rem;
border-radius: 12px;
margin-bottom: 1.5rem;
}
.related-topics h4 {
color: var(--primary-color);
margin-bottom: 1rem;
font-size: 1rem;
}
.related-topics ul {
list-style: none;
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.related-topics li {
background: white;
padding: 0.5rem 1rem;
border-radius: 20px;
font-size: 0.9rem;
transition: all 0.2s ease;
cursor: pointer;
}
.related-topics li:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.related-topics a {
color: inherit;
text-decoration: none;
}
/* Improved topic card hover */
.topic-card {
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.topic-card:hover {
transform: translateY(-5px) scale(1.01);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}
/* Active nav link style */
.nav-link.active {
background: rgba(255, 255, 255, 0.15);
color: white;
font-weight: 600;
}

View File

@@ -1,7 +1,7 @@
{ {
"displayName": "Deutsch", "displayName": "Deutsch",
"description": "Deutsch ist blau", "description": "Deutsch ist rot",
"color": "#FF0000", "color": "#ef4444",
"buttonText": "Erfahre von einem ungeheuren Ungeziefer", "buttonText": "Erfahre von einem ungeheuren Ungeziefer",
"icon": "fa-book" "icon": "fa-book"
} }

View File

@@ -1,7 +1,7 @@
{ {
"displayName": "Mathe", "displayName": "Mathe",
"description": "Mathe ist gelb", "description": "Mathe ist blau",
"color": "#60A5FA", "color": "#3b82f6",
"buttonText": "Jetzt rechnen!", "buttonText": "Jetzt rechnen!",
"icon": "fa-square-root-alt" "icon": "fa-square-root-alt"
} }

View File

@@ -4,11 +4,11 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Modernes Lernportal</title> <title>HSGG Lernportal</title>
<link rel="icon" href="assets/images/favicon.ico" type="image/x-icon"> <link rel="icon" href="assets/images/favicon.ico" type="image/x-icon">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<link href="assets/css/styles.css" rel="stylesheet"> <link href="assets/css/styles.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.tailwindcss.com"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</head> </head>

View File

@@ -1,14 +1,14 @@
<!DOCTYPE html> <!DOCTYPE html>
<?php <?php
require_once ("classes/SubjectData.php"); require_once("classes/SubjectData.php");
require_once ("classes/TopicData.php"); require_once("classes/TopicData.php");
if(!isset($_GET["subject"])) { if (!isset($_GET["subject"])) {
die("Ungültige Seite"); die("Ungültige Seite");
} }
$subjectData = SubjectData::fromName($_GET["subject"]); $subjectData = SubjectData::fromName($_GET["subject"]);
if(!isset($subjectData)) { if (!isset($subjectData)) {
die("Ungültige Seite"); die("Ungültige Seite");
} }
$topics = $subjectData->topics; $topics = $subjectData->topics;
@@ -19,590 +19,36 @@ $topics = $subjectData->topics;
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo($subjectData->displayName); ?> 5. Klasse - Modern</title> <title><?php echo($subjectData->displayName); ?> 5. Klasse</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<link href="assets/css/subject.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
:root {
--primary: #7C3AED;
--primary-light: #9F67FF;
--primary-dark: #6D28D9;
--bg-color: #F4F7FE;
--card-bg: #ffffff;
--text-primary: #1E293B;
--text-secondary: #64748B;
--accent: #F59E0B;
}
/* Add this right after the existing :root {...} block in the style section */
:root[data-theme="dark"] {
--primary: #9F67FF;
--primary-light: #B794F4;
--primary-dark: #7C3AED;
--bg-color: #1A1A2E;
--card-bg: #1E293B;
--text-primary: #E2E8F0;
--text-secondary: #A0AEC0;
--accent: #F59E0B;
}
body {
background-color: var(--bg-color);
min-height: 100vh;
display: flex;
overflow-x: hidden;
}
.sidebar {
width: 280px;
height: 100vh;
background: var(--primary);
padding: 2rem;
position: fixed;
left: 0;
top: 0;
transition: transform 0.3s ease;
z-index: 50;
}
.sidebar-header {
color: white;
margin-bottom: 2rem;
display: flex;
align-items: center;
gap: 1rem;
}
.sidebar-header i {
font-size: 2rem;
}
.nav-link {
display: flex;
align-items: center;
padding: 1rem;
color: rgba(255, 255, 255, 0.8);
text-decoration: none;
border-radius: 12px;
margin-bottom: 0.5rem;
transition: all 0.2s ease;
}
.nav-link:hover {
background: rgba(255, 255, 255, 0.1);
color: white;
transform: translateX(5px);
}
.nav-link i {
margin-right: 1rem;
font-size: 1.25rem;
}
.search-container {
position: fixed;
top: 0;
right: 0;
padding: 1rem;
background: var(--card-bg);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
z-index: 40;
display: flex;
align-items: center;
gap: 1rem;
transition: all 0.3s ease;
width: auto;
}
.search-box {
flex: 1;
padding: 0.75rem 1rem;
border: 2px solid #E2E8F0;
border-radius: 12px;
outline: none;
font-size: 1rem;
transition: all 0.2s ease;
background: var(--bg-color);
}
.search-box:focus {
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}
.main-content {
margin-left: 280px;
width: calc(100% - 280px);
padding-top: 5rem;
transition: margin-left 0.3s ease;
}
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); /* Back to original 380px for desktop */
gap: 2rem; /* Back to original 2rem gap */
padding: 2rem;
max-width: 1600px;
margin: 0 auto;
width: 100%;
}
.topic-card {
background: var(--card-bg);
border-radius: 20px;
padding: 2rem;
position: relative;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
transform: translateY(0);
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.topic-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 5px;
background: linear-gradient(90deg, var(--primary), var(--accent));
transform: scaleX(0);
transform-origin: left;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.topic-card:hover {
transform: translateY(-5px);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.topic-card:hover::before {
transform: scaleX(1);
}
.topic-header {
display: flex;
align-items: center;
margin-bottom: 1.5rem;
position: relative;
}
.topic-icon {
font-size: 2.5rem;
color: var(--primary);
margin-right: 1rem;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.topic-card:hover .topic-icon {
transform: rotate(-10deg);
color: var(--accent);
}
.topic-title {
font-size: 1.5rem;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 0.5rem;
}
.topic-description {
font-size: 1rem;
color: var(--text-secondary);
line-height: 1.7;
margin-bottom: 1.5rem;
}
.related-topics {
margin: 0;
}
.download-section {
margin-top: auto;
}
.progress-container {
margin-top: 1.5rem;
}
.download-section h4 {
margin-bottom: 1rem;
font-size: 1rem;
}
.download-links {
display: flex;
gap: 1rem;
flex-wrap: wrap;
}
.download-btn {
background: rgba(255, 255, 255, 0.1);
color: white;
padding: 0.75rem 1.25rem;
border-radius: 10px;
text-decoration: none;
font-size: 0.9rem;
transition: all 0.2s ease;
backdrop-filter: blur(5px);
flex: 1;
min-width: 120px;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
transform: translateY(0); /* Set initial transform state */
transition: all 0.2s ease;
}
.download-btn:hover {
transform: translateY(-2px);
background: rgba(255, 255, 255, 0.2);
}
.progress-label {
display: flex;
justify-content: space-between;
margin-bottom: 0.5rem;
font-size: 0.9rem;
color: var(--text-secondary);
}
.progress-bar {
height: 8px;
background: #E2E8F0;
border-radius: 4px;
overflow: hidden;
}
.progress {
height: 100%;
background: linear-gradient(90deg, var(--primary), var(--accent));
border-radius: 4px;
width: 0%;
transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (min-width: 1025px) {
.menu-toggle {
display: none;
}
.sidebar {
transform: translateX(0);
}
.search-container {
left: 280px; /* Sidebar width */
width: calc(100% - 280px);
}
.main-content {
margin-left: 280px;
width: calc(100% - 280px);
}
}
@media (max-width: 1024px) {
.menu-toggle {
display: flex !important;
}
.sidebar {
transform: translateX(-100%);
}
.sidebar.active {
transform: translateX(0);
}
.search-container {
left: 0;
width: 100%;
padding-left: 4.5rem;
}
.main-content {
margin-left: 0;
width: 100%;
}
.search-box {
width: calc(100% - 2rem);
}
}
@media (max-width: 768px) {
.search-container {
padding: 1rem;
padding-left: 4.5rem;
}
.search-box {
width: 100%;
}
}
@media (max-width: 480px) {
.search-container {
padding: 0.75rem;
padding-left: 4rem; /* Keep space for menu icon */
}
.search-box {
font-size: 0.9rem;
padding: 0.5rem 0.75rem;
}
.download-links {
flex-direction: column;
}
.download-btn {
width: 100%;
}
.container {
padding: 0.5rem;
}
.topic-card {
margin: 0 0.5rem;
}
}
.menu-toggle {
position: fixed;
top: 1rem;
left: 1rem;
z-index: 60;
background: var(--card-bg);
border: none;
padding: 0.75rem;
border-radius: 10px;
cursor: pointer;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
width: 42px;
height: 42px;
display: none; /* Hidden by default */
align-items: center;
justify-content: center;
color: var(--text-primary);
transition: all 0.3s ease;
}
/* Add floating animation for icons */
@keyframes float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10px); }
}
/* Add theme toggle button styles */
.theme-toggle {
position: fixed;
top: 1rem;
right: 1rem;
z-index: 100;
background: var(--card-bg);
border: none;
padding: 0.75rem;
border-radius: 50%;
cursor: pointer;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
color: var(--text-primary);
transition: all 0.3s ease;
}
.theme-toggle:hover {
transform: rotate(45deg);
}
/* Update animation keyframes */
@keyframes cardAppear {
0% {
opacity: 0;
transform: translateY(20px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
/* Add these styles back for the download section */
.download-section {
background: linear-gradient(135deg, var(--primary-light), var(--primary));
padding: 1.5rem;
border-radius: 12px;
color: white;
margin-top: auto;
}
.download-section h4 {
margin-bottom: 1rem;
font-size: 1rem;
color: rgba(255, 255, 255, 0.9);
}
.download-links {
display: flex;
gap: 1rem;
flex-wrap: wrap;
}
.download-btn {
background: rgba(255, 255, 255, 0.1);
color: white;
padding: 0.75rem 1.25rem;
border-radius: 10px;
text-decoration: none;
font-size: 0.9rem;
transition: all 0.2s ease;
backdrop-filter: blur(5px);
flex: 1;
min-width: 120px;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
}
.download-btn:hover {
background: rgba(255, 255, 255, 0.2);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
/* Add these styles for the related-topics section */
.related-topics {
background: rgba(124, 58, 237, 0.05);
padding: 1.25rem;
border-radius: 12px;
margin-bottom: 1.5rem;
}
.related-topics h4 {
color: var(--primary);
margin-bottom: 1rem;
font-size: 1rem;
}
.related-topics ul {
list-style: none;
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.related-topics li {
background: white;
padding: 0.5rem 1rem;
border-radius: 20px;
font-size: 0.9rem;
color: var(--text-secondary);
border: 1px solid rgba(124, 58, 237, 0.2);
transition: all 0.2s ease;
cursor: pointer;
}
.related-topics li:hover {
background: var(--primary);
color: white;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.related-topics a {
color: inherit;
text-decoration: none;
}
/* Add dark mode support for related topics */
:root[data-theme="dark"] .related-topics {
background: rgba(124, 58, 237, 0.1);
}
:root[data-theme="dark"] .related-topics li {
background: var(--card-bg);
border-color: rgba(124, 58, 237, 0.3);
}
/* Improved search box */
.search-box {
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.search-box:focus {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}
/* Improved topic card hover */
.topic-card {
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.topic-card:hover {
transform: translateY(-5px) scale(1.01);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}
/* Improved icon animation */
.topic-icon {
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.topic-card:hover .topic-icon {
transform: scale(1.2) rotate(-10deg);
color: var(--accent);
}
/* Active nav link style */
.nav-link.active {
background: rgba(255, 255, 255, 0.15);
color: white;
font-weight: 600;
}
</style>
</head> </head>
<body> <body>
<button class="menu-toggle" onclick="toggleSidebar()">
<i class="fas fa-bars"></i>
</button>
<nav class="sidebar"> <nav class="sidebar bg-[<?php echo($subjectData->color); ?>]">
<div class="sidebar-header"> <div class="sidebar-header">
<i class="fas fa-graduation-cap"></i> <i class="fas fa-graduation-cap"></i>
<h2><?php echo($subjectData->displayName); ?></h2> <h2><?php echo($subjectData->displayName); ?></h2>
</div> </div>
<!-- Remove this section -->
<!-- <div class="accessibility-controls mb-4">...</div> -->
<a href="homepage.php" class="nav-link"> <a href="homepage.php" class="nav-link">
<i class="fas fa-home"></i> Homepage <i class="fas fa-home"></i> Startseite
</a> </a>
<a href="#" class="nav-link"> <a href="#" class="nav-link">
<i class="fas fa-book"></i> <?php echo($subjectData->displayName); ?> Übersicht <i class="fas fa-book"></i> <?php echo($subjectData->displayName); ?> Übersicht
</a> </a>
</nav> </nav>
<div class="search-container"> <div class="search-container bg-white">
<input type="text" class="search-box" id="searchInput" placeholder="Suche nach Themen, Übungen oder Hilfe..." oninput="handleSearch()"> <button class="menu-toggle h-12 w-12 border-2 p-1 hover:border-[<?php echo($subjectData->color); ?>]">
<i class="fas fa-bars"></i>
</button>
<input type="text" class="search-box p-3 border-2 w-full focus:border-[<?php echo($subjectData->color); ?>]" id="searchInput" placeholder="Suche nach Themen, Übungen oder Hilfe..."
oninput="handleSearch()">
</div> </div>
<div class="main-content"> <div class="main-content">
@@ -613,28 +59,30 @@ $topics = $subjectData->topics;
foreach ($topics as $topicData) { foreach ($topics as $topicData) {
?> ?>
<div class="topic-card" onclick="window.location.href='topic.php?subject=<?php echo($topicData->subjectId); ?>&topic=<?php echo($topicData->id); ?>'" style="cursor: pointer;"> <div class="topic-card"
onclick="window.location.href='topic.php?subject=<?php echo($topicData->subjectId); ?>&topic=<?php echo($topicData->id); ?>'"
style="cursor: pointer;">
<div class="topic-header"> <div class="topic-header">
<i class="fas <?php echo($topicData->icon); ?> topic-icon"></i> <i class="fas <?php echo($topicData->icon); ?> topic-icon text-[<?php echo($subjectData->color); ?>]"></i>
<h3 class="topic-title"><?php echo($topicData->displayName); ?></h3> <h3 class="topic-title"><?php echo($topicData->displayName); ?></h3>
</div> </div>
<div class="topic-content"> <div class="topic-content">
<p class="topic-description"> <p class="topic-description">
<?php echo($topicData->description); ?> <?php echo($topicData->description); ?>
</p> </p>
<div class="related-topics"> <div class="related-topics bg-gray-100">
<h4>Verwandte Themen:</h4> <h4>Verwandte Themen:</h4>
<ul> <ul>
<?php <?php
foreach ($topicData->relatedTopics as $relatedTopicName) { foreach ($topicData->relatedTopics as $relatedTopicName) {
$relatedTopic = $subjectData->topics[$relatedTopicName]; $relatedTopic = $subjectData->topics[$relatedTopicName];
if(!isset($relatedTopicName)) { if (!isset($relatedTopicName)) {
continue; continue;
} }
?> ?>
<li onclick="event.stopPropagation();"> <li onclick="event.stopPropagation();" class="border-[<?php echo($subjectData->color); ?>] border-2">
<a href='<?php echo("topic.php?subject=$subjectData->id&topic=$relatedTopic->id") ?>'> <a href='<?php echo("topic.php?subject=$subjectData->id&topic=$relatedTopic->id") ?>'>
<?php echo($relatedTopic->displayName); ?> <?php echo($relatedTopic->displayName); ?>
</a> </a>
@@ -653,7 +101,9 @@ $topics = $subjectData->topics;
foreach ($topicData->files as $fileName) { foreach ($topicData->files as $fileName) {
?> ?>
<a onclick="event.stopPropagation();" href="<?php echo("config/subjects/$subjectData->id/topics/$topicData->id/$fileName")?>" target="_blank" download class="download-btn"> <a onclick="event.stopPropagation();"
href="<?php echo("config/subjects/$subjectData->id/topics/$topicData->id/$fileName") ?>"
target="_blank" download class="download-btn bg-[<?php echo($subjectData->color); ?>]">
<i class="fas fa-file-pdf"></i> <i class="fas fa-file-pdf"></i>
<?php echo($fileName); ?> <?php echo($fileName); ?>
</a> </a>
@@ -663,11 +113,6 @@ $topics = $subjectData->topics;
?> ?>
</div> </div>
</div> </div>
<!--
<div class="progress-bar" data-progress="100">
<div class="progress"></div>
</div>
-->
</div> </div>
<?php <?php
@@ -773,145 +218,6 @@ $topics = $subjectData->topics;
window.addEventListener('load', updateMenuVisibility); window.addEventListener('load', updateMenuVisibility);
window.addEventListener('resize', updateMenuVisibility); window.addEventListener('resize', updateMenuVisibility);
// Animate progress bars on load
document.addEventListener('DOMContentLoaded', () => {
const progressBars = document.querySelectorAll('.progress-bar');
progressBars.forEach(bar => {
const progressContainer = bar.closest('.progress-container');
const progressLabel = progressContainer.querySelector('.progress-label');
const percentage = progressLabel.lastElementChild.textContent.replace('%', '');
setTimeout(() => {
bar.style.width = percentage + '%';
}, 300);
});
});
// Theme toggle functionality
function toggleTheme() {
const root = document.documentElement;
const themeToggle = document.querySelector('.theme-toggle i');
if (root.getAttribute('data-theme') === 'dark') {
root.removeAttribute('data-theme');
themeToggle.classList.remove('fa-sun');
themeToggle.classList.add('fa-moon');
localStorage.setItem('theme', 'light');
} else {
root.setAttribute('data-theme', 'dark');
themeToggle.classList.remove('fa-moon');
themeToggle.classList.add('fa-sun');
localStorage.setItem('theme', 'dark');
}
}
// Check for saved theme preference
document.addEventListener('DOMContentLoaded', () => {
const savedTheme = localStorage.getItem('theme');
const root = document.documentElement;
const themeToggle = document.querySelector('.theme-toggle i');
if (savedTheme === 'dark') {
root.setAttribute('data-theme', 'dark');
themeToggle.classList.remove('fa-moon');
themeToggle.classList.add('fa-sun');
}
// Add stagger effect to cards
const cards = document.querySelectorAll('.topic-card');
cards.forEach((card, index) => {
card.style.animationDelay = `${index * 0.1}s`;
});
// Initialize progress bars
const progressBars = document.querySelectorAll('.progress-bar');
progressBars.forEach(bar => {
const progress = bar.getAttribute('data-progress');
const progressElement = bar.querySelector('.progress');
setTimeout(() => {
progressElement.style.width = `${progress}%`;
}, 300);
});
});
// Update progress bars to 100%
document.addEventListener('DOMContentLoaded', () => {
const progressBars = document.querySelectorAll('.progress-bar');
progressBars.forEach(bar => {
const progressElement = bar.querySelector('.progress');
if (progressElement) { // Add null check
setTimeout(() => {
progressElement.style.width = '100%';
}, 300);
}
});
});
// Add preview functionality
function togglePreview(element) {
const previewContent = element.nextElementSibling;
const isHidden = previewContent.style.display === 'none';
if (isHidden) {
// Load preview content
previewContent.innerHTML = `
<div class="p-4 bg-gray-50 rounded-lg mt-4">
<h4 class="font-semibold mb-2">Schnelle Übung:</h4>
<div class="interactive-question mb-4">
<!-- Dynamic content based on topic -->
</div>
</div>
`;
gsap.to(previewContent, {
height: 'auto',
opacity: 1,
duration: 0.3,
display: 'block'
});
} else {
gsap.to(previewContent, {
height: 0,
opacity: 0,
duration: 0.3,
onComplete: () => {
previewContent.style.display = 'none';
}
});
}
}
// Add card hover effects
document.querySelectorAll('.topic-card').forEach(card => {
card.addEventListener('mouseenter', () => {
const icon = card.querySelector('.topic-icon');
if (window.gsap) {
gsap.to(icon, {
rotate: -10,
scale: 1.2,
duration: 0.3
});
} else {
// Fallback animation using CSS
icon.style.transform = 'rotate(-10deg) scale(1.2)';
}
});
card.addEventListener('mouseleave', () => {
const icon = card.querySelector('.topic-icon');
if (window.gsap) {
gsap.to(icon, {
rotate: 0,
scale: 1,
duration: 0.3
});
} else {
// Fallback animation using CSS
icon.style.transform = 'none';
}
});
});
// Update search function with fallback animation // Update search function with fallback animation
function handleSearch() { function handleSearch() {
const searchTerm = document.getElementById('searchInput').value.toLowerCase(); const searchTerm = document.getElementById('searchInput').value.toLowerCase();
@@ -943,46 +249,8 @@ $topics = $subjectData->topics;
} }
}); });
} }
// Update the menu visibility JavaScript
document.addEventListener('DOMContentLoaded', () => {
const menuToggle = document.querySelector('.menu-toggle');
const sidebar = document.querySelector('.sidebar');
// Force correct initial state based on viewport
function updateMenuState() {
if (window.innerWidth <= 1024) {
menuToggle.style.display = 'flex';
sidebar.style.transform = 'translateX(-100%)';
} else {
menuToggle.style.display = 'none';
sidebar.style.transform = 'translateX(0)';
}
}
// Initial state
updateMenuState();
// Update on resize with debounce
let resizeTimer;
window.addEventListener('resize', () => {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(updateMenuState, 250);
});
// Toggle sidebar
menuToggle.addEventListener('click', () => {
const isHidden = sidebar.style.transform === 'translateX(-100%)';
sidebar.style.transform = isHidden ? 'translateX(0)' : 'translateX(-100%)';
if (isHidden) {
addOverlay();
} else {
removeOverlay();
}
});
});
</script> </script>
<!-- Code injected by live-server --> <!-- Code injected by live-server -->
</body></html> </body>
</html>

View File

@@ -318,7 +318,7 @@ if(!isset($topicData)) {
<h2><?php echo($subjectData->displayName); ?></h2> <h2><?php echo($subjectData->displayName); ?></h2>
</div> </div>
<a href="homepage.php" class="nav-link"> <a href="homepage.php" class="nav-link">
<i class="fas fa-home"></i> Homepage <i class="fas fa-home"></i> Startseite
</a> </a>
<a href="subject.php?subject=<?php echo($subjectData->id); ?>" class="nav-link"> <a href="subject.php?subject=<?php echo($subjectData->id); ?>" class="nav-link">
<i class="fas fa-book"></i> <?php echo($subjectData->displayName); ?> Übersicht <i class="fas fa-book"></i> <?php echo($subjectData->displayName); ?> Übersicht
@@ -388,35 +388,5 @@ if(!isset($topicData)) {
</div> </div>
</aside> </aside>
<!-- Add this script at the end of the body, before the closing body tag -->
<script>
function handleContentSearch() {
const searchTerm = document.getElementById('searchInput').value.toLowerCase();
const contentElements = document.querySelectorAll('.content-text, .content-text li');
if (searchTerm.length < 2) {
// Remove all highlights if search term is too short
document.querySelectorAll('mark').forEach(mark => {
mark.outerHTML = mark.innerHTML;
});
return;
}
contentElements.forEach(element => {
let content = element.innerHTML;
// Remove existing highlights
content = content.replace(/<\/?mark>/g, '');
if (searchTerm) {
// Create a regular expression for case-insensitive search
const regex = new RegExp(`(${searchTerm})`, 'gi');
// Replace matches with highlighted text
content = content.replace(regex, '<mark>$1</mark>');
}
element.innerHTML = content;
});
}
</script>
</body> </body>
</html> </html>