diff --git a/src/gui/components/_legacy.py b/src/gui/components/_legacy.py index fa03da9..1f59d11 100644 --- a/src/gui/components/_legacy.py +++ b/src/gui/components/_legacy.py @@ -72,16 +72,8 @@ footer { def hide_streamlit_chrome() -> None: - """Inject CSS to hide Streamlit's default header, menu, and footer. - - Also renders a Quit button at the bottom of the sidebar so every page - that hides the default chrome still has a clean way to shut the - server down. - """ + """Inject CSS to hide Streamlit's default header, menu, and footer.""" st.markdown(_HIDE_CHROME_CSS, unsafe_allow_html=True) - with st.sidebar: - st.markdown("---") - quit_button(key="quit_app_button_sidebar") # --------------------------------------------------------------------------- diff --git a/src/gui/pages/99_Close.py b/src/gui/pages/99_Close.py new file mode 100644 index 0000000..241b73e --- /dev/null +++ b/src/gui/pages/99_Close.py @@ -0,0 +1,42 @@ +"""Close — shut the DataTools server down cleanly. + +Lives in the sidebar nav alongside the tool pages so users have a +discoverable way to terminate the local Streamlit process without +having to Ctrl+C in the shell. An explicit confirm step prevents an +accidental sidebar click from killing a session mid-work. +""" + +from __future__ import annotations + +import sys +from pathlib import Path + +import streamlit as st + +_project_root = Path(__file__).resolve().parent.parent.parent.parent +if str(_project_root) not in sys.path: + sys.path.insert(0, str(_project_root)) + +from src.gui.components import hide_streamlit_chrome, quit_button + +st.set_page_config( + page_title="DataTools — Close", + page_icon="🛑", + layout="wide", +) + +hide_streamlit_chrome() + +st.title("🛑 Close DataTools") +st.caption("Shut down the local app and free the terminal.") +st.divider() + +st.markdown( + "Clicking the button below will terminate the DataTools server. " + "Any unsaved work in other tools will be lost. The browser tab " + "will show a connection-error message — that's expected; you can " + "close the tab once it appears." +) + +st.write("") +quit_button(label="Close the app", key="quit_app_button_page")