From d876bf99fbba52739e4efc20ae65e21c96db4735 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 8 May 2025 21:20:06 -0400 Subject: [PATCH] Add filtering --- app/scenes/Settings/Integrations.tsx | 24 +++++++++++++++---- .../Settings}/components/IntegrationCard.tsx | 8 +++---- shared/i18n/locales/en_US/translation.json | 10 ++++---- 3 files changed, 29 insertions(+), 13 deletions(-) rename app/{ => scenes/Settings}/components/IntegrationCard.tsx (89%) diff --git a/app/scenes/Settings/Integrations.tsx b/app/scenes/Settings/Integrations.tsx index aadbe3dc43..8865acabfa 100644 --- a/app/scenes/Settings/Integrations.tsx +++ b/app/scenes/Settings/Integrations.tsx @@ -3,33 +3,49 @@ import { Trans, useTranslation } from "react-i18next"; import styled from "styled-components"; import Flex from "@shared/components/Flex"; import Heading from "~/components/Heading"; -import IntegrationCard from "~/components/IntegrationCard"; +import InputSearch from "~/components/InputSearch"; import Scene from "~/components/Scene"; import Text from "~/components/Text"; import useSettingsConfig from "~/hooks/useSettingsConfig"; import { settingsPath } from "~/utils/routeHelpers"; +import IntegrationCard from "./components/IntegrationCard"; +import { StickyFilters } from "./components/StickyFilters"; export function Integrations() { const { t } = useTranslation(); let items = useSettingsConfig(); + const [query, setQuery] = React.useState(""); + + const handleQuery = (event: React.ChangeEvent) => { + setQuery(event.target.value); + }; items = items .filter( (item) => item.group === "Integrations" && item.enabled && - item.path !== settingsPath("integrations") + item.path !== settingsPath("integrations") && + item.name.toLowerCase().includes(query.toLowerCase()) ) .sort((item) => (item.isActive ? -1 : 1)); return ( {t("Integrations")} - + - Enable and configure a variety of integrations with Outline. + Configure a variety of integrations with third-party services. + + + {items.map((item) => ( diff --git a/app/components/IntegrationCard.tsx b/app/scenes/Settings/components/IntegrationCard.tsx similarity index 89% rename from app/components/IntegrationCard.tsx rename to app/scenes/Settings/components/IntegrationCard.tsx index 9df4a1ca9a..4a22768a36 100644 --- a/app/components/IntegrationCard.tsx +++ b/app/scenes/Settings/components/IntegrationCard.tsx @@ -4,9 +4,9 @@ import { Link } from "react-router-dom"; import styled from "styled-components"; import { s, ellipsis } from "@shared/styles"; import { ConfigItem } from "~/hooks/useSettingsConfig"; -import Button from "./Button"; -import Flex from "./Flex"; -import Text from "./Text"; +import Button from "../../../components/Button"; +import Flex from "../../../components/Flex"; +import Text from "../../../components/Text"; type Props = { integration: ConfigItem; @@ -23,7 +23,7 @@ function IntegrationCard({ integration }: Props) { {integration.isActive && {t("Connected")}} diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index c14fc46d78..0b2eb1c280 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -299,9 +299,6 @@ "Can edit": "Can edit", "No access": "No access", "Default access": "Default access", - "Connected": "Connected", - "Configure": "Configure", - "Install": "Install", "Change Language": "Change Language", "Dismiss": "Dismiss", "You’re offline.": "You’re offline.", @@ -524,6 +521,7 @@ "Groups": "Groups", "Shared Links": "Shared Links", "Import": "Import", + "Install": "Install", "Revoke token": "Revoke token", "Revoke": "Revoke", "Show path to document": "Show path to document", @@ -851,6 +849,7 @@ "Revoking": "Revoking", "Are you sure you want to revoke the {{ tokenName }} token?": "Are you sure you want to revoke the {{ tokenName }} token?", "Disconnect integration": "Disconnect integration", + "Connected": "Connected", "Disconnect": "Disconnect", "Disconnecting": "Disconnecting", "Allowed domains": "Allowed domains", @@ -909,6 +908,8 @@ "{{ count }} document imported_plural": "{{ count }} documents imported", "You can import a zip file that was previously exported from an Outline installation – collections, documents, and images will be imported. In Outline, open Export in the Settings sidebar and click on Export Data.": "You can import a zip file that was previously exported from an Outline installation – collections, documents, and images will be imported. In Outline, open Export in the Settings sidebar and click on Export Data.", "Drag and drop the zip file from the Markdown export option in {{appName}}, or click to upload": "Drag and drop the zip file from the Markdown export option in {{appName}}, or click to upload", + "Configure": "Configure", + "Connect": "Connect", "Last active": "Last active", "Guest": "Guest", "Shared by": "Shared by", @@ -967,7 +968,7 @@ "Enterprise": "Enterprise", "Quickly transfer your existing documents, pages, and files from other tools and services into {{appName}}. You can also drag and drop any HTML, Markdown, and text documents directly into Collections in the app.": "Quickly transfer your existing documents, pages, and files from other tools and services into {{appName}}. You can also drag and drop any HTML, Markdown, and text documents directly into Collections in the app.", "Recent imports": "Recent imports", - "Enable and configure a variety of integrations with Outline.": "Enable and configure a variety of integrations with Outline.", + "Configure a variety of integrations with third-party services.": "Configure a variety of integrations with third-party services.", "Could not load members": "Could not load members", "Everyone that has signed into {{appName}} is listed here. It’s possible that there are other users who have access through {{signinMethods}} but haven’t signed in yet.": "Everyone that has signed into {{appName}} is listed here. It’s possible that there are other users who have access through {{signinMethods}} but haven’t signed in yet.", "Receive a notification whenever a new document is published": "Receive a notification whenever a new document is published", @@ -1080,7 +1081,6 @@ "Expires today": "Expires today", "Expires tomorrow": "Expires tomorrow", "Expires {{ date }}": "Expires {{ date }}", - "Connect": "Connect", "Whoops, you need to accept the permissions in GitHub to connect {{appName}} to your workspace. Try again?": "Whoops, you need to accept the permissions in GitHub to connect {{appName}} to your workspace. Try again?", "Something went wrong while authenticating your request. Please try logging in again.": "Something went wrong while authenticating your request. Please try logging in again.", "The owner of GitHub account has been requested to install the {{githubAppName}} GitHub app. Once approved, previews will be shown for respective links.": "The owner of GitHub account has been requested to install the {{githubAppName}} GitHub app. Once approved, previews will be shown for respective links.",