Compare commits

...

12 Commits

3 changed files with 22 additions and 37 deletions

View File

@@ -1,4 +1,4 @@
# Work Week Progress Bar # Day Drain
Because staring at the clock is bad for morale, but staring at a **progress bar** is somehow motivating. Because staring at the clock is bad for morale, but staring at a **progress bar** is somehow motivating.
@@ -9,18 +9,18 @@ This is a small Flask-powered web app that visualizes:
It progresses **only during your scheduled work hours** It progresses **only during your scheduled work hours**
### Daily Progress Bar ### Daily Progress Bar
- Advances **every minute** - Advances **every 10ms** (configurable)
- Only runs **SundayWednesday** - Only runs **on workdays**
- Only between **7:00 AM 5:30 PM** - Only during **work hours**
- Before work? Frozen.
- After work? Done.
- Not a workday? Blissfully idle.
### Weekly Progress Bar ### Weekly Progress Bar
- Your work week is **4 days** (SunWed) - Assumes your work week is **4 days**
- Each day = **25%** - Each day = **25%**
- During the day, the bar fills smoothly - During the day, the bar fills smoothly
- End of Wednesday = **100% freedom** - End of Workweek = **100% freedom**
### Demo Site
https://daydrain.com
### Configuration ### Configuration
@@ -29,20 +29,4 @@ It progresses **only during your scheduled work hours**
| WORK_START_TIME | 07:00 | Workday start (HH:MM) | | WORK_START_TIME | 07:00 | Workday start (HH:MM) |
| WORK_END_TIME | 17:30 | Workday end (HH:MM) | | WORK_END_TIME | 17:30 | Workday end (HH:MM) |
| WORK_DAYS | 0,1,2,3 | JS day numbers (Sun=0) | | WORK_DAYS | 0,1,2,3 | JS day numbers (Sun=0) |
| UPDATE_INTERVAL_MS | 60000 | Update frequency | | UPDATE_INTERVAL_MS | 10 | Update frequency |
### Configuration
| Variable | Default | Description |
|--------|---------|-------------|
| WORK_START_TIME | 07:00 | Workday start (HH:MM) |
| WORK_END_TIME | 17:30 | Workday end (HH:MM) |
| WORK_DAYS | 0,1,2,3 | JS day numbers (Sun=0) |
| UPDATE_INTERVAL_MS | 60000 | Update frequency |
## Tech Stack
- **Flask** serves the page and minds its business
- **Vanilla JavaScript** handles all time logic client-side
- **HTML + CSS** gradients, glow, and just enough polish
- **Zero databases** this app remembers nothing, like a healthy coping mechanism

2
app.py
View File

@@ -27,7 +27,7 @@ def index():
if d.strip().isdigit() if d.strip().isdigit()
] ]
update_interval = int(os.getenv("UPDATE_INTERVAL_MS", "60000")) update_interval = int(os.getenv("UPDATE_INTERVAL_MS", "10"))
return render_template( return render_template(
"index.html", "index.html",

View File

@@ -2,13 +2,13 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Work Week Progress</title> <title>Day Drain</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<h1>Workday Progress</h1> <h1>Day Drain</h1>
<div class="status" id="statusText"></div> <div class="status" id="statusText"></div>
<!-- Daily Progress --> <!-- Daily Progress -->
@@ -49,9 +49,9 @@
const WORK_DAYS = config.workDays; const WORK_DAYS = config.workDays;
const UPDATE_INTERVAL = config.updateInterval; const UPDATE_INTERVAL = config.updateInterval;
const TOTAL_WORK_MINUTES = const TOTAL_WORK_SECONDS =
(WORK_END_HOUR * 60 + WORK_END_MINUTE) - (WORK_END_HOUR * 3600 + WORK_END_MINUTE * 60) -
(WORK_START_HOUR * 60 + WORK_START_MINUTE); (WORK_START_HOUR * 3600 + WORK_START_MINUTE * 60);
const WEEKLY_DAY_WEIGHT = 100 / WORK_DAYS.length; const WEEKLY_DAY_WEIGHT = 100 / WORK_DAYS.length;
@@ -83,9 +83,10 @@
dailyPercent = 100; dailyPercent = 100;
statusText.textContent = "Workday complete 🎉"; statusText.textContent = "Workday complete 🎉";
} else { } else {
const elapsedMinutes = Math.floor((now - start) / 60000); const elapsedSeconds = (now - start) / 1000;
dailyPercent = Math.min( dailyPercent = Math.min(
(elapsedMinutes / TOTAL_WORK_MINUTES) * 100, (elapsedSeconds / TOTAL_WORK_SECONDS) * 100,
100 100
); );
statusText.textContent = "Grinding…"; statusText.textContent = "Grinding…";
@@ -93,7 +94,7 @@
// Daily progress // Daily progress
dailyFill.style.width = dailyPercent + "%"; dailyFill.style.width = dailyPercent + "%";
dailyPercentText.textContent = dailyPercent.toFixed(1) + "%"; dailyPercentText.textContent = dailyPercent.toFixed(4) + "%";
// Weekly progress // Weekly progress
const completedDays = WORK_DAYS.filter(d => d < day).length; const completedDays = WORK_DAYS.filter(d => d < day).length;
@@ -104,7 +105,7 @@
weeklyPercent = Math.min(weeklyPercent, 100); weeklyPercent = Math.min(weeklyPercent, 100);
weeklyFill.style.width = weeklyPercent + "%"; weeklyFill.style.width = weeklyPercent + "%";
weeklyPercentText.textContent = weeklyPercent.toFixed(1) + "%"; weeklyPercentText.textContent = weeklyPercent.toFixed(4) + "%";
} }
updateProgress(); updateProgress();