mirror of
https://github.com/RGBCube/GDUS
synced 2025-07-28 13:37:45 +00:00
Add clock
This commit is contained in:
parent
a1c80fd14a
commit
c7f8845446
5 changed files with 59 additions and 49 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -13,6 +13,7 @@
|
|||
|
||||
!.gitignore
|
||||
|
||||
!*.css
|
||||
!*.js
|
||||
!*.md
|
||||
!*.py
|
||||
|
|
|
@ -22,7 +22,6 @@ const alertIfTime = () => {
|
|||
};
|
||||
|
||||
alertIfTime();
|
||||
|
||||
setInterval(() => {
|
||||
location.reload();
|
||||
alertIfTime();
|
||||
|
@ -30,10 +29,19 @@ setInterval(() => {
|
|||
|
||||
const updateClock = () => {
|
||||
const now = new Date();
|
||||
const hours = now.getHours().toString().padStart(2, '0');
|
||||
const minutes = now.getMinutes().toString().padStart(2, '0');
|
||||
const seconds = now.getSeconds().toString().padStart(2, '0');
|
||||
document.querySelector(".clock").innerText = `${hours}:${minutes}:${seconds}`;
|
||||
const options = {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
weekday: "long",
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric"
|
||||
};
|
||||
|
||||
const dateString = now.toLocaleDateString("tr-TR", options);
|
||||
|
||||
document.querySelector(".clock").innerHTML = dateString;
|
||||
};
|
||||
|
||||
setInterval(updateClock, 1000);
|
||||
updateClock();
|
||||
setInterval(updateClock, 1 * 60 * 1000);
|
||||
|
|
|
@ -45,7 +45,7 @@ async fn main() -> io::Result<()> {
|
|||
.service(submit::submit_form)
|
||||
.service(view::view)
|
||||
})
|
||||
.bind(("0.0.0.0", 8080))?
|
||||
.bind(("0.0.0.0", 8088))?
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
|
|
40
server/src/view.css
Normal file
40
server/src/view.css
Normal file
|
@ -0,0 +1,40 @@
|
|||
body {
|
||||
font-family: sans;
|
||||
background-color: #f4f4f4;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul li {
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
ul li h3 {
|
||||
margin-bottom: 10px;
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
ul li p {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.clock {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
font-size: 32px;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
padding: 20px;
|
||||
}
|
|
@ -48,48 +48,9 @@ async fn view(data: Data<SqlitePool>) -> web::Result<Markup> {
|
|||
Ok(html! {
|
||||
(DOCTYPE)
|
||||
|
||||
style {r#"
|
||||
body {
|
||||
font-family: sans;
|
||||
background-color: #f4f4f4;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul li {
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
ul li h3 {
|
||||
margin-bottom: 10px;
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
ul li p {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.clock {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
font-size: 24px;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
padding: 20px;
|
||||
}
|
||||
"#}
|
||||
style {
|
||||
(PreEscaped(embed::string!("view.css")))
|
||||
}
|
||||
|
||||
ul id="reminders" {
|
||||
@for reminder in formatted_reminders {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue