Skip to content

Commit cc6b364

Browse files
authored
Update combined.html
Bugfixes
1 parent 662f230 commit cc6b364

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

combined.html

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@
7777
font-size: 18px;
7878
}
7979

80+
.section {
81+
display: none;
82+
opacity: 0;
83+
transform: translateY(20px);
84+
transition: opacity var(--transition-speed), transform var(--transition-speed);
85+
}
86+
87+
.section.active {
88+
display: block;
89+
opacity: 1;
90+
transform: translateY(0);
91+
}
92+
8093
</style>
8194
</head>
8295
<body>
@@ -85,12 +98,12 @@
8598
<button onclick="showSection('ordering')">Ordering</button>
8699
<button onclick="showSection('rules')">Rules</button>
87100
<button onclick="showSection('settings')">Settings</button>
88-
<button><a href="https://scratch-coding-hut.github.io/account" id="account-link" style="color: inherit; text-decoration: none;">My Account</a></button>
101+
<button onclick="showSection('account')">My Account</button>
89102
</div>
90103

91104
<div class="auth-status" id="authStatus">Checking login status...</div>
92105

93-
<div id="home" class="section">
106+
<div id="home" class="section active">
94107
<h1>Welcome to Coding Hut</h1>
95108
<p>The best coding shop of Scratch</p>
96109
</div>
@@ -103,7 +116,7 @@ <h1>Rules:</h1>
103116
<li>Be respectful to customers and employees.</li>
104117
</ol>
105118
</div>
106-
<div id="settings" class="section" style="display:none;">
119+
<div id="settings" class="section">
107120
<h2>Settings</h2>
108121
<div class="settings">
109122
<label>
@@ -116,30 +129,42 @@ <h2>Settings</h2>
116129
</div>
117130
</div>
118131

132+
<div id="account" class="section">
133+
<h2>My Account</h2>
134+
<p>Welcome, <span id="accountUser"></span>!</p>
135+
</div>
136+
119137
<script>
120138
function showSection(sectionId) {
121139
document.querySelectorAll('.section').forEach(section => {
122-
section.style.display = 'none';
140+
section.classList.remove('active');
123141
});
124-
document.getElementById(sectionId).style.display = 'block';
142+
document.getElementById(sectionId).classList.add('active');
125143
}
126144

127145
function toggleDarkMode() {
128146
document.body.classList.toggle('dark-mode');
147+
localStorage.setItem('darkMode', document.body.classList.contains('dark-mode'));
129148
}
130149

131150
function updateAuthStatus() {
132151
const storedUser = localStorage.getItem("loggedInUser");
133152
const authStatus = document.getElementById("authStatus");
134153
if (storedUser) {
135154
authStatus.innerText = `Logged in as: ${storedUser}`;
136-
document.getElementById("account-link").innerText = `My Account (${storedUser})`;
155+
document.getElementById("accountUser").innerText = storedUser;
137156
} else {
138157
authStatus.innerText = "Not logged in";
139158
}
140159
}
141160

142-
window.onload = updateAuthStatus;
161+
window.onload = function() {
162+
updateAuthStatus();
163+
if (localStorage.getItem('darkMode') === 'true') {
164+
document.body.classList.add('dark-mode');
165+
document.getElementById('darkModeToggle').checked = true;
166+
}
167+
};
143168
</script>
144169
</body>
145170
</html>

0 commit comments

Comments
 (0)