Skip to content

Commit e8eabe3

Browse files
committed
settings and animations
1 parent 2ae5b7c commit e8eabe3

File tree

8 files changed

+151
-17
lines changed

8 files changed

+151
-17
lines changed

public/assets/js/list.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,15 @@ function displayAssignedHomework() {
5656
`;
5757

5858
if (new Date(hw.dueDate) < new Date()) {
59-
div.getElementsByClassName('hw-dueDate')[0].style.color = '#ffbbbb';
60-
div.getElementsByClassName('hw-dueDate')[0].style.fontWeight = 'bold';
59+
if (localStorage.getItem("animationsEnabled") === null) {
60+
localStorage.setItem("animationsEnabled", "true");
61+
div.getElementsByClassName('hw-dueDate')[0].classList.add('late');
62+
} else if (localStorage.getItem("animationsEnabled") === "true") {
63+
div.getElementsByClassName('hw-dueDate')[0].classList.add('late');
64+
} else {
65+
div.getElementsByClassName('hw-dueDate')[0].classList.add('late-no-anim');
66+
}
67+
6168
}
6269

6370
// fade in if it's a new item

public/assets/js/settings.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const animationToggle = document.getElementById("animation-toggle");
2+
3+
if (localStorage.getItem("animationsEnabled") === "true") {
4+
animationToggle.checked = true;
5+
} else {
6+
animationToggle.checked = false;
7+
}
8+
9+
animationToggle.addEventListener("change", function (e) {
10+
if (e.target.checked) {
11+
localStorage.setItem("animationsEnabled", "true");
12+
} else {
13+
localStorage.setItem("animationsEnabled", "false");
14+
}
15+
});

public/assets/styles/css/list.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/assets/styles/css/settings.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/assets/styles/scss/list.scss

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,33 @@
7474
align-self: flex-end;
7575
}
7676

77+
.late {
78+
animation: pulse-red 1s infinite;
79+
color: #ffdddd;
80+
font-weight: 800;
81+
82+
@keyframes pulse-red {
83+
0% {
84+
color: #ffdddd;
85+
text-shadow: 0 0 0px #ff5555;
86+
}
87+
30% {
88+
color: #ff9999;
89+
text-shadow: 0 0 10px #ff5555;
90+
}
91+
100% {
92+
color: #ffdddd;
93+
text-shadow: 0 0 0px #ff5555;
94+
}
95+
}
96+
}
97+
98+
.late-no-anim {
99+
color: #ff5555;
100+
font-weight: 800;
101+
}
102+
103+
77104
p, strong {
78105
white-space: wrap;
79106
text-overflow: ellipsis;
@@ -87,7 +114,7 @@
87114
border: none;
88115
transition-duration: 0.25s;
89116
cursor: pointer;
90-
color: white;
117+
color: $text-primary;
91118
font-size: 1rem;
92119
font-weight: 900;
93120
margin: auto 0;
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
@use 'global' as *;
2+
3+
.section {
4+
background-color: $background-card;
5+
color: $text-primary;
6+
border: 1px solid $border-color;
7+
box-shadow: 0 4px 6px rgba($background-card, 0.1);
8+
width: 90%;
9+
margin: 20px auto;
10+
border-radius: 10px;
11+
padding: 20px;
12+
}
13+
14+
/* From Uiverse.io by mobinkakei */
15+
.label {
16+
display: inline-flex;
17+
align-items: center;
18+
cursor: pointer;
19+
color: #394a56;
20+
}
21+
22+
.label-text {
23+
margin-left: 16px;
24+
}
25+
26+
.toggle {
27+
isolation: isolate;
28+
position: relative;
29+
height: 30px;
30+
width: 60px;
31+
border-radius: 15px;
32+
overflow: hidden;
33+
box-shadow: -8px -4px 8px 0px $background-card,
34+
8px 4px 12px 0px $background-card,
35+
4px 4px 4px 0px $background-main inset,
36+
-4px -4px 4px 0px $background-main inset;
37+
}
38+
39+
.toggle-state {
40+
display: none;
41+
}
42+
43+
.indicator {
44+
height: 100%;
45+
width: 200%;
46+
background: $primary;
47+
border-radius: 15px;
48+
transform: translate3d(-75%, 0, 0);
49+
transition: transform 0.4s cubic-bezier(0.85, 0.05, 0.18, 1.35), background 0.4s cubic-bezier(0.85, 0.05, 0.18, 1.35);
50+
box-shadow: -8px -4px 8px 0px $background-main,
51+
8px 4px 12px 0px $background-main;
52+
53+
54+
}
55+
56+
.toggle:hover .indicator {
57+
background: $primary-hover;
58+
}
59+
.toggle-state:checked ~ .indicator {
60+
transform: translate3d(25%, 0, 0);
61+
}
62+
63+
.setting-item {
64+
display: flex;
65+
justify-content: center;
66+
align-items: center;
67+
gap: 10px;
68+
}

public/favicon.ico

0 Bytes
Binary file not shown.

public/pages/settings.html

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8">
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,[email protected],100..700,0..1,-50..200" />
7-
<link rel="stylesheet" href="/assets/styles/css/global.css">
8-
<link rel="stylesheet" href="/assets/styles/css/settings.css">
9-
<script src="/assets/js/global.js" defer></script>
10-
<script src="/assets/js/settings.js" defer></script>
11-
</head>
12-
<body>
13-
<p>Work in progress!</p>
14-
</body>
15-
</html>
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,[email protected],100..700,0..1,-50..200" />
7+
<link rel="stylesheet" href="/assets/styles/css/global.css" />
8+
<link rel="stylesheet" href="/assets/styles/css/settings.css" />
9+
<script src="/assets/js/global.js" defer></script>
10+
<script src="/assets/js/settings.js" defer></script>
11+
</head>
12+
<body>
13+
<h1 style="text-align: center">Settings</h1>
14+
<div class="section">
15+
<h2 style="text-align: center">Visual</h2>
16+
17+
<div class="setting-item">
18+
<div class="setting-info">
19+
<h3>Late Homework Animation</h3>
20+
<p>Toggle the pulsating red animation on the due dates of late homework items.</p>
21+
</div>
22+
<label class="label">
23+
<div class="toggle">
24+
<input id="animation-toggle" class="toggle-state" type="checkbox" name="check" value="check" />
25+
<div class="indicator"></div>
26+
</div>
27+
</label>
28+
</div>
29+
</div>
30+
</body>
31+
</html>

0 commit comments

Comments
 (0)