From e2aa00de356b6648955b9e432308dde4bec93eac Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Sun, 2 Feb 2025 15:49:03 -0500 Subject: [PATCH 1/7] Add css and grey-out --- app/services/github_service.py | 3 +++ app/static/styles/table.css | 6 ++++++ app/templates/pending.html | 2 ++ app/templates/table.html | 2 +- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/services/github_service.py b/app/services/github_service.py index d56f415..3fb78de 100644 --- a/app/services/github_service.py +++ b/app/services/github_service.py @@ -101,6 +101,7 @@ def update_general_data(self): for label in pr.labels ], "updated_at": pr.updated_at, + "is_draft": pr.draft, } ) @@ -135,6 +136,7 @@ def update_pending_reviews(self): "pr_number": pr.number, "repo_name": repo.name, "is_review": True, + "is_draft": pr.draft, } ) @@ -151,6 +153,7 @@ def update_pending_reviews(self): "pr_number": pr.number, "repo_name": repo.name, "is_review": False, + "is_draft": pr.draft, } ) diff --git a/app/static/styles/table.css b/app/static/styles/table.css index cd513a9..e1e4383 100644 --- a/app/static/styles/table.css +++ b/app/static/styles/table.css @@ -304,6 +304,12 @@ body { white-space: nowrap; /* Prevent text wrapping */ } +/* Draft PR Styling */ +.draft-pr { + opacity: 0.5; + background: #444 !important; +} + /* ========================= */ /* Responsive Tweaks */ /* ========================= */ diff --git a/app/templates/pending.html b/app/templates/pending.html index fb12694..e30f423 100644 --- a/app/templates/pending.html +++ b/app/templates/pending.html @@ -13,10 +13,12 @@
{{ reviewer.name }}
{% for assignment in reviewer.assignments %} + {% if not assignment.is_draft %}
#{{ assignment.pr_number }} {{ assignment.repo_name }}
+ {% endif %} {% endfor %}
diff --git a/app/templates/table.html b/app/templates/table.html index 16c57be..50b5e9e 100644 --- a/app/templates/table.html +++ b/app/templates/table.html @@ -78,7 +78,7 @@

Issues ({{ issues_count }})

Pull Requests ({{ pull_requests_count }})

{% for pr in pull_requests %} -
+
#{{ pr.number }}
From 0751505f604b14af83c8c3de7b0bf07b92d50302 Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Sun, 2 Feb 2025 15:53:23 -0500 Subject: [PATCH 2/7] Add extra features --- app/services/github_service.py | 22 +++++++++++++++++----- app/templates/pending.html | 2 -- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/services/github_service.py b/app/services/github_service.py index 3fb78de..7d109bf 100644 --- a/app/services/github_service.py +++ b/app/services/github_service.py @@ -125,6 +125,9 @@ def update_pending_reviews(self): for pr in pull_requests: pr_details = repo.get_pull(pr.number) + if pr.draft: # Skip drafts + continue + # Check for users with pending review requests requested_reviewers = pr_details.get_review_requests() for reviewer in requested_reviewers[ @@ -135,8 +138,7 @@ def update_pending_reviews(self): { "pr_number": pr.number, "repo_name": repo.name, - "is_review": True, - "is_draft": pr.draft, + "is_review": True, # This is a review request } ) @@ -152,13 +154,23 @@ def update_pending_reviews(self): { "pr_number": pr.number, "repo_name": repo.name, - "is_review": False, - "is_draft": pr.draft, + "is_review": False, # Regular assignment } ) + # Sort each reviewer's assignments: review-pending first + for reviewer in pending_reviews: + pending_reviews[reviewer] = sorted( + pending_reviews[reviewer], key=lambda x: not x["is_review"] + ) + + # Sort reviewers by the number of assignments (most important at top) + sorted_reviewers = sorted( + pending_reviews.items(), key=lambda x: len(x[1]), reverse=True + ) + # Update pending reviews in the global data self.latest_data["pending_reviews"] = [ {"name": name, "assignments": assignments} - for name, assignments in pending_reviews.items() + for name, assignments in sorted_reviewers ] diff --git a/app/templates/pending.html b/app/templates/pending.html index e30f423..fb12694 100644 --- a/app/templates/pending.html +++ b/app/templates/pending.html @@ -13,12 +13,10 @@
{{ reviewer.name }}
{% for assignment in reviewer.assignments %} - {% if not assignment.is_draft %}
#{{ assignment.pr_number }} {{ assignment.repo_name }}
- {% endif %} {% endfor %}
From 80badc66a18afcac7bf6b95e4c096161a91390f5 Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Sun, 2 Feb 2025 16:17:24 -0500 Subject: [PATCH 3/7] Add clock --- app/routes/screens.py | 30 ++++++++++++++++++-- app/static/styles/countdown.css | 35 +++++++++++++++++++++++ app/templates/countdown.html | 49 +++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 app/static/styles/countdown.css create mode 100644 app/templates/countdown.html diff --git a/app/routes/screens.py b/app/routes/screens.py index fa0b994..da545c4 100644 --- a/app/routes/screens.py +++ b/app/routes/screens.py @@ -9,9 +9,18 @@ @screens_bp.route("/api/screens") def get_screens(): - return jsonify( - {"version": os.getenv("GIT_COMMIT", None), "screens": ["/table", "/pending"]} - ) + screens = ["/table"] + + try: + if len(app.github_service.latest_data["pending_reviews"]) > 0: + screens.append("/pending") + except: + pass + + if os.getenv("COUNT_DOWN"): + screens.append("/countdown") + + return jsonify({"version": os.getenv("GIT_COMMIT", None), "screens": screens}) @screens_bp.route("/test") @@ -57,3 +66,18 @@ def table_screen(): **app.github_service.latest_data, last_updated=app.github_service.last_updated, ) + + +@screens_bp.route("/countdown") +def countdown(): + countdown_env = os.getenv("COUNT_DOWN", "0:Unknown Event") + timestamp, event_name = countdown_env.split(":", 1) + + try: + target_time = int(timestamp) + except ValueError: + target_time = 0 # Fallback if invalid + + return render_template( + "countdown.html", target_time=target_time, event_name=event_name + ) diff --git a/app/static/styles/countdown.css b/app/static/styles/countdown.css new file mode 100644 index 0000000..b31af95 --- /dev/null +++ b/app/static/styles/countdown.css @@ -0,0 +1,35 @@ +body { + font-family: "Courier New", Courier, monospace; + background: rgb(40, 40, 40); + color: white; + text-align: center; +} + +.countdown-container { + margin-top: 8vh; +} + +h1 { + font-size: 4em; + color: rgb(163, 0, 46); + text-shadow: 2px 2px 5px red; +} + +#countdown { + font-size: 8em; + font-weight: bold; + letter-spacing: 5px; + background: rgb(40, 40, 40); + color: rgb(163, 0, 46); + padding: 20px; + border-radius: 10px; + display: flex; /* Use flexbox for centering */ + justify-content: center; /* Center text horizontally */ + align-items: center; /* Center text vertically */ + text-align: center; + text-shadow: 2px 2px 10px red; + width: 100vw; /* Full viewport width */ + height: auto; /* Auto height */ + box-sizing: border-box; /* Include padding in width calculation */ + overflow: hidden; /* Prevent any text overflow */ +} diff --git a/app/templates/countdown.html b/app/templates/countdown.html new file mode 100644 index 0000000..f1378b8 --- /dev/null +++ b/app/templates/countdown.html @@ -0,0 +1,49 @@ + + + + + + Countdown to {{ event_name }} + + + + +
+

{{ event_name }}

+
Loading...
+
+ + + + + \ No newline at end of file From a3f6f6fb638235256e86310baf1ad77e19f1bcb2 Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Sun, 2 Feb 2025 16:21:57 -0500 Subject: [PATCH 4/7] Adjust css style for clock --- app/static/styles/countdown.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/static/styles/countdown.css b/app/static/styles/countdown.css index b31af95..c44883b 100644 --- a/app/static/styles/countdown.css +++ b/app/static/styles/countdown.css @@ -10,13 +10,13 @@ body { } h1 { - font-size: 4em; + font-size: 8em; color: rgb(163, 0, 46); text-shadow: 2px 2px 5px red; } #countdown { - font-size: 8em; + font-size: 7em; font-weight: bold; letter-spacing: 5px; background: rgb(40, 40, 40); From 2129809f24cc16b21845ec40d571011c734897ea Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Sun, 2 Feb 2025 16:39:27 -0500 Subject: [PATCH 5/7] Even better countdown --- app/static/scripts/countdown.js | 31 ++++++++++++++++++++++++++++++ app/static/styles/countdown.css | 4 ++-- app/templates/countdown.html | 34 ++------------------------------- 3 files changed, 35 insertions(+), 34 deletions(-) create mode 100644 app/static/scripts/countdown.js diff --git a/app/static/scripts/countdown.js b/app/static/scripts/countdown.js new file mode 100644 index 0000000..4147357 --- /dev/null +++ b/app/static/scripts/countdown.js @@ -0,0 +1,31 @@ +document.addEventListener("DOMContentLoaded", () => { + const countdownElement = document.getElementById("countdown"); + const targetTime = parseInt(countdownElement.dataset.targetTime) * 1000; // Convert to milliseconds + + function updateCountdown() { + const now = Date.now(); + let timeLeft = targetTime - now; + + if (timeLeft < 0) { + countdownElement.innerText = "000:00:00:00.00"; + return; + } + + let days = Math.floor(timeLeft / (1000 * 60 * 60 * 24)); + let hours = Math.floor((timeLeft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); + let minutes = Math.floor((timeLeft % (1000 * 60 * 60)) / (1000 * 60)); + let seconds = Math.floor((timeLeft % (1000 * 60)) / 1000); + let tenths = Math.floor((timeLeft % 1000) / 10); // Extract tenths & hundredths + + let countdownString = `${days.toString().padStart(3, '0')}:` + + `${hours.toString().padStart(2, '0')}:` + + `${minutes.toString().padStart(2, '0')}:` + + `${seconds.toString().padStart(2, '0')}.` + + `${tenths.toString().padStart(2, '0')}`; // Show two-digit tenths & hundredths + + countdownElement.innerText = countdownString; + } + + setInterval(updateCountdown, 10); // Update every 10ms + updateCountdown(); +}); diff --git a/app/static/styles/countdown.css b/app/static/styles/countdown.css index c44883b..eebdbec 100644 --- a/app/static/styles/countdown.css +++ b/app/static/styles/countdown.css @@ -10,13 +10,13 @@ body { } h1 { - font-size: 8em; + font-size: 12em; color: rgb(163, 0, 46); text-shadow: 2px 2px 5px red; } #countdown { - font-size: 7em; + font-size: 10em; font-weight: bold; letter-spacing: 5px; background: rgb(40, 40, 40); diff --git a/app/templates/countdown.html b/app/templates/countdown.html index f1378b8..8886fef 100644 --- a/app/templates/countdown.html +++ b/app/templates/countdown.html @@ -10,40 +10,10 @@

{{ event_name }}

-
Loading...
+
- + \ No newline at end of file From 03b89b4dd6e1020cf3568b0150d9373dd686ffd8 Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Sun, 2 Feb 2025 16:43:45 -0500 Subject: [PATCH 6/7] Shrink css --- app/static/styles/countdown.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/static/styles/countdown.css b/app/static/styles/countdown.css index eebdbec..b3bc9ee 100644 --- a/app/static/styles/countdown.css +++ b/app/static/styles/countdown.css @@ -16,7 +16,7 @@ h1 { } #countdown { - font-size: 10em; + font-size: 8em; font-weight: bold; letter-spacing: 5px; background: rgb(40, 40, 40); From e042ddefa6490922abeaefe5c146e2a29cbe7095 Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Sun, 2 Feb 2025 17:23:56 -0500 Subject: [PATCH 7/7] Done editing font size gonna merge --- app/static/styles/countdown.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/static/styles/countdown.css b/app/static/styles/countdown.css index b3bc9ee..9720577 100644 --- a/app/static/styles/countdown.css +++ b/app/static/styles/countdown.css @@ -16,7 +16,7 @@ h1 { } #countdown { - font-size: 8em; + font-size: 7em; font-weight: bold; letter-spacing: 5px; background: rgb(40, 40, 40);