halimbahae commited on
Commit
d8ae2ac
·
verified ·
1 Parent(s): 8146db1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -36
app.py CHANGED
@@ -44,48 +44,22 @@ book_files = {
44
 
45
  # Main Streamlit app
46
  def main():
47
- st.title("Hadith Viewer")
 
 
 
 
 
 
 
 
 
48
  st.sidebar.title("Books")
49
  selected_book = st.sidebar.selectbox("Select a Book", list(book_files.keys()))
50
 
51
  selected_files = book_files[selected_book]
52
  selected_file = st.sidebar.selectbox("Select a File", selected_files)
53
 
54
- st.sidebar.subheader("Description")
55
- st.sidebar.write("This is a viewer for the Hadith collections. You can select a book from the dropdown menu on the left, and choose whether you want to view the 'Detailler' version or not.")
56
-
57
- # Dark/Light mode button
58
- theme = st.sidebar.radio("Choose Theme", ("Dark", "Light"))
59
- if theme == "Dark":
60
- st.markdown(
61
- """
62
- <style>
63
- .css-17eq0hr {
64
- color: white;
65
- background-color: #1e1e1e;
66
- }
67
- </style>
68
- """,
69
- unsafe_allow_html=True,
70
- )
71
- else:
72
- st.markdown(
73
- """
74
- <style>
75
- .css-17eq0hr {
76
- color: black;
77
- background-color: #f4f4f4;
78
- }
79
- </style>
80
- """,
81
- unsafe_allow_html=True,
82
- )
83
-
84
- # Display image on HOME click
85
- if st.sidebar.button("HOME"):
86
- st.image("https://raw.githubusercontent.com/halimbahae/Hadith/main/Hadith_Books.jpg", caption="Hadith Books", use_column_width=True)
87
- st.write("This is a viewer for the Hadith collections. You can select a book from the dropdown menu on the left, and choose whether you want to view the 'Detailler' version or not.")
88
-
89
  # Load CSV file immediately when selected from the list
90
  file_url = f"https://raw.githubusercontent.com/halimbahae/Hadith/main/{selected_book}/{selected_file}"
91
  csv_df = pd.read_csv(file_url, header=None) # Assuming no header in CSV files
@@ -96,5 +70,14 @@ def main():
96
  else:
97
  st.error("Error loading CSV file")
98
 
 
 
 
 
 
 
 
 
 
99
  if __name__ == "__main__":
100
  main()
 
44
 
45
  # Main Streamlit app
46
  def main():
47
+ st.sidebar.title("Navigation")
48
+ st.sidebar.subheader("Search")
49
+ search_query = st.sidebar.text_input("Search")
50
+
51
+ st.sidebar.subheader("Actions")
52
+ if st.sidebar.button("Home"):
53
+ display_home()
54
+ if st.sidebar.button("Global Search"):
55
+ global_search(search_query)
56
+
57
  st.sidebar.title("Books")
58
  selected_book = st.sidebar.selectbox("Select a Book", list(book_files.keys()))
59
 
60
  selected_files = book_files[selected_book]
61
  selected_file = st.sidebar.selectbox("Select a File", selected_files)
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  # Load CSV file immediately when selected from the list
64
  file_url = f"https://raw.githubusercontent.com/halimbahae/Hadith/main/{selected_book}/{selected_file}"
65
  csv_df = pd.read_csv(file_url, header=None) # Assuming no header in CSV files
 
70
  else:
71
  st.error("Error loading CSV file")
72
 
73
+ def display_home():
74
+ st.title("Hadith Viewer")
75
+ st.image("https://raw.githubusercontent.com/halimbahae/Hadith/main/Hadith_Books.jpg", caption="Hadith Books", use_column_width=True)
76
+ st.write("This is a viewer for the Hadith collections. You can select a book from the dropdown menu on the left, and choose whether you want to view the 'Detailler' version or not.")
77
+
78
+ def global_search(query):
79
+ st.write(f"Performing global search for: {query}")
80
+ # Add your global search logic here
81
+
82
  if __name__ == "__main__":
83
  main()