Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb02821a93 | ||
|
|
4da3c0741a | ||
|
|
7cebec338e |
No files matched your search
@@ -0,0 +1,54 @@
|
||||
:root {
|
||||
--black: #000;
|
||||
--white: #fff;
|
||||
--gray-bg: #f4f4f4;
|
||||
--border: 1px solid #000;
|
||||
}
|
||||
|
||||
body { font-family: Arial, sans-serif; margin: 0; padding: 0; }
|
||||
.container { max-width: 1100px; margin: 0 auto; padding: 20px; }
|
||||
|
||||
/* Navbar & Filter */
|
||||
.navbar { display: flex; justify-content: space-between; padding: 20px 5%; border-bottom: var(--border); }
|
||||
.category-group { display: flex; gap: 20px; margin-bottom: 40px; flex-wrap: wrap; }
|
||||
.category-item { cursor: pointer; text-align: center; font-size: 11px; font-weight: bold; }
|
||||
.square { width: 50px; height: 50px; border: var(--border); margin-bottom: 5px; }
|
||||
.category-item.active .square { background: var(--black); }
|
||||
|
||||
/* Event Cards */
|
||||
.event-list { display: flex; flex-direction: column; gap: 20px; }
|
||||
.event-card {
|
||||
display: grid;
|
||||
grid-template-columns: 200px 1fr 150px 150px 50px;
|
||||
border: var(--border);
|
||||
align-items: center;
|
||||
}
|
||||
.event-image { height: 150px; background-size: cover; background-position: center; border-right: var(--border); }
|
||||
.event-content, .event-info, .event-cta { padding: 15px; }
|
||||
.tag { border: var(--border); padding: 3px 10px; border-radius: 15px; font-size: 10px; margin-right: 5px; }
|
||||
.btn-primary { background: var(--black); color: var(--white); border: none; padding: 10px; width: 100%; cursor: pointer; font-weight: bold; }
|
||||
|
||||
/* Empty State Style */
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
padding: 50px 20px;
|
||||
border: 2px dashed #ccc;
|
||||
background: var(--gray-bg);
|
||||
margin-top: 20px;
|
||||
}
|
||||
.btn-outline {
|
||||
background: transparent;
|
||||
border: 2px solid var(--black);
|
||||
padding: 12px 25px;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
margin-top: 15px;
|
||||
transition: 0.3s;
|
||||
}
|
||||
.btn-outline:hover { background: var(--black); color: var(--white); }
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 850px) {
|
||||
.event-card { grid-template-columns: 1fr; }
|
||||
.event-image { border-right: none; border-bottom: var(--border); width: 100%; }
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,38 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Italienische Tavolata",
|
||||
"location": "LUZERN",
|
||||
"date": "19. MÄR. 2026",
|
||||
"time": "18:30 UHR",
|
||||
"category": "DINNER",
|
||||
"cuisine": "ITALIENISCH",
|
||||
"diet": "VEGGIE",
|
||||
"spots": 4,
|
||||
"image": "https://via.placeholder.com/300x200"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Noche Peruana",
|
||||
"location": "LUZERN",
|
||||
"date": "11. APR. 2026",
|
||||
"time": "19:00 UHR",
|
||||
"category": "DINNER",
|
||||
"cuisine": "PERUANISCH",
|
||||
"diet": "FLEISCH",
|
||||
"spots": 2,
|
||||
"image": "https://via.placeholder.com/300x200"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "Japanese Delight",
|
||||
"location": "ZÜRICH",
|
||||
"date": "02. MAI. 2026",
|
||||
"time": "12:30 UHR",
|
||||
"category": "LUNCH",
|
||||
"cuisine": "JAPANISCH",
|
||||
"diet": "FISCH",
|
||||
"spots": 8,
|
||||
"image": "https://via.placeholder.com/300x200"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Event-Detail</title>
|
||||
<link rel="stylesheet" href="css/event_overview_stylesheet.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header class="navbar">
|
||||
<div class="logo">SOCIAL COOKING</div>
|
||||
<nav>
|
||||
<a href="index.html">Events</a>
|
||||
<div class="user-profile">M</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
<div id="detail-view">
|
||||
<p>Lädt Event-Details...</p>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script src="js/event_overview_script.js"></script>
|
||||
<script src="js/event_detail.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Event-Overview</title>
|
||||
<link rel="stylesheet" href="css/event_overview_stylesheet.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="navbar">
|
||||
<div class="logo">SOCIAL COOKING</div>
|
||||
<nav>
|
||||
<span>Events</span>
|
||||
<div class="user-profile">M</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
<h1>Invité Events</h1>
|
||||
|
||||
<section class="filter-section">
|
||||
<p class="filter-label">WORAUF HAST DU LUST</p>
|
||||
<div class="category-group">
|
||||
<div class="category-item" data-cat="BRUNCH"><div class="square"></div><span>BRUNCH</span></div>
|
||||
<div class="category-item" data-cat="LUNCH"><div class="square"></div><span>LUNCH</span></div>
|
||||
<div class="category-item" data-cat="DINNER"><div class="square"></div><span>DINNER</span></div>
|
||||
<div class="category-item" data-cat="COFFEE"><div class="square"></div><span>COFFEE</span></div>
|
||||
<div class="category-item active" data-cat="ALLE"><div class="square"></div><span>ALLE</span></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="event-grid" class="event-list"></section>
|
||||
</main>
|
||||
<script src="js/event_overview_script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<link rel="stylesheet" href="stylesheet.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const detailContainer = document.getElementById('detail-view');
|
||||
|
||||
// 1. ID aus der URL lesen (z.B. detail.html?id=1)
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const eventId = parseInt(params.get('id'));
|
||||
|
||||
if (!eventId) {
|
||||
window.location.href = 'event_overview.html';
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Daten laden und das richtige Event suchen
|
||||
try {
|
||||
const response = await fetch('data/events.json');
|
||||
const allEvents = await response.json();
|
||||
const event = allEvents.find(e => e.id === eventId);
|
||||
|
||||
if (event) {
|
||||
renderDetailPage(event);
|
||||
} else {
|
||||
detailContainer.innerHTML = "<h1>Event wurde nicht gefunden.</h1><a href='event_overview.html'>Zurück zur Übersicht</a>";
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Fehler beim Laden der Details:", error);
|
||||
}
|
||||
|
||||
function renderDetailPage(event) {
|
||||
//Layout Deatilseite der Events mit Rücklink zur Übersicht, Eventtitel, Infos und Bild
|
||||
detailContainer.innerHTML = `
|
||||
<div class="detail-header">
|
||||
<a href="event_overview.html" style="text-decoration:none; color:black; font-size:24px;">←</a>
|
||||
<h1>${event.title}</h1>
|
||||
</div>
|
||||
<div class="detail-grid">
|
||||
<div class="info-section">
|
||||
<p>📍 ${event.location} | 📅 ${event.date} | 👤 Max. ${event.spots} Personen</p>
|
||||
<hr>
|
||||
<p>Hier kommen die detaillierten Infos zu ${event.title} hin...</p>
|
||||
</div>
|
||||
<div class="image-section">
|
||||
<img src="${event.image}" alt="${event.title}" style="width:100%;">
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,109 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const eventGrid = document.getElementById('event-grid');
|
||||
const filterButtons = document.querySelectorAll('.category-item');
|
||||
let allEvents = [];
|
||||
|
||||
// 1. Daten laden aus JSOn file
|
||||
async function fetchEvents() {
|
||||
try {
|
||||
// Pfad zu JSON File angepasst an lokale Ordnerstruktur
|
||||
const response = await fetch('data/events.json');
|
||||
allEvents = await response.json();
|
||||
renderEvents(allEvents);
|
||||
|
||||
// Beim Laden prüfen, ob ein Filter gespeichert war
|
||||
const savedFilter = sessionStorage.getItem('activeFilter') || 'ALLE';
|
||||
applyFilter(savedFilter);
|
||||
|
||||
//checked ob Fehler beim Laden oder Parsen der Daten auftreten
|
||||
} catch (error) {
|
||||
console.error("Fehler:", error);
|
||||
eventGrid.innerHTML = "<p>Events konnten nicht geladen werden.</p>";
|
||||
}
|
||||
}
|
||||
// Funktion um Filter anzuwenden und gleichzeitig UI zu aktualisieren
|
||||
function applyFilter(category) {
|
||||
|
||||
// UI: Aktiven Button stylen
|
||||
filterButtons.forEach(btn => {
|
||||
if (btn.getAttribute('data-cat') === category) {
|
||||
btn.classList.add('active');
|
||||
} else {
|
||||
btn.classList.remove('active');
|
||||
}
|
||||
});
|
||||
|
||||
// Daten filtern
|
||||
const filtered = category === 'ALLE'
|
||||
? allEvents
|
||||
: allEvents.filter(e => e.category === category);
|
||||
|
||||
renderEvents(filtered);
|
||||
|
||||
//Filter im Browser merken
|
||||
sessionStorage.setItem('activeFilter', category);
|
||||
|
||||
}
|
||||
// 2. Events rendern + "Empty State" Logik
|
||||
function renderEvents(events) {
|
||||
eventGrid.innerHTML = '';
|
||||
|
||||
// PRÜFUNG: Wenn keine Events vorhanden sind zeigt folgende Nachricht
|
||||
if (events.length === 0) {
|
||||
eventGrid.innerHTML = `
|
||||
<div class="empty-state">
|
||||
<h3>Schade! Aktuell gibt es hier keine Events.</h3>
|
||||
<p>Möchtest du vielleicht selbst Gastgeber sein?</p>
|
||||
<button class="btn-outline" onclick="alert('Hier gehts zum Formular!')">Eigenes Event erstellen</button>
|
||||
</div>
|
||||
`;
|
||||
return;
|
||||
}
|
||||
|
||||
// Wenn Events da sind, Karten bauen
|
||||
events.forEach(event => {
|
||||
const card = document.createElement('article');
|
||||
card.className = 'event-card';
|
||||
|
||||
//Klick auf die gesamte Karte leitet zur Detailseite weiter
|
||||
card.style.cursor = "pointer";
|
||||
card.onclick = () => {
|
||||
window.location.href = `event_detail.html?id=${event.id}`;
|
||||
};
|
||||
|
||||
//internes HTML im Js zur Styling der Event-Karte (HIER CHECKEN OB SO OK NACH CLEAN CODE)
|
||||
card.innerHTML = `
|
||||
<div class="event-image" style="background-image: url('${event.image}')"></div>
|
||||
<div class="event-content">
|
||||
<small>📍 ${event.location}</small>
|
||||
<h2 style="margin: 5px 0;">${event.title}</h2>
|
||||
<div>
|
||||
<span class="tag">${event.cuisine}</span>
|
||||
<span class="tag">${event.category}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="event-info">
|
||||
<strong>${event.date}</strong><br>
|
||||
<span>🕒 ${event.time}</span>
|
||||
</div>
|
||||
<div class="event-cta">
|
||||
<div style="font-size: 12px; margin-bottom: 8px;">🥗 ${event.diet}</div>
|
||||
<button class="btn-primary">Anmelden</button>
|
||||
<p style="font-size: 10px; margin-top: 8px;">${event.spots} PLÄTZE FREI</p>
|
||||
</div>
|
||||
<div style="text-align: center;">❤️</div>
|
||||
`;
|
||||
eventGrid.appendChild(card);
|
||||
});
|
||||
}
|
||||
|
||||
// 3. Filter-Logik basic anhand der Kategorien im JSON File
|
||||
filterButtons.forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
const selectedCat = button.getAttribute('data-cat');
|
||||
applyFilter(selectedCat);
|
||||
});
|
||||
});
|
||||
|
||||
fetchEvents();
|
||||
});
|
||||
File renamed without changes.
Reference in new issue
Block a user