Spaces:
Sleeping
Sleeping
Commit ·
73e6979
1
Parent(s): 41c32b9
app.py
CHANGED
|
@@ -1,16 +1,59 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# Sidebar Navigation
|
| 6 |
-
st.sidebar
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from streamlit_option_menu import option_menu
|
| 3 |
+
import json
|
| 4 |
|
| 5 |
+
# Load ikon dari JSON
|
| 6 |
+
with open("icons.json", "r") as file:
|
| 7 |
+
icons_dict = json.load(file)
|
| 8 |
+
|
| 9 |
+
# Daftar menu utama
|
| 10 |
+
menu_options = list(icons_dict.keys())
|
| 11 |
+
|
| 12 |
+
# Ambil ikon dari JSON sesuai urutan menu
|
| 13 |
+
menu_icons = [icons_dict[option] for option in menu_options]
|
| 14 |
|
| 15 |
# Sidebar Navigation
|
| 16 |
+
with st.sidebar:
|
| 17 |
+
selected = option_menu("Nekopoi", menu_options, icons=menu_icons, menu_icon="cast", default_index=0)
|
| 18 |
+
|
| 19 |
+
# Menu horizontal
|
| 20 |
+
selected2 = option_menu(None, ["Home", "Upload", "Tasks", "Settings"],
|
| 21 |
+
icons=['house', 'cloud-upload', "list-task", 'gear'],
|
| 22 |
+
menu_icon="cast", default_index=0, orientation="horizontal")
|
| 23 |
+
|
| 24 |
+
# Panggil file lain berdasarkan menu sidebar
|
| 25 |
+
if selected == "Home":
|
| 26 |
+
from pages import home
|
| 27 |
+
home.run()
|
| 28 |
+
elif selected == "Trending":
|
| 29 |
+
from pages import trending
|
| 30 |
+
trending.run()
|
| 31 |
+
elif selected == "Categories":
|
| 32 |
+
from pages import categories
|
| 33 |
+
categories.run()
|
| 34 |
+
elif selected == "Favorites":
|
| 35 |
+
from pages import favorites
|
| 36 |
+
favorites.run()
|
| 37 |
+
elif selected == "History":
|
| 38 |
+
from pages import history
|
| 39 |
+
history.run()
|
| 40 |
+
elif selected == "Settings":
|
| 41 |
+
from pages import settings
|
| 42 |
+
settings.run()
|
| 43 |
+
elif selected == "Help":
|
| 44 |
+
from pages import help
|
| 45 |
+
help.run()
|
| 46 |
+
elif selected == "About":
|
| 47 |
+
from pages import about
|
| 48 |
+
about.run()
|
| 49 |
|
| 50 |
+
# Panggil file lain berdasarkan menu horizontal
|
| 51 |
+
if selected2 == "Upload":
|
| 52 |
+
from pages import upload
|
| 53 |
+
upload.run()
|
| 54 |
+
elif selected2 == "Tasks":
|
| 55 |
+
from pages import tasks
|
| 56 |
+
tasks.run()
|
| 57 |
+
elif selected2 == "Settings":
|
| 58 |
+
from pages import settings
|
| 59 |
+
settings.run()
|