louiecerv commited on
Commit
f480456
·
1 Parent(s): 4be5b1e

Add the header and footer

Browse files
__pycache__/page_components.cpython-313.pyc ADDED
Binary file (1.16 kB). View file
 
__pycache__/uac_helper.cpython-313.pyc CHANGED
Binary files a/__pycache__/uac_helper.cpython-313.pyc and b/__pycache__/uac_helper.cpython-313.pyc differ
 
app.py CHANGED
@@ -3,10 +3,12 @@ import streamlit as st
3
  from uac_helper import UACHelper
4
  from user_management import add_user, authenticate_user, load_settings, save_settings, generate_prompt, initialize_database
5
 
 
6
  # Initialize the database
7
  initialize_database()
8
 
9
  def settings_page(username):
 
10
  """Displays the settings page with user-specific settings."""
11
  st.title("Chat with AI")
12
  settings = load_settings(username)
@@ -20,6 +22,7 @@ def settings_page(username):
20
  save_settings(username, settings)
21
  result = generate_prompt(topic, instructions)
22
  st.success(result)
 
23
 
24
  def main():
25
  """Main function for the Streamlit app."""
 
3
  from uac_helper import UACHelper
4
  from user_management import add_user, authenticate_user, load_settings, save_settings, generate_prompt, initialize_database
5
 
6
+ import page_components
7
  # Initialize the database
8
  initialize_database()
9
 
10
  def settings_page(username):
11
+ page_components.app_header()
12
  """Displays the settings page with user-specific settings."""
13
  st.title("Chat with AI")
14
  settings = load_settings(username)
 
22
  save_settings(username, settings)
23
  result = generate_prompt(topic, instructions)
24
  st.success(result)
25
+ page_components.app_footer()
26
 
27
  def main():
28
  """Main function for the Streamlit app."""
page_components.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ def app_header():
4
+ st.markdown(
5
+ """
6
+ <style>
7
+ .header {
8
+ padding: 10px;
9
+ text-align: center;
10
+ }
11
+ </style>
12
+ <div class="header">
13
+ <h1>Application Template</h1>
14
+ </div>
15
+ """,
16
+ unsafe_allow_html=True,
17
+ )
18
+
19
+ def app_footer():
20
+ st.markdown(
21
+ """
22
+ <style>
23
+ .footer {
24
+ position: fixed;
25
+ left: 0;
26
+ bottom: 0;
27
+ width: 100%;
28
+ text-align: center;
29
+ padding: 10px;
30
+ }
31
+ </style>
32
+ <div class="footer">
33
+ <p>Copyright 2024 | West Visayas State University</p>
34
+ </div>
35
+ """,
36
+ unsafe_allow_html=True,
37
+ )
uac_helper.py CHANGED
@@ -2,6 +2,7 @@
2
 
3
  import streamlit as st
4
  from user_management import authenticate_user, add_user # Import necessary functions
 
5
 
6
  class UACHelper:
7
  """
@@ -27,6 +28,8 @@ class UACHelper:
27
  st.error("Invalid username or password.")
28
 
29
  def login_page(self):
 
 
30
  """Displays the login page."""
31
  st.title("Login")
32
  username = st.text_input("Username", key="login_username")
@@ -39,8 +42,10 @@ class UACHelper:
39
  st.session_state.page = "Sign Up"
40
 
41
  st.button("Don't have an account? Sign Up", on_click=go_to_signup)
 
42
 
43
  def sign_up_page(self):
 
44
  """Displays the sign-up page and handles new user registration."""
45
  st.title("Sign Up")
46
  username = st.text_input("Username", key="signup_username")
@@ -53,6 +58,7 @@ class UACHelper:
53
  st.error("Username already exists. Please choose another.")
54
  else:
55
  st.error("Username and password are required.")
 
56
 
57
  def is_authenticated(self):
58
  """Checks if the user is authenticated."""
 
2
 
3
  import streamlit as st
4
  from user_management import authenticate_user, add_user # Import necessary functions
5
+ import page_components
6
 
7
  class UACHelper:
8
  """
 
28
  st.error("Invalid username or password.")
29
 
30
  def login_page(self):
31
+ page_components.app_header()
32
+
33
  """Displays the login page."""
34
  st.title("Login")
35
  username = st.text_input("Username", key="login_username")
 
42
  st.session_state.page = "Sign Up"
43
 
44
  st.button("Don't have an account? Sign Up", on_click=go_to_signup)
45
+ page_components.app_footer()
46
 
47
  def sign_up_page(self):
48
+ page_components.app_header()
49
  """Displays the sign-up page and handles new user registration."""
50
  st.title("Sign Up")
51
  username = st.text_input("Username", key="signup_username")
 
58
  st.error("Username already exists. Please choose another.")
59
  else:
60
  st.error("Username and password are required.")
61
+ page_components.app_footer()
62
 
63
  def is_authenticated(self):
64
  """Checks if the user is authenticated."""