Files
outline/app/components/Sidebar/Settings.tsx
T
Tom Moor 222de9ef01 fix: Unconnected integrations appearing in settings sidebar (#11913)
* fix: Integrations list missing when language is not English

The group filter on the Integrations settings page compared against the
hardcoded string "Integrations" instead of the translated value from
t("Integrations"), causing no integrations to appear in non-English locales.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: Sidebar shows unconnected integrations in non-English locales

Same hardcoded "Integrations" string comparison issue as the main
integrations page — the sidebar filter skipped the connected-check
when the translated group name didn't match the English literal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 08:12:05 -04:00

108 lines
3.4 KiB
TypeScript

import groupBy from "lodash/groupBy";
import { observer } from "mobx-react";
import { BackIcon, SidebarIcon } from "outline-icons";
import { useCallback } from "react";
import { useTranslation } from "react-i18next";
import { useHistory, useLocation } from "react-router-dom";
import styled from "styled-components";
import { metaDisplay } from "@shared/utils/keyboard";
import Flex from "~/components/Flex";
import Scrollable from "~/components/Scrollable";
import useSettingsConfig from "~/hooks/useSettingsConfig";
import useStores from "~/hooks/useStores";
import isCloudHosted from "~/utils/isCloudHosted";
import { settingsPath } from "~/utils/routeHelpers";
import Tooltip from "../Tooltip";
import Sidebar from "./Sidebar";
import Header from "./components/Header";
import HistoryNavigation from "./components/HistoryNavigation";
import Section from "./components/Section";
import SidebarButton from "./components/SidebarButton";
import SidebarLink from "./components/SidebarLink";
import ToggleButton from "./components/ToggleButton";
import Version from "./components/Version";
function SettingsSidebar() {
const { ui, integrations } = useStores();
const { t } = useTranslation();
const history = useHistory();
const location = useLocation();
const configs = useSettingsConfig();
const groupedConfig = groupBy(
configs.filter((item) =>
item.group === t("Integrations") && item.pluginId
? integrations.findByService(item.pluginId)
: true
),
"group"
);
const returnToApp = useCallback(() => {
history.push("/home");
}, [history]);
return (
<Sidebar>
<HistoryNavigation />
<SidebarButton
title={t("Return to App")}
image={<StyledBackIcon />}
onClick={returnToApp}
>
<Tooltip content={t("Toggle sidebar")} shortcut={`${metaDisplay}+.`}>
<ToggleButton
aria-label={
ui.sidebarCollapsed ? t("Expand sidebar") : t("Collapse sidebar")
}
position="bottom"
image={<SidebarIcon />}
onClick={() => {
ui.toggleCollapsedSidebar();
(document.activeElement as HTMLElement)?.blur();
}}
/>
</Tooltip>
</SidebarButton>
<Flex auto column>
<Scrollable shadow>
{Object.keys(groupedConfig).map((header) => (
<Section key={header}>
<Header title={header}>
{groupedConfig[header].map((item) => (
<SidebarLink
key={item.path}
to={item.path}
onClickIntent={item.preload}
active={
item.path.startsWith(settingsPath("templates")) ||
item.path.startsWith(settingsPath("groups"))
? location.pathname.startsWith(item.path)
: undefined
}
icon={<item.icon />}
label={item.name}
/>
))}
</Header>
</Section>
))}
{!isCloudHosted && (
<Section>
<Header title={t("Installation")} />
<Version />
</Section>
)}
</Scrollable>
</Flex>
</Sidebar>
);
}
const StyledBackIcon = styled(BackIcon)`
margin-left: 4px;
`;
export default observer(SettingsSidebar);