From dac5b4f975ea62a141852837ba08f719ef53eb9f Mon Sep 17 00:00:00 2001 From: Sonderau Date: Sat, 17 Jan 2026 01:12:34 +0000 Subject: [PATCH] Add [DEV] prefix to page title on dev environment --- os-league-tools-master/src/App.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/os-league-tools-master/src/App.js b/os-league-tools-master/src/App.js index e525ee5b..08a2d9b1 100644 --- a/os-league-tools-master/src/App.js +++ b/os-league-tools-master/src/App.js @@ -41,6 +41,12 @@ history.listen(() => { } }); +const isDevEnvironment = () => { + return window.location.hostname.startsWith('dev.') || + window.location.hostname === 'localhost' || + window.location.port === '3001'; +}; + export default function App() { useEffect(() => { if (trackingId) { @@ -52,6 +58,28 @@ export default function App() { } }, []); + // Prefix title with [DEV] on dev environment + useEffect(() => { + if (!isDevEnvironment()) return; + + const prefixTitle = () => { + if (!document.title.startsWith('[DEV] ')) { + document.title = '[DEV] ' + document.title; + } + }; + + prefixTitle(); + + // Watch for title changes and re-prefix + const observer = new MutationObserver(prefixTitle); + const titleElement = document.querySelector('title'); + if (titleElement) { + observer.observe(titleElement, { childList: true, characterData: true, subtree: true }); + } + + return () => observer.disconnect(); + }, []); + return (