feat: hide Streamlit chrome for app-like appearance
Add shared hide_streamlit_chrome() helper that removes header bar, hamburger menu, footer, and deploy button via CSS injection. Called on every page. Add .streamlit/config.toml with minimal toolbar mode. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
8
.streamlit/config.toml
Normal file
8
.streamlit/config.toml
Normal file
@@ -0,0 +1,8 @@
|
||||
[client]
|
||||
toolbarMode = "minimal"
|
||||
|
||||
[server]
|
||||
headless = true
|
||||
|
||||
[browser]
|
||||
gatherUsageStats = false
|
||||
@@ -21,17 +21,15 @@ if str(_project_root) not in sys.path:
|
||||
# Page config
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
from src.gui.components import hide_streamlit_chrome
|
||||
|
||||
st.set_page_config(
|
||||
page_title="DataTools — Data Cleaning Mastery",
|
||||
page_icon="🧹",
|
||||
layout="wide",
|
||||
)
|
||||
|
||||
# Hide the Deploy button from the toolbar
|
||||
st.markdown(
|
||||
"<style>[data-testid='stAppDeployButton'] {display: none;}</style>",
|
||||
unsafe_allow_html=True,
|
||||
)
|
||||
hide_streamlit_chrome()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Reusable Streamlit widgets for the deduplicator GUI."""
|
||||
"""Reusable Streamlit widgets for the DataTools GUI."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -24,6 +24,45 @@ from src.core.config import (
|
||||
from src.core.normalizers import NormalizerType
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# App chrome — hide Streamlit default UI for app-like feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
_HIDE_CHROME_CSS = """
|
||||
<style>
|
||||
/* Hide Streamlit header bar */
|
||||
header[data-testid="stHeader"] {
|
||||
display: none !important;
|
||||
}
|
||||
/* Hide hamburger menu */
|
||||
button[kind="header"] {
|
||||
display: none !important;
|
||||
}
|
||||
#MainMenu {
|
||||
display: none !important;
|
||||
}
|
||||
/* Hide footer */
|
||||
footer {
|
||||
display: none !important;
|
||||
}
|
||||
/* Hide deploy button */
|
||||
[data-testid="stAppDeployButton"] {
|
||||
display: none !important;
|
||||
}
|
||||
/* Reclaim top padding lost from hidden header */
|
||||
.stAppViewBlockContainer,
|
||||
[data-testid="stAppViewBlockContainer"] {
|
||||
padding-top: 1rem !important;
|
||||
}
|
||||
</style>
|
||||
"""
|
||||
|
||||
|
||||
def hide_streamlit_chrome() -> None:
|
||||
"""Inject CSS to hide Streamlit's default header, menu, and footer."""
|
||||
st.markdown(_HIDE_CHROME_CSS, unsafe_allow_html=True)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Config panel (advanced options)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -19,10 +19,12 @@ from src.core.io import read_file, list_sheets, detect_encoding, detect_delimite
|
||||
from src.gui.components import (
|
||||
apply_review_decisions,
|
||||
config_panel,
|
||||
hide_streamlit_chrome,
|
||||
match_group_card,
|
||||
results_summary,
|
||||
)
|
||||
|
||||
hide_streamlit_chrome()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Session state defaults
|
||||
|
||||
@@ -11,6 +11,10 @@ _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
|
||||
|
||||
hide_streamlit_chrome()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Header
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -11,6 +11,10 @@ _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
|
||||
|
||||
hide_streamlit_chrome()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Header
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -11,6 +11,10 @@ _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
|
||||
|
||||
hide_streamlit_chrome()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Header
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -11,6 +11,10 @@ _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
|
||||
|
||||
hide_streamlit_chrome()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Header
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -11,6 +11,10 @@ _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
|
||||
|
||||
hide_streamlit_chrome()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Header
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -11,6 +11,10 @@ _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
|
||||
|
||||
hide_streamlit_chrome()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Header
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -11,6 +11,10 @@ _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
|
||||
|
||||
hide_streamlit_chrome()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Header
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -11,6 +11,10 @@ _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
|
||||
|
||||
hide_streamlit_chrome()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Header
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user