From 96cfe9644dde8b547f7d6c4d80c38a46bff761b4 Mon Sep 17 00:00:00 2001 From: Andreas Varotsis Date: Tue, 11 Feb 2025 11:41:02 -0800 Subject: [PATCH] added alpha branding --- main.py | 1 + pages.py | 19 +++++++++++++++++++ static/styles.css | 30 ++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/main.py b/main.py index f7e92bb..2e22528 100644 --- a/main.py +++ b/main.py @@ -2,6 +2,7 @@ from fasthtml.common import * from datetime import datetime, timedelta dev_mode = os.environ.get("DEV_MODE", "false").lower() == "true" +alpha_mode = os.environ.get("ALPHA_MODE", "true").lower() == "true" import secrets, os import bcrypt diff --git a/pages.py b/pages.py index 6682f0d..1e4cc2a 100644 --- a/pages.py +++ b/pages.py @@ -6,16 +6,35 @@ def generate_themed_page(page_body, auth=None, page_title="Feedback to Me"): """Generate a themed page with appropriate navigation bar based on auth status""" + from main import alpha_mode + nav_bar = navigation_bar_logged_out if auth: user = users("id=?", (auth,))[0] nav_bar = navigation_bar_logged_in(user) else: nav_bar = navigation_bar_logged_out + + # Add alpha badge to title if in alpha mode + if alpha_mode: + page_title = f"{page_title} " + Span("ALPHA", cls="alpha-badge") + + # Create alpha banner if in alpha mode + alpha_elements = [] + if alpha_mode: + alpha_elements.extend([ + Div("🚧 This site is in alpha testing - please don't use it with sensitive data 🚧", cls="alpha-banner"), + Div( + "⚠️ Alpha Testing Notice: This is an early version of Feedback to Me. While functional, it may contain bugs or undergo significant changes. We recommend not using it for critical feedback processes at this time.", + cls="alpha-warning" + ) if "landing-page" in str(page_body) else None + ]) + return (Title(page_title), Favicon('static/favicon.ico', dark_icon='static/favicon.ico'), Container( nav_bar, + *[el for el in alpha_elements if el is not None], Div(page_body, id="main-content"), footer_bar )) diff --git a/static/styles.css b/static/styles.css index 1bebe1d..9803520 100644 --- a/static/styles.css +++ b/static/styles.css @@ -1,3 +1,33 @@ +/* Alpha Testing Styles */ +.alpha-banner { + background: #fff3cd; + color: #856404; + border-bottom: 2px solid #ffeeba; + padding: 0.75rem; + text-align: center; + font-weight: 600; + margin-bottom: 1rem; +} + +.alpha-badge { + background: #ffd54f; + color: #856404; + padding: 0.2rem 0.5rem; + border-radius: 4px; + font-size: 0.8em; + vertical-align: middle; + margin-left: 0.5rem; +} + +.alpha-warning { + background: #fff3cd; + color: #856404; + border: 1px solid #ffeeba; + border-radius: 4px; + padding: 1rem; + margin: 1rem 0; +} + /* Validation styles */ [role="alert"] { margin: 0.5rem 0;