Test-Streamlit / app.py
GilbertClaus's picture
init
047b16c
import streamlit as st
from streamlit_option_menu import option_menu
import json
from page import *
# 🛠 Set konfigurasi halaman di awal
st.set_page_config(page_title="Nekopoi", layout="wide")
# Load ikon dari JSON
with open("icons.json", "r") as file:
icons_dict = json.load(file)
# Daftar menu utama
menu_options = list(icons_dict.keys())
# Ambil ikon dari JSON sesuai urutan menu
menu_icons = [icons_dict[option] for option in menu_options]
# Sidebar Navigation
with st.sidebar:
selected = option_menu("Nekopoi", menu_options, icons=menu_icons, menu_icon="cast", default_index=0)
# Menu horizontal
selected2 = option_menu(None, ["Home", "Upload", "Tasks", "Settings"],
icons=['house', 'cloud-upload', "list-task", 'gear'],
menu_icon="cast", default_index=0, orientation="horizontal")
# Panggil file lain berdasarkan menu sidebar
if selected == "Home":
home.run()
elif selected == "Trending":
trending.run()
elif selected == "Categories":
categories.run()
elif selected == "Favorites":
favorites.run()
elif selected == "History":
history.run()
elif selected == "Settings":
settings.run()
elif selected == "Help":
help.run()
elif selected == "About":
about.run()
# Panggil file lain berdasarkan menu horizontal
if selected2 == "Upload":
upload.run()
elif selected2 == "Tasks":
tasks.run()
elif selected2 == "Settings":
settings.run()