feat(app): hide the editor settings section on native
The editor section configures the code editor, and the editor view on native is a "not available here" stub — every control in it was dead. `webOnly` mirrors the existing `desktopOnly` flag: the sidebar drops the item, and the section renders nothing if a stale restored route still points at it. Electron counts as web, so `isWeb` is the gate — desktop keeps the section.
This commit is contained in:
@@ -114,7 +114,6 @@ import { MetadataGenerationPage } from "@/screens/settings/metadata-generation-p
|
|||||||
import ProjectsScreen from "@/screens/projects-screen";
|
import ProjectsScreen from "@/screens/projects-screen";
|
||||||
import ProjectSettingsScreen from "@/screens/project-settings-screen";
|
import ProjectSettingsScreen from "@/screens/project-settings-screen";
|
||||||
import { SETTINGS_DESKTOP_SIDEBAR_WIDTH, useIsCompactFormFactor } from "@/constants/layout";
|
import { SETTINGS_DESKTOP_SIDEBAR_WIDTH, useIsCompactFormFactor } from "@/constants/layout";
|
||||||
import { isNative } from "@/constants/platform";
|
|
||||||
import { useLocalDaemonServerId } from "@/hooks/use-is-local-daemon";
|
import { useLocalDaemonServerId } from "@/hooks/use-is-local-daemon";
|
||||||
import {
|
import {
|
||||||
type EnableBuiltInDaemonOption,
|
type EnableBuiltInDaemonOption,
|
||||||
@@ -128,6 +127,7 @@ import {
|
|||||||
} from "@/utils/host-routes";
|
} from "@/utils/host-routes";
|
||||||
import { useLastWorkspaceSelection } from "@/stores/navigation-active-workspace-store";
|
import { useLastWorkspaceSelection } from "@/stores/navigation-active-workspace-store";
|
||||||
import { returnFromSettings, type SettingsView } from "@/navigation/settings-navigation";
|
import { returnFromSettings, type SettingsView } from "@/navigation/settings-navigation";
|
||||||
|
import { isNative, isWeb } from "@/constants/platform";
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// View model
|
// View model
|
||||||
@@ -138,12 +138,13 @@ interface SidebarSectionItem {
|
|||||||
labelKey: string;
|
labelKey: string;
|
||||||
icon: ComponentType<{ size: number; color: string }>;
|
icon: ComponentType<{ size: number; color: string }>;
|
||||||
desktopOnly?: boolean;
|
desktopOnly?: boolean;
|
||||||
|
webOnly?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SIDEBAR_SECTION_ITEMS: SidebarSectionItem[] = [
|
const SIDEBAR_SECTION_ITEMS: SidebarSectionItem[] = [
|
||||||
{ id: "general", labelKey: "settings.sections.general", icon: Settings },
|
{ id: "general", labelKey: "settings.sections.general", icon: Settings },
|
||||||
{ id: "appearance", labelKey: "settings.sections.appearance", icon: Palette },
|
{ id: "appearance", labelKey: "settings.sections.appearance", icon: Palette },
|
||||||
{ id: "editor", labelKey: "settings.sections.editor", icon: Code2 },
|
{ id: "editor", labelKey: "settings.sections.editor", icon: Code2, webOnly: true },
|
||||||
{ id: "shortcuts", labelKey: "settings.sections.shortcuts", icon: Keyboard, desktopOnly: true },
|
{ id: "shortcuts", labelKey: "settings.sections.shortcuts", icon: Keyboard, desktopOnly: true },
|
||||||
{
|
{
|
||||||
id: "integrations",
|
id: "integrations",
|
||||||
@@ -1004,7 +1005,9 @@ function SettingsSidebar({
|
|||||||
const hasHosts = sortedHosts.length > 0;
|
const hasHosts = sortedHosts.length > 0;
|
||||||
const enableBuiltInDaemonOption = useEnableBuiltInDaemonOption();
|
const enableBuiltInDaemonOption = useEnableBuiltInDaemonOption();
|
||||||
const isDesktopApp = isElectronRuntime();
|
const isDesktopApp = isElectronRuntime();
|
||||||
const items = SIDEBAR_SECTION_ITEMS.filter((item) => !item.desktopOnly || isDesktopApp);
|
const items = SIDEBAR_SECTION_ITEMS.filter(
|
||||||
|
(item) => (!item.desktopOnly || isDesktopApp) && (!item.webOnly || isWeb),
|
||||||
|
);
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
const isDesktop = layout === "desktop";
|
const isDesktop = layout === "desktop";
|
||||||
const outerContainerStyle = useMemo(
|
const outerContainerStyle = useMemo(
|
||||||
@@ -1424,7 +1427,7 @@ export default function SettingsScreen({ view, openAddHostIntent = null }: Setti
|
|||||||
case "appearance":
|
case "appearance":
|
||||||
return <AppearanceSection />;
|
return <AppearanceSection />;
|
||||||
case "editor":
|
case "editor":
|
||||||
return <EditorSection />;
|
return isWeb ? <EditorSection /> : null;
|
||||||
case "shortcuts":
|
case "shortcuts":
|
||||||
return isDesktopApp ? <KeyboardShortcutsSection /> : null;
|
return isDesktopApp ? <KeyboardShortcutsSection /> : null;
|
||||||
case "integrations":
|
case "integrations":
|
||||||
|
|||||||
Reference in New Issue
Block a user