Skip to content

Commit

Permalink
added alpha branding
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasThinks committed Feb 11, 2025
1 parent ec271d8 commit 96cfe96
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
))
Expand Down
30 changes: 30 additions & 0 deletions static/styles.css
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 96cfe96

Please sign in to comment.