# janseva_full.py import streamlit as st import pandas as pd import datetime # ------------------------------ # Page Config # ------------------------------ st.set_page_config( page_title="JanSeva Citizen Network", page_icon="🌏", layout="wide" ) # ------------------------------ # Initialize Database # ------------------------------ if "submissions" not in st.session_state: st.session_state.submissions = [] # ------------------------------ # Header # ------------------------------ st.title("🌏 JanSeva Citizen Network") st.markdown(""" Submit your problem and proposed solution. Women & children contributions are highlighted 🌟. Voting only activates after government implementation. """) # ------------------------------ # Submission Form # ------------------------------ with st.form("submission_form"): name = st.text_input("Your Name (optional for anonymity)") category = st.selectbox( "Category", ["Corruption", "Education", "Health", "Women Safety", "Children Welfare", "Infrastructure"] ) description = st.text_area("Describe your problem") solution = st.text_area("Propose your solution") is_women_or_child = st.checkbox("I am a woman or child contributor") submit = st.form_submit_button("Submit Problem & Solution") if submit: st.session_state.submissions.append({ "name": name if name else "Anonymous", "category": category, "description": description, "solution": solution, "highlight": is_women_or_child, "timestamp": datetime.datetime.now(), "status": "Pending Implementation", "vote_active": False, "votes": 0 }) st.success("✅ Submission recorded! Voting will activate after implementation.") # ------------------------------ # Admin Section (Simulate Implementation) # ------------------------------ st.header("🛠 Admin Panel (Implementation)") st.markdown("For demo: Click 'Mark Implemented' to activate voting for a submission.") for idx, submission in enumerate(st.session_state.submissions): if submission["status"] == "Pending Implementation": if st.button(f"Mark Implemented: {submission['description'][:30]}...", key=f"imp{idx}"): st.session_state.submissions[idx]["status"] = "Implemented" st.session_state.submissions[idx]["vote_active"] = True st.success(f"Submission '{submission['description'][:30]}...' marked as Implemented!") # ------------------------------ # Voting Section # ------------------------------ st.header("🗳 Vote for Implemented Solutions") for idx, submission in enumerate(st.session_state.submissions): if submission["vote_active"]: vote = st.button(f"Vote: {submission['description'][:50]}...", key=f"vote{idx}") if vote: st.session_state.submissions[idx]["votes"] += 1 st.success("✅ Your vote has been counted!") # ------------------------------ # Public Dashboard # ------------------------------ st.header("📊 Public Dashboard") if st.session_state.submissions: display_df = pd.DataFrame(st.session_state.submissions) display_df["highlighted"] = display_df["highlight"].apply(lambda x: "🌟" if x else "") display_df["timestamp"] = display_df["timestamp"].dt.strftime("%Y-%m-%d %H:%M") st.dataframe(display_df[["highlighted","category","description","solution","status","votes","timestamp"]]) else: st.info("No submissions yet. Be the first to contribute!") # ------------------------------ # Legal Disclaimer # ------------------------------ st.markdown(""" **Legal Disclaimer:** - All data is anonymized. - Offensive or illegal content will be removed. - Children submissions protected as per law. - Voting only activates after official implementation. """)