Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions src/css/settings.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/* Dialog Styling */
dialog {
border: none;
border-radius: 8px;
padding: 2rem;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
max-width: 500px;
width: 90%;
}

dialog::backdrop {
background-color: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(2px);
}

dialog h1 {
margin-top: 0;
color: #333;
}

/* Button Styling */
button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s ease;
margin: 5px;
}

button:hover {
background-color: #45a049;
}

button:active {
transform: scale(0.98);
}

/* Button-Types */
button[value="logout"] {
background-color: #f44336;
}

button[value="logout"]:hover {
background-color: #da190b;
}

button[value="changePassword"] {
background-color: #2196F3;
}

button[value="changePassword"]:hover {
background-color: #0b7dda;
}

/* Select Styling */
select {
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
margin: 5px 0 15px 0;
width: 100%;
max-width: 300px;
font-size: 14px;
}

label {
display: block;
margin-top: 10px;
}

label h5 {
margin: 5px 0;
color: #555;
}

/* Body Styling */
body {
font-family: Arial, sans-serif;
padding: 20px;
background-color: #f5f5f5;
}
45 changes: 45 additions & 0 deletions src/html/settings.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<html>
<head>
<title>Einstellungen</title>
<link rel="stylesheet" href="../css/settings.css">
<script src="../js/setting.js" defer></script>
</head>
<body>
<button onclick="toggleDialog()">Einstellungen</button>
<dialog id="settingsDialog">
<h1>Einstellungen</h1>

<label for="language"><h5>Sprache:</h5></label>
<select name="language" id="language">
<option value="german">Deutsch</option>
<option value="english">Englisch</option>
</select>

<label for="theme"><h5>Theme:</h5></label>
<select name="theme" id="theme">
<option value="dark">Dark</option>
<option value="light">Light</option>
</select>

<br>

<label for="gender"><h5>Geschlecht:</h5></label>
<select name="gender" id="gender">
<option value="none">---</option>
<option value="male">Männlich</option>
<option value="female">Weiblich</option>
</select>

<h5>Graph-Einstellungen:</h5>
<label for="gender"><h5>Graph-Typ:</h5></label>

<br>

<button value="changePassword">Passwort ändern</button>
<button value="logout">Ausloggen</button>

<br><br>
<button onclick="toggleDialog()">Schließen</button>
</dialog>
</body>
</html>
51 changes: 51 additions & 0 deletions src/js/setting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Saved Settings
let settings = {
language: 'german',
theme: 'dark',
gender: 'none'
};

// Load Settings from local storage
function loadSettingsFromStorage() {
const savedSettings = localStorage.getItem('userSettings');
if (savedSettings) {
settings = JSON.parse(savedSettings);
}
}

function toggleDialog() {
const dialog = document.getElementById("settingsDialog");

if (dialog.open) {
saveSettings();
dialog.close();
} else {
dialog.showModal();
}
}

function saveSettings() {
settings.language = document.getElementById('language').value;
settings.theme = document.getElementById('theme').value;
settings.gender = document.getElementById('gender').value;

// Save settings in local storage
localStorage.setItem('userSettings', JSON.stringify(settings));
console.log('Einstellungen im localStorage gespeichert:', settings);
}

function loadSettings() {
document.getElementById('language').value = settings.language;
document.getElementById('theme').value = settings.theme;
document.getElementById('gender').value = settings.gender;
}

// Loads Settings into Dialog
document.addEventListener('DOMContentLoaded', () => {
loadSettingsFromStorage();
loadSettings();

document.getElementById('language').addEventListener('change', saveSettings);
document.getElementById('theme').addEventListener('change', saveSettings);
document.getElementById('gender').addEventListener('change', saveSettings);
});