andreped commited on
Commit
80cfe5c
Β·
1 Parent(s): 31cd757

Added icons and info about app to improve UX

Browse files
Files changed (1) hide show
  1. app.py +22 -8
app.py CHANGED
@@ -59,7 +59,7 @@ def logout():
59
 
60
 
61
  def delete_own_user():
62
- st.title("Delete Account")
63
  if st.button("Delete Account"):
64
  try:
65
  client.delete_user(st.session_state.current_user)
@@ -70,7 +70,7 @@ def delete_own_user():
70
 
71
 
72
  def get_posts_for_user():
73
- st.title("Get Posts for User")
74
  users = client.get_users()
75
  user_name = st.selectbox("Select user name", users)
76
  if st.button("Get Posts"):
@@ -84,7 +84,7 @@ def get_posts_for_user():
84
 
85
 
86
  def get_posts_for_topic():
87
- st.title("Get Posts for Topic")
88
  topics = client.get_topics()
89
  topic = st.selectbox("Enter topic", topics)
90
  if st.button("Get Posts"):
@@ -95,7 +95,7 @@ def get_posts_for_topic():
95
 
96
 
97
  def get_trending_topics():
98
- st.title("Get Trending Topics")
99
  current_timestamp = client.get_current_timestamp()
100
  from_timestamp = st.number_input("Enter from timestamp", min_value=0, step=1)
101
  to_timestamp = st.number_input(
@@ -115,8 +115,8 @@ def get_all_posts():
115
  st.title("Feed")
116
 
117
  # Add post section at the top
118
- post_text = st.text_area("What's happening?", key="new_post_text")
119
- if st.button("Add Post"):
120
  try:
121
  client.add_post(st.session_state.current_user, post_text)
122
  st.success("Post added successfully.")
@@ -153,9 +153,9 @@ def get_all_posts():
153
  client.like_post(st.session_state.current_user, post.timestamp)
154
  st.rerun()
155
 
156
-
157
  def main():
158
- st.sidebar.title("Postly\nSimple social media platform")
 
159
  if st.session_state.logged_in:
160
  st.sidebar.write(f"Logged in as: {st.session_state.current_user}")
161
  if st.sidebar.button("Logout"):
@@ -188,6 +188,20 @@ def main():
188
  register()
189
  elif page == "Login":
190
  login()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
 
192
 
193
  if __name__ == "__main__":
 
59
 
60
 
61
  def delete_own_user():
62
+ st.title("Delete Account ❌")
63
  if st.button("Delete Account"):
64
  try:
65
  client.delete_user(st.session_state.current_user)
 
70
 
71
 
72
  def get_posts_for_user():
73
+ st.title("Get Posts for User πŸ”Ž")
74
  users = client.get_users()
75
  user_name = st.selectbox("Select user name", users)
76
  if st.button("Get Posts"):
 
84
 
85
 
86
  def get_posts_for_topic():
87
+ st.title("Get Posts for Topic πŸ”Ž")
88
  topics = client.get_topics()
89
  topic = st.selectbox("Enter topic", topics)
90
  if st.button("Get Posts"):
 
95
 
96
 
97
  def get_trending_topics():
98
+ st.title("Get Trending Topics πŸ“Š")
99
  current_timestamp = client.get_current_timestamp()
100
  from_timestamp = st.number_input("Enter from timestamp", min_value=0, step=1)
101
  to_timestamp = st.number_input(
 
115
  st.title("Feed")
116
 
117
  # Add post section at the top
118
+ post_text = st.text_area("What's happening? πŸ’¬", key="new_post_text")
119
+ if st.button("Add Post πŸ–ŠοΈ"):
120
  try:
121
  client.add_post(st.session_state.current_user, post_text)
122
  st.success("Post added successfully.")
 
153
  client.like_post(st.session_state.current_user, post.timestamp)
154
  st.rerun()
155
 
 
156
  def main():
157
+ st.sidebar.title("Postly πŸ“\nSimple social media platform")
158
+
159
  if st.session_state.logged_in:
160
  st.sidebar.write(f"Logged in as: {st.session_state.current_user}")
161
  if st.sidebar.button("Logout"):
 
188
  register()
189
  elif page == "Login":
190
  login()
191
+
192
+ st.sidebar.markdown("""
193
+ **About Postly**
194
+
195
+ Welcome to Postly, a simple social media platform created for fun. This app allows different users to share posts and like each other's posts.
196
+
197
+ **Important Information**
198
+
199
+ - The entire app is kept in global memory for all users accessing the app on the same instance.
200
+ - Do not use a username and password actually used with any other apps.
201
+ - We hash the password, but no real attempt to make a bulletproof solution was made.
202
+ """
203
+ )
204
+
205
 
206
 
207
  if __name__ == "__main__":