diff --git a/app.py b/app.py index bb5b8ed..76531e4 100644 --- a/app.py +++ b/app.py @@ -6,7 +6,7 @@ ############################################################################# import streamlit as st -from modules import display_my_custom_component, display_post, display_genai_advice, display_activity_summary, display_recent_workouts +from modules import display_my_custom_component, study_group_card, navigation_bar, display_explore_page, display_genai_advice, display_activity_summary, display_recent_workouts from data_fetcher import get_user_posts, get_genai_advice, get_user_profile, get_user_sensor_data, get_user_workouts userId = 'user1' @@ -14,11 +14,24 @@ def display_app_page(): """Displays the home page of the app.""" - st.title('Welcome to SDS!') + # st.title('Welcome to SDS!') + + # # An example of displaying a custom component called "my_custom_component" + # value = st.text_input('Enter your name') + # display_my_custom_component(value) + + mock_data = [ + {"group_title": "Calc II Cram Session", "subject": "Math", "description": "Preparing for midterm", "date": "Oct 12", "time": "4PM", "location": "Library Room 3", "members": "4/6"}, + {"group_title": "Bio 101 Lab Prep", "subject": "Science", "description": "Reviewing cell structures", "date": "Oct 13", "time": "2PM", "location": "Science Hall", "members": "2/4"}, + {"group_title": "Art History Chat", "subject": "Arts", "description": "Renaissance era discussion", "date": "Oct 15", "time": "11AM", "location": "Cafe Blue", "members": "8/10"}, + {"group_title": "Python Basics", "subject": "CS", "description": "Looping and logic", "date": "Oct 16", "time": "6PM", "location": "Zoom", "members": "12/20"}, +] + + # Run the page + filtered_list = navigation_bar(mock_data) + display_explore_page(filtered_list) + - # An example of displaying a custom component called "my_custom_component" - value = st.text_input('Enter your name') - display_my_custom_component(value) # This is the starting point for your app. You do not need to change these lines diff --git a/modules.py b/modules.py index 93795df..dcf7fb1 100644 --- a/modules.py +++ b/modules.py @@ -8,6 +8,33 @@ ############################################################################# from internals import create_component +import streamlit as st + +# CSS style for modules +st.markdown(""" + +""", unsafe_allow_html=True) # Written by Chat GPT # This one has been written for you as an example. You may change it as wanted. @@ -28,10 +55,112 @@ def display_my_custom_component(value): html_file_name = "my_custom_component" create_component(data, html_file_name) +def navigation_bar(full_group_list): + """ + Renders a simple search bar and returns a filtered list of groups. + """ + # Simple search input + search_query = st.text_input( + "Search", + placeholder="Search by title or description...", + label_visibility="collapsed" + ) -def display_post(username, user_image, timestamp, content, post_image): - """Write a good docstring here.""" - pass + # Filtering Logic + if not search_query: + return full_group_list + + filtered_list = [ + group for group in full_group_list + if search_query.lower() in group['group_title'].lower() or + search_query.lower() in group['description'].lower() + ] + + return filtered_list + +def study_group_card(group_title, subject, description, date, time, location, members): + """ + Render a styled study group preview card. + + Args + + group_title : str + The name of the study group. + subject : str + Academic subject or category label displayed at the top. + description : str + Short summary describing the study group. + date : str + Meeting date (formatted string). + time : str + Meeting time (formatted string). + location : str + Physical or virtual meeting location. + members : str + Current and maximum number of members (e.g., "6/12"). + """ + + with st.container(border=True): + + # Title + st.subheader(group_title) + + # Description + st.write(description) + + # Date & Time + st.write(f"**Date:** {date}") + st.write(f"**Time:** {time}") + + # Location + st.markdown( + f'