import streamlit as st
st.set_page_config(page_title="SK Youth Portal", layout="wide")
st.markdown("""
<style>
.main { background-color: #0e1117; color: white; }
.stButton>button { border-radius: 20px; background-color: #00d4ff; color: black; font-weight: bold; }
</style>
""", unsafe_allow_html=True)
st.title("π SK Barangay Connect")
st.subheader("Your interactive space for a better community.")
menu = st.sidebar.radio("Go to:", ["Activity Feed", "Evaluate Us", "Youth Ideas"])
if menu == "Activity Feed":
col1, col2 = st.columns(2)
with col1:
st.image("pamuo-awards-panel-interview.jpeg", caption="Pamuo Awards Panel Interview")
st.write("The SK Council participated in the PAMUO Awards Validation and Panel Interview, an inspiring milestone that celebrates dedication, service, and true leadership.")
with col2:
st.image("busagak_cleanup.jpeg", caption="Busagak Cleaup")
st.write("Busagak Falls Annual Clean-up")
elif menu == "Evaluate Us":
st.header("Post-Activity Feedback")
event = st.selectbox("Which activity did you attend?", ["Basketball", "Seminar", "Cleanup"])
rating = st.feedback("stars")
comment = st.text_area("What's one thing we should change?")
if st.button("Submit My Vote"):
st.balloons()
st.success("Thank you! Your voice matters.")
import pandas as pd
leaderboard_data = {
"Name": ["Juan Dela Cruz", "Maria Clara", "Kiko Matsing", "Inday Sahog", "Dodong Tech"],
"Points": [150, 125, 90, 85, 50],
"Badges": ["π
Gold", "π₯ Silver", "π₯ Bronze", "π± Active", "π Newcomer"]
}
df = pd.DataFrame(leaderboard_data)
st.title("π Youth Leadership Leaderboard")
st.write("Top contributors in our Barangay this month!")
# Creating "Podium" style display for the Top 3
col1, col2, col3 = st.columns(3)
with col2: # Rank 1 in the middle
st.metric(label="1st Place", value=df.iloc[0]["Name"], delta=f"{df.iloc[0]['Points']} pts")
st.caption("Barangay MVP π")
with col1: # Rank 2 on the left
st.metric(label="2nd Place", value=df.iloc[1]["Name"], delta=f"{df.iloc[1]['Points']} pts")
with col3: # Rank 3 on the right
st.metric(label="3rd Place", value=df.iloc[2]["Name"], delta=f"{df.iloc[2]['Points']} pts")
st.divider()
st.subheader("Current Rankings")
st.dataframe(
df,
column_config={
"Points": st.column_config.ProgressColumn("Points Progress", min_value=0, max_value=200),
},
hide_index=True,
use_container_width=True
)
from fpdf import FPDF
import base64
def create_certificate(user_name, activity_name, points):
pdf = FPDF(orientation='L', unit='mm', format='A4') # Landscape orientation
pdf.add_page()
# 1. Add a Border
pdf.set_line_width(2)
pdf.rect(10, 10, 277, 190)
# 2. Add Content
pdf.set_font('Arial', 'B', 30)
pdf.cell(0, 40, 'CERTIFICATE OF APPRECIATION', ln=True, align='C')
pdf.set_font('Arial', '', 18)
pdf.cell(0, 20, 'This is proudly presented to:', ln=True, align='C')
pdf.set_font('Arial', 'B', 35)
pdf.cell(0, 30, user_name, ln=True, align='C')
pdf.set_font('Arial', '', 18)
pdf.write(10, f'For outstanding participation in "{activity_name}"\n')
pdf.write(10, f'and earning {points} Leadership Points.')
return pdf.output(dest='S').encode('latin-1')
st.title("π SK Digital Certificate Portal")
name = st.text_input("Enter your Full Name:")
activity = st.selectbox("Select Activity:", ["Coastal Cleanup", "Basketball League", "Tech Seminar"])
points_earned = 50 # This would normally come from your leaderboard logic
if st.button("Generate My Certificate"):
if name:
pdf_bytes = create_certificate(name, activity, points_earned)
st.balloons()
st.download_button(
label="β¬οΈ Download Certificate (PDF)",
data=pdf_bytes,
file_name=f"SK_Certificate_{name}.pdf",
mime="application/pdf"
)
else:
st.error("Please enter your name first!")
import pandas as pd
from fpdf import FPDF
st.set_page_config(page_title="SK Barangay Hub", page_icon="π", layout="wide")
# Custom CSS for a modern "Glassmorphism" look
st.markdown("""
<style>
.main { background: linear-gradient(135deg, #1e1e2f, #2d2d44); color: white; }
div.stButton > button {
background-color: #00f2fe; color: #1e1e2f;
border-radius: 10px; font-weight: bold; width: 100%;
}
</style>
""", unsafe_allow_html=True)
def generate_pdf(name, activity):
pdf = FPDF(orientation='L', unit='mm', format='A4')
pdf.add_page()
pdf.set_draw_color(0, 242, 254) # SK Blue Border
pdf.rect(5, 5, 287, 200, 'D')
pdf.set_font('Arial', 'B', 35)
pdf.cell(0, 60, 'CERTIFICATE OF COMPLETION', ln=True, align='C')
pdf.set_font('Arial', '', 20)
pdf.cell(0, 20, 'Recognizing the active participation of:', ln=True, align='C')
pdf.set_font('Arial', 'I', 40)
pdf.cell(0, 30, name, ln=True, align='C')
pdf.set_font('Arial', '', 15)
pdf.cell(0, 20, f'In the activity: {activity}', ln=True, align='C')
return pdf.output(dest='S').encode('latin-1')
with st.sidebar:
st.title("ποΈ SK Portal")
page = st.radio("Navigate to:", ["Dashboard", "Activity Feed", "Evaluation & Rewards"])
st.info("Log in to track your points!")
if 'user_points' not in st.session_state:
st.session_state.user_points = 85
if page == "Dashboard":
st.header("π Youth Impact Leaderboard")
col1, col2 = st.columns([1, 2])
with col1:
st.subheader("Your Stats")
st.metric(label="Your Current Points", value=f"{st.session_state.user_points} pts", delta="+15 this week")
st.progress(st.session_state.user_points / 200)
st.caption("Next Rank: Silver Badge at 100 pts")
with col2:
data = {
"Rank": [1, 2, 3, 4],
"Name": ["Juan Dela Cruz", "Maria Clara", "You", "Kiko Matsing"],
"Points": [150, 125, st.session_state.user_points, 50]
}
st.table(pd.DataFrame(data))
elif page == "Activity Feed":
st.header("π’ Recent & Upcoming Activities")
col_a, col_b = st.columns(2)
with col_a:
st.image("https://images.unsplash.com/photo-1544928147-79a2dbc1f389?w=500", caption="Coastal Cleanup")
st.write("**Date:** Dec 15, 2025")
st.button("View Photos", key="btn1")
with col_b:
st.image("https://images.unsplash.com/photo-1511632765486-a01980e01a18?w=500", caption="Youth Night")
st.write("**Date:** Jan 5, 2026")
st.button("Register Now", key="btn2")
elif page == "Evaluation & Rewards":
st.header("π Post-Activity Evaluation")
st.write("Complete this form to earn **15 points** and your certificate.")
with st.form("eval_form"):
u_name = st.text_input("Full Name for Certificate")
act = st.selectbox("Which activity did you attend?", ["Coastal Cleanup", "Tech Seminar"])
rating = st.slider("Rate the activity", 1, 5)
feedback = st.text_area("What can we improve?")
submitted = st.form_submit_button("Submit & Claim Reward")
if submitted:
if u_name:
st.session_state.user_points += 15
st.success(f"Form submitted! You now have {st.session_state.user_points} points.")
st.balloons()
# Certificate Download
cert_bytes = generate_pdf(u_name, act)
st.download_button(
label="π Download My Certificate",
data=cert_bytes,
file_name="SK_Certificate.pdf",
mime="application/pdf"
)
else:
st.warning("Please enter your name to generate the certificate.")