diff --git a/lib/static/components/controls/report-info.jsx b/lib/static/components/controls/report-info.jsx index de5c2ed97..110bdedfb 100644 --- a/lib/static/components/controls/report-info.jsx +++ b/lib/static/components/controls/report-info.jsx @@ -18,11 +18,7 @@ function ReportInfo(props) { const onNewUiButtonClick = () => { setUiMode(UiMode.New); - if (window.location.pathname.endsWith('.html')) { - window.location.href = '/new-ui.html'; - } else { - window.location.href = '/new-ui'; - } + window.location.pathname = window.location.pathname.replace(/\/(index\.html)?$/, (match, ending) => ending ? '/new-ui.html' : '/new-ui'); }; return ( diff --git a/lib/static/new-ui/components/MainLayout/index.module.css b/lib/static/new-ui/components/MainLayout/index.module.css index 3a10a1516..9171ac42f 100644 --- a/lib/static/new-ui/components/MainLayout/index.module.css +++ b/lib/static/new-ui/components/MainLayout/index.module.css @@ -7,6 +7,11 @@ width: 100%; } +:global(.gn-composite-bar-item):has(.footer-item:global(.disabled)) { + pointer-events: none; + opacity: .5; +} + .footer-item { color: var(--gn-aside-header-item-icon-color) !important; } diff --git a/lib/static/new-ui/components/MainLayout/index.tsx b/lib/static/new-ui/components/MainLayout/index.tsx index 0131c900c..6d489b2f6 100644 --- a/lib/static/new-ui/components/MainLayout/index.tsx +++ b/lib/static/new-ui/components/MainLayout/index.tsx @@ -65,7 +65,11 @@ export function MainLayout(props: MainLayoutProps): JSX.Element { current: isCurrent, itemWrapper: (params, makeItem) => makeItem({ ...params, - icon: + icon: }) }} /> ; diff --git a/lib/static/new-ui/components/SettingsPanel/index.tsx b/lib/static/new-ui/components/SettingsPanel/index.tsx index 1b0f4c5d7..959cb6ecc 100644 --- a/lib/static/new-ui/components/SettingsPanel/index.tsx +++ b/lib/static/new-ui/components/SettingsPanel/index.tsx @@ -23,11 +23,7 @@ export function SettingsPanel(): ReactNode { const onOldUiButtonClick = (): void => { setUiMode(UiMode.Old); - if (window.location.pathname.endsWith('.html')) { - window.location.href = '/index.html'; - } else { - window.location.href = '/'; - } + window.location.pathname = window.location.pathname.replace(/\/new-ui(\.html)?$/, (_match, ending) => ending ? '/index.html' : '/'); }; return
diff --git a/lib/static/template.html b/lib/static/template.html index 10c03ddd0..ece5474ef 100644 --- a/lib/static/template.html +++ b/lib/static/template.html @@ -16,18 +16,10 @@ uiMode = JSON.parse(localStorage.getItem('html-reporter:ui-mode')); } catch {} - if (uiMode === 'old' && window.location.pathname.startsWith('/new-ui')) { - if (window.location.pathname.endsWith('.html')) { - window.location.href = '/index.html'; - } else { - window.location.href = '/'; - } - } else if ((!uiMode || uiMode === 'new') && !window.location.pathname.startsWith('/new-ui')) { - if (window.location.pathname.endsWith('.html')) { - window.location.href = '/new-ui.html'; - } else { - window.location.href = '/new-ui'; - } + if (uiMode === 'old' && /\/new-ui(?:\.html)?$/.test(window.location.pathname)) { + window.location.pathname = window.location.pathname.replace(/\/new-ui(\.html)?$/, (match, ending) => ending ? '/index.html' : '/'); + } else if (uiMode === 'new' && !/\/new-ui(?:\.html)?$/.test(window.location.pathname)) { + window.location.pathname = window.location.pathname.replace(/\/(index\.html)?$/, (match, ending) => ending ? '/new-ui.html' : '/new-ui'); }