diff --git a/tildes/scss/modules/_donation.scss b/tildes/scss/modules/_donation.scss index e8f1b45..e864310 100644 --- a/tildes/scss/modules/_donation.scss +++ b/tildes/scss/modules/_donation.scss @@ -17,10 +17,23 @@ header { font-weight: bold; } +} - meter { - width: 100%; - height: 0.4rem; - margin: 0.4rem 0 0.2rem; - } +.donation-goal-meter { + width: 100%; + height: 0.4rem; +} + +.donation-goal-progress { + display: flex; + align-items: center; + width: 100%; + margin: 0.2rem 0; +} + +.donation-goal-percentage { + font-size: 0.6rem; + line-height: 0.6rem; + font-weight: bold; + margin-left: 0.4rem; } diff --git a/tildes/tildes/templates/home.jinja2 b/tildes/tildes/templates/home.jinja2 index a953325..3d4757f 100644 --- a/tildes/tildes/templates/home.jinja2 +++ b/tildes/tildes/templates/home.jinja2 @@ -95,14 +95,18 @@ {% macro donation_goal(financial_data, current_time) %}
Tildes is a non-profit site with no ads or investors, funded entirely by donations.
diff --git a/tildes/tildes/views/topic.py b/tildes/tildes/views/topic.py
index 3d9c028..a1a480d 100644
--- a/tildes/tildes/views/topic.py
+++ b/tildes/tildes/views/topic.py
@@ -512,4 +512,8 @@ def _get_financial_data(db_session: Session) -> Optional[Dict[str, Decimal]]:
if any(key not in financial_data for key in ("expense", "goal", "income")):
return None
+ financial_data["goal_percentage"] = round(
+ financial_data["income"] / financial_data["goal"] * 100
+ )
+
return financial_data