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:
2026-04-29 01:20:54 +00:00
parent f2fdc10af7
commit 35ea21ad33
12 changed files with 85 additions and 6 deletions

8
.streamlit/config.toml Normal file
View File

@@ -0,0 +1,8 @@
[client]
toolbarMode = "minimal"
[server]
headless = true
[browser]
gatherUsageStats = false

View File

@@ -21,17 +21,15 @@ if str(_project_root) not in sys.path:
# Page config # Page config
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
from src.gui.components import hide_streamlit_chrome
st.set_page_config( st.set_page_config(
page_title="DataTools — Data Cleaning Mastery", page_title="DataTools — Data Cleaning Mastery",
page_icon="🧹", page_icon="🧹",
layout="wide", layout="wide",
) )
# Hide the Deploy button from the toolbar hide_streamlit_chrome()
st.markdown(
"<style>[data-testid='stAppDeployButton'] {display: none;}</style>",
unsafe_allow_html=True,
)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@@ -1,4 +1,4 @@
"""Reusable Streamlit widgets for the deduplicator GUI.""" """Reusable Streamlit widgets for the DataTools GUI."""
from __future__ import annotations from __future__ import annotations
@@ -24,6 +24,45 @@ from src.core.config import (
from src.core.normalizers import NormalizerType 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) # Config panel (advanced options)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@@ -19,10 +19,12 @@ from src.core.io import read_file, list_sheets, detect_encoding, detect_delimite
from src.gui.components import ( from src.gui.components import (
apply_review_decisions, apply_review_decisions,
config_panel, config_panel,
hide_streamlit_chrome,
match_group_card, match_group_card,
results_summary, results_summary,
) )
hide_streamlit_chrome()
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Session state defaults # Session state defaults

View File

@@ -11,6 +11,10 @@ _project_root = Path(__file__).resolve().parent.parent.parent.parent
if str(_project_root) not in sys.path: if str(_project_root) not in sys.path:
sys.path.insert(0, str(_project_root)) sys.path.insert(0, str(_project_root))
from src.gui.components import hide_streamlit_chrome
hide_streamlit_chrome()
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Header # Header
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@@ -11,6 +11,10 @@ _project_root = Path(__file__).resolve().parent.parent.parent.parent
if str(_project_root) not in sys.path: if str(_project_root) not in sys.path:
sys.path.insert(0, str(_project_root)) sys.path.insert(0, str(_project_root))
from src.gui.components import hide_streamlit_chrome
hide_streamlit_chrome()
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Header # Header
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@@ -11,6 +11,10 @@ _project_root = Path(__file__).resolve().parent.parent.parent.parent
if str(_project_root) not in sys.path: if str(_project_root) not in sys.path:
sys.path.insert(0, str(_project_root)) sys.path.insert(0, str(_project_root))
from src.gui.components import hide_streamlit_chrome
hide_streamlit_chrome()
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Header # Header
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@@ -11,6 +11,10 @@ _project_root = Path(__file__).resolve().parent.parent.parent.parent
if str(_project_root) not in sys.path: if str(_project_root) not in sys.path:
sys.path.insert(0, str(_project_root)) sys.path.insert(0, str(_project_root))
from src.gui.components import hide_streamlit_chrome
hide_streamlit_chrome()
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Header # Header
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@@ -11,6 +11,10 @@ _project_root = Path(__file__).resolve().parent.parent.parent.parent
if str(_project_root) not in sys.path: if str(_project_root) not in sys.path:
sys.path.insert(0, str(_project_root)) sys.path.insert(0, str(_project_root))
from src.gui.components import hide_streamlit_chrome
hide_streamlit_chrome()
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Header # Header
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@@ -11,6 +11,10 @@ _project_root = Path(__file__).resolve().parent.parent.parent.parent
if str(_project_root) not in sys.path: if str(_project_root) not in sys.path:
sys.path.insert(0, str(_project_root)) sys.path.insert(0, str(_project_root))
from src.gui.components import hide_streamlit_chrome
hide_streamlit_chrome()
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Header # Header
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@@ -11,6 +11,10 @@ _project_root = Path(__file__).resolve().parent.parent.parent.parent
if str(_project_root) not in sys.path: if str(_project_root) not in sys.path:
sys.path.insert(0, str(_project_root)) sys.path.insert(0, str(_project_root))
from src.gui.components import hide_streamlit_chrome
hide_streamlit_chrome()
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Header # Header
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@@ -11,6 +11,10 @@ _project_root = Path(__file__).resolve().parent.parent.parent.parent
if str(_project_root) not in sys.path: if str(_project_root) not in sys.path:
sys.path.insert(0, str(_project_root)) sys.path.insert(0, str(_project_root))
from src.gui.components import hide_streamlit_chrome
hide_streamlit_chrome()
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Header # Header
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------