Skip to content

Commit 5d3bc3c

Browse files
committed
small fixes and changes, production ready
1 parent 99b1166 commit 5d3bc3c

File tree

6 files changed

+31
-35
lines changed

6 files changed

+31
-35
lines changed

public/assets/js/index.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ function addHomeworkPopup() {
88
const popup = document.getElementById('add-event-popup');
99
popup.style.display = 'flex';
1010
document.getElementById('popup-bg').style.display = 'block';
11-
//i love copilot
12-
1311
}
1412

1513
function creatorPopup() {
@@ -73,8 +71,6 @@ document.getElementById('save-creator-button').addEventListener('click', () => {
7371
}
7472
});
7573

76-
//document.getElementById('save-homework-button').addEventListener('click', addHomework);
77-
7874
document.addEventListener('DOMContentLoaded', function () {
7975
document.getElementById('settings-button').addEventListener('click', function (event) {
8076
switchPage("settings");
@@ -119,18 +115,13 @@ window.addEventListener('resize', () => {
119115
document.querySelectorAll('input[type="radio"][name="creator-radio"]').forEach(radio => {
120116
radio.addEventListener('change', function () {
121117
const popup = document.getElementById('creator-popup');
122-
123-
// Add transitioning class for the slide down effect
124118
popup.classList.add('transitioning');
125119

126120
setTimeout(() => {
127-
// Change the content
128121
document.getElementsByClassName('shown-creator-container')[0].classList.remove('shown-creator-container');
129122
document.getElementById('add-' + this.value + '-container').classList.add('shown-creator-container');
130-
131-
// Remove transitioning class to slide back up
132123
popup.classList.remove('transitioning');
133-
}, 500); // Longer timeout to match the 0.8s transition (halfway point)
124+
}, 200);
134125
});
135126
});
136127

public/assets/js/list.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ function displayAssignedHomework() {
2121
}
2222

2323
const container = document.getElementById('uncompleted-homework');
24-
// Store previous IDs to detect new items
24+
// store previous IDs to detect new items
2525
const prevItems = Array.from(container.querySelectorAll('.homework-item'));
2626
const prevIds = prevItems.map(div => div.dataset.id);
2727

2828
container.innerHTML = '';
2929

3030
if (homework.length === 0) {
3131
const msgDiv = document.createElement('div');
32-
msgDiv.innerHTML = '<h1 style="text-align: center;">No homework assigned.</h1>';
32+
msgDiv.innerHTML = `<h1>No assignments due. You're all caught up!</h1>`;
3333
msgDiv.style.opacity = '0';
3434
msgDiv.style.height = '60px';
3535
container.appendChild(msgDiv);
3636
setTimeout(() => {
37-
msgDiv.style.transition = 'opacity 0.5s';
37+
msgDiv.style.transition = 'opacity 0.2s';
3838
msgDiv.style.opacity = '1';
3939
}, 10);
4040
return;
@@ -56,17 +56,18 @@ function displayAssignedHomework() {
5656
`;
5757

5858
if (new Date(hw.dueDate) < new Date()) {
59-
div.getElementsByClassName('hw-dueDate')[0].style.color = '#ffcccc';
59+
div.getElementsByClassName('hw-dueDate')[0].style.color = '#ffbbbb';
60+
div.getElementsByClassName('hw-dueDate')[0].style.fontWeight = 'bold';
6061
}
6162

62-
// Fade in if it's a new item
63+
// fade in if it's a new item
6364
if (!prevIds.includes(String(hw.id))) {
6465
div.style.opacity = '0';
65-
div.style.transition = 'opacity 0.5s';
66+
div.style.transition = 'opacity 0.2s';
6667
container.appendChild(div);
6768
setTimeout(() => {
6869
div.style.opacity = '1';
69-
}, 500);
70+
}, 200);
7071
} else {
7172
container.appendChild(div);
7273
}
@@ -95,12 +96,12 @@ function displayCompletedHomework() {
9596
// Fade out if toggled off
9697
if (showCompleted === false && prevItems.length) {
9798
prevItems.forEach(div => {
98-
div.style.transition = 'opacity 0.5s';
99+
div.style.transition = 'opacity 0.2s';
99100
div.style.opacity = '0';
100101
});
101102
setTimeout(() => {
102103
container.innerHTML = '';
103-
}, 500);
104+
}, 200);
104105
return;
105106
}
106107

@@ -110,16 +111,15 @@ function displayCompletedHomework() {
110111
if (showCompleted == true) {
111112
const completedContainer = document.getElementById('completed-homework');
112113
const msgDiv = document.createElement('div');
113-
msgDiv.innerHTML = '<h1 style="text-align: center;">No homework completed.</h1>';
114+
msgDiv.innerHTML = `<h1>No assignments completed.</h1>`;
114115
msgDiv.style.opacity = '0';
115116
msgDiv.style.height = '60px';
116117
completedContainer.innerHTML = '';
117118
completedContainer.appendChild(msgDiv);
118119
setTimeout(() => {
119-
msgDiv.style.transition = 'opacity 0.5s';
120+
msgDiv.style.transition = 'opacity 0.2s';
120121
msgDiv.style.opacity = '1';
121122
}, 10);
122-
123123
}
124124
return;
125125
}
@@ -146,16 +146,16 @@ function displayCompletedHomework() {
146146
div.style.opacity = '0';
147147
container.appendChild(div);
148148
setTimeout(() => {
149-
div.style.transition = 'opacity 0.5s';
149+
div.style.transition = 'opacity 0.2s';
150150
div.style.opacity = '1';
151151
}, 10);
152152
} else if (!prevIds.includes(String(hw.id)) && showCompleted == true) {
153153
div.style.opacity = '0';
154154
container.appendChild(div);
155155
setTimeout(() => {
156-
div.style.transition = 'opacity 0.5s';
156+
div.style.transition = 'opacity 0.2s';
157157
div.style.opacity = '1';
158-
}, 500);
158+
}, 200);
159159
} else {
160160
container.appendChild(div);
161161
}
@@ -262,7 +262,13 @@ document.getElementById('homework-container').addEventListener('click', event =>
262262
finishedHomework.splice(idx, 1);
263263
localStorage.setItem('homework', JSON.stringify(homework));
264264
localStorage.setItem('finishedHomework', JSON.stringify(finishedHomework));
265-
displayCompletedHomework();
265+
item.style.transition = 'opacity 0.2s';
266+
item.style.opacity = '0';
267+
setTimeout(() => {
268+
item.remove();
269+
displayCompletedHomework();
270+
}, 200);
271+
266272
}
267273
return;
268274
}

0 commit comments

Comments
 (0)