Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add logo and avatar #32

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions emma/streamlit_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
)


def set_page_config(title: str, icon: str | None = None, wide: bool | None = True):
def set_page_config(title: str | None = None, wide: bool | None = True):
icon = "static/emma-assist-character.png"
if wide:
st.set_page_config(page_title=title, page_icon=icon, layout="wide")
else:
Expand Down Expand Up @@ -74,11 +75,13 @@ def input_infrahub_address():
def ensure_infrahub_address_and_branch():
# Input Infrahub address via UI if not set
if not get_instance_address():
st.info("""
st.info(
"""
No INFRAHUB_ADDRESS found in your environment variable.

Please set the Infrahub Address.
""")
"""
)
input_infrahub_address()

# Check if infrahub_address is set and get the client
Expand Down Expand Up @@ -130,3 +133,11 @@ def update_infrahub_instance_button(sidebar: DG):
def add_create_branch_button(sidebar: DG):
if sidebar.button("Create a new branch"):
create_branch_dialog()


def display_logo():
st.logo(
"static/opsmill-logo.png",
link="https://github.com/opsmill",
icon_image="static/opsmill-logo.png",
)
16 changes: 9 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
from emma.streamlit_utils import ensure_infrahub_address_and_branch, set_page_config
from menu import menu

set_page_config(title="Home", icon=":wave:")
set_page_config(title="Homepage")

st.write("# Welcome to Emma! :wave:")
# Set columns to receive content
left, right = st.columns([1, 1.6], gap="medium", vertical_alignment="center")

st.markdown(
# Left is for Emma avatar
left.image("static/emma-assist-character.png", caption="Hello, I'm Emma")

# Right is for the text
right.write("# Welcome! :wave:")
right.markdown(
"""
Emma is an agent designed to help you interact with Infrahub.

Expand All @@ -22,9 +28,5 @@
if "infrahub_address" not in st.session_state:
st.session_state.infrahub_address = None

# if "infrahub_branch" not in st.session_state:
# st.session_state.infrahub_branch = None
# st.session_state._infrahub_branch = st.session_state.infrahub_branch

ensure_infrahub_address_and_branch()
menu()
6 changes: 4 additions & 2 deletions menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
add_create_branch_button,
display_branch_selector,
display_infrahub_address,
display_logo,
update_infrahub_instance_button,
)

Expand All @@ -12,6 +13,8 @@ def menu():
if "infrahub_address" not in st.session_state or st.session_state.infrahub_address is None:
st.sidebar.page_link("main.py", label="🏠 Homepage")
return
# Display Opsmill logo
display_logo()
# Display current Infrahub Instance
display_infrahub_address(st.sidebar)
update_infrahub_instance_button(st.sidebar)
Expand All @@ -23,10 +26,9 @@ def menu():
st.sidebar.page_link("main.py", label="🏠 Homepage")
st.sidebar.page_link("pages/data_exporter.py", label="🔭 Data Exporter")
st.sidebar.page_link("pages/data_importer.py", label="📥 Data Importer")
st.sidebar.page_link("pages/schema_load.py", label="📦 Schema Loader")
st.sidebar.page_link("pages/schema_loader.py", label="📦 Schema Loader")
st.sidebar.page_link("pages/schema_builder.py", label="👷 Schema Builder")
st.sidebar.page_link("pages/schema_visualizer.py", label="👀 Schema Visualizer")
st.sidebar.divider()


def menu_with_redirect():
Expand Down
Binary file added static/emma-assist-character.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/opsmill-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading