feat(gui): promote Quit to a 'Close' menu item in the sidebar nav
Move the shutdown control out of the inline sidebar widget and into its own page (pages/99_Close.py), so it appears in the sidebar nav alongside the tool pages. An explicit confirm button on the page prevents accidental nav clicks from killing a live session. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
42
src/gui/pages/99_Close.py
Normal file
42
src/gui/pages/99_Close.py
Normal file
@@ -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")
|
||||
Reference in New Issue
Block a user