File size: 1,599 Bytes
2cdce84
 
 
 
 
440eaa6
 
2cdce84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440eaa6
2cdce84
 
440eaa6
2cdce84
440eaa6
2cdce84
 
 
 
 
 
440eaa6
2cdce84
 
440eaa6
2cdce84
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# main.py
import streamlit as st
import authentication 
import streamlit as st
from pag import add_field, edit, monitor


def authenticate_user():
    st.title("Welcome to :orange[Field Monitoring App]")
    st.markdown("""
            <style>
            .stSelectbox > div > div {cursor: pointer;}
            </style>
            """, unsafe_allow_html=True)
    if not st.session_state.authenticated:
        choice = st.selectbox("Interested? Sign up or log in if you have an account",options=["Home","Login","SignUp"])

        if choice == "Home":
          st.write("App Description")

        elif choice == "Login":
            authentication.login()
        elif choice == "SignUp":
            authentication.signup()

    return False

def main():
    
    if "authenticated" not in st.session_state:
        st.session_state.authenticated = False 

    if st.session_state.authenticated:
        st.sidebar.title("Navigation")
        options = st.sidebar.radio("Choose an option:", 
                                   ("Add Field", "Manage Fields", "Monitor Fields"))
        
        if options == "Add Field":
            st.title("Welcome to :orange[Field Monitoring App]")

            add_field.add_drawing()
            
        elif options == "Manage Fields":
            st.title("Welcome to :orange[Field Monitoring App]")
            edit.edit_fields()
        elif options == "Monitor Fields":
            st.title("Welcome to :orange[Field Monitoring App]")
            monitor.monitor_fields()
    else:
        authenticate_user()
if __name__ == "__main__":
    main()