diff --git a/src/core/slack.py b/src/core/slack.py index 56d2e55..9ad121e 100644 --- a/src/core/slack.py +++ b/src/core/slack.py @@ -8,8 +8,14 @@ from slack_sdk.web.slack_response import SlackResponse from slack_sdk.errors import SlackApiError -from config import SLACK_API_TOKEN, SLACK_JUMPSTART_MESSAGE, SLACK_DM_TEMPLATE - +from config import ( + SLACK_API_TOKEN, + SLACK_JUMPSTART_MESSAGE, + SLACK_DM_TEMPLATE, + CALENDAR_TIMEZONE, +) +from datetime import datetime +from zoneinfo import ZoneInfo logger: Logger = getLogger(__name__) @@ -22,7 +28,13 @@ logger.error(f"Failed to initialize Slack client: {e}") announcements: list[dict[str, str]] = [ - {"content": "Welcome to Jumpstart!", "user": "Jumpstart"} + { + "content": "Welcome to Jumpstart!", + "user": "Jumpstart", + "timestamp": datetime.now(ZoneInfo(CALENDAR_TIMEZONE)) + .strftime("%I:%M %p") + .lstrip("0"), + } ] @@ -177,6 +189,13 @@ def add_announcement(announcement_text: str, username: str) -> None: logger.warning("Attempted to add empty announcement, skipping!") return - new_addition: dict[str, str] = {"content": announcement_text, "user": username} + current_time = ( + datetime.now(tz=ZoneInfo(CALENDAR_TIMEZONE)).strftime("%I:%M %p").lstrip("0") + ) + new_addition: dict[str, str] = { + "content": announcement_text, + "user": username, + "timestamp": current_time, + } announcements.append(new_addition) diff --git a/src/static/css/style.css b/src/static/css/style.css index 750eb83..3ffbc71 100644 --- a/src/static/css/style.css +++ b/src/static/css/style.css @@ -8,6 +8,12 @@ --shadow-color: rgb(176,25,126, 0.5); /* Used for the shadow in the calendar */ } +/* b { + display: flex; + align-items: center; + justify-content: center; +} */ + .theme-dark { --panel-header-color: #B0197E; --panel-header-text-color: #FFFFFF; @@ -125,6 +131,17 @@ body{ font-family: 'Courier New', Courier, monospace; font-size: 20px; text-align: center; + white-space: pre-line; +} + +.announcements-stamp-header{ + color: var(--panel-header-text-color); + font-family: 'Courier New', Courier, monospace; + font-size: 20px; + text-align: left; + white-space: pre-line; + display: block; + font-style: italic; } .announcements-text-body{ @@ -145,6 +162,17 @@ body{ font-family: 'Courier New', Courier, monospace; font-size: 20px; text-align: center; + white-space: pre-line; +} + +.wikithoughts-page-name-header{ + color: var(--panel-header-text-color); + font-family: 'Courier New', Courier, monospace; + font-size: 20px; + text-align: left; + white-space: pre-line; + display: block; + font-style: italic; } .wikithoughts-text-body{ diff --git a/src/static/js/main.js b/src/static/js/main.js index 9039f7c..98cb8a6 100644 --- a/src/static/js/main.js +++ b/src/static/js/main.js @@ -121,10 +121,11 @@ async function mediumUpdate() { ]); const wikiData = await wikiRes.json(); const announcementData = await announcementRes.json(); - $("#wikipageheader").text(wikiData.page + " - csh/Wikithoughts") + $("#wikipageheader").text(wikiData.page) $("#wikipagetext").text(wikiData.content); $("#announcement").text(announcementData.content.substring(0, 910)); - $("#announcement-header").text("Announcements - " + announcementData.user) + $("#announcement-stamp").text(announcementData.user + " - " + announcementData.timestamp) + /*$("#announcement-header").text("Announcements\n" + announcementData.user)*/ } catch (err) { console.log(err); } diff --git a/src/templates/index.html b/src/templates/index.html index ea2cdab..7d5437a 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -19,7 +19,9 @@