import { observer } from "mobx-react"; import { PlusIcon } from "outline-icons"; import * as React from "react"; import { useTranslation, Trans } from "react-i18next"; import { IntegrationService } from "@shared/types"; import { ConnectedButton } from "~/scenes/Settings/components/ConnectedButton"; import { IntegrationScene } from "~/scenes/Settings/components/IntegrationScene"; import { AvatarSize } from "~/components/Avatar"; import Flex from "~/components/Flex"; import Heading from "~/components/Heading"; import List from "~/components/List"; import ListItem from "~/components/List/Item"; import Notice from "~/components/Notice"; import PlaceholderText from "~/components/PlaceholderText"; import TeamLogo from "~/components/TeamLogo"; import Text from "~/components/Text"; import Time from "~/components/Time"; import env from "~/env"; import useQuery from "~/hooks/useQuery"; import useStores from "~/hooks/useStores"; import LinearIcon from "./Icon"; import { LinearConnectButton } from "./components/LinearButton"; function Linear() { const { integrations } = useStores(); const { t } = useTranslation(); const query = useQuery(); const error = query.get("error"); const appName = env.APP_NAME; React.useEffect(() => { void integrations.fetchAll({ service: IntegrationService.Linear, withRelations: true, }); }, [integrations]); return ( }> Linear {error === "access_denied" && ( Whoops, you need to accept the permissions in Linear to connect{" "} {{ appName }} to your workspace. Try again? )} {error === "unauthenticated" && ( Something went wrong while authenticating your request. Please try logging in again. )} {error === "unknown" && ( Something went wrong while processing your request. Please try again. )} {env.LINEAR_CLIENT_ID ? ( <> Enable previews of Linear issues in documents by connecting a Linear workspace to {appName}. {integrations.linear.length ? ( <> {t("Connected")} } /> {integrations.linear.map((integration) => { const linearWorkspace = integration.settings?.linear?.workspace; const integrationCreatedBy = integration.user ? integration.user.name : undefined; return ( Enabled by {{ integrationCreatedBy }}{" "} ·{" "} ) : (

} />

)} ) : ( The Linear integration is currently disabled. Please set the associated environment variables and restart the server to enable the integration. )}
); } export default observer(Linear);