mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
fix(debug/sidebar): make debug toggle control debug section visibility and fix sidebar hidden items tracking
- Sync debugMode with showDebug in Sidebar (was using enableRequestLogs env var) - Only render debug-section sidebar toggles in AppearanceTab when debugMode=true - Sidebar filters debug-section items based on debugMode (was already correct) - Debug toggle now triggers omniroute:settings-updated event for instant sidebar update EOF
This commit is contained in:
@@ -106,7 +106,10 @@ export default function AppearanceTab() {
|
||||
{ id: "cyan", color: COLOR_THEMES.cyan, label: t("themeCyan") },
|
||||
];
|
||||
|
||||
const sidebarSections = SIDEBAR_SECTIONS.map((section) => ({
|
||||
const showDebug = settings.debugMode === true;
|
||||
const sidebarSections = SIDEBAR_SECTIONS.filter(
|
||||
(section) => section.visibility !== "debug" || showDebug
|
||||
).map((section) => ({
|
||||
...section,
|
||||
title: getSidebarLabel(section.titleKey, section.titleFallback),
|
||||
items: section.items.map((item) => ({ ...item, label: tSidebar(item.i18nKey) })),
|
||||
|
||||
@@ -40,7 +40,7 @@ export default function Sidebar({
|
||||
|
||||
useEffect(() => {
|
||||
const applySettings = (data) => {
|
||||
setShowDebug(data?.enableRequestLogs === true);
|
||||
setShowDebug(data?.debugMode === true);
|
||||
setHiddenSidebarItems(normalizeHiddenSidebarItems(data?.[HIDDEN_SIDEBAR_ITEMS_SETTING_KEY]));
|
||||
};
|
||||
|
||||
@@ -52,8 +52,8 @@ export default function Sidebar({
|
||||
const handleSettingsUpdated = (event: Event) => {
|
||||
const detail = (event as CustomEvent<Record<string, unknown>>).detail || {};
|
||||
|
||||
if ("enableRequestLogs" in detail) {
|
||||
setShowDebug(detail.enableRequestLogs === true);
|
||||
if ("debugMode" in detail) {
|
||||
setShowDebug(detail.debugMode === true);
|
||||
}
|
||||
|
||||
if (HIDDEN_SIDEBAR_ITEMS_SETTING_KEY in detail) {
|
||||
|
||||
Reference in New Issue
Block a user