import { observer } from "mobx-react"; import * as React from "react"; import { useTranslation, Trans } from "react-i18next"; import { ConnectedButton } from "~/scenes/Settings/components/ConnectedButton"; import { IntegrationScene } from "~/scenes/Settings/components/IntegrationScene"; import { AvatarSize } from "~/components/Avatar"; import Heading from "~/components/Heading"; import List from "~/components/List"; import ListItem from "~/components/List/Item"; import Notice from "~/components/Notice"; import TeamLogo from "~/components/TeamLogo"; import Text from "~/components/Text"; import env from "~/env"; import useQuery from "~/hooks/useQuery"; import useStores from "~/hooks/useStores"; import FigmaIcon from "./Icon"; import { FigmaConnectButton } from "./components/FigmaButton"; import { IntegrationService, IntegrationType } from "@shared/types"; import type Integration from "~/models/Integration"; import Time from "~/components/Time"; function Figma() { const { integrations } = useStores(); const { t } = useTranslation(); const query = useQuery(); const error = query.get("error"); const appName = env.APP_NAME; const linkedAccountIntegration = integrations.find({ type: IntegrationType.LinkedAccount, service: IntegrationService.Figma, }) as Integration | undefined; const figmaAccount = linkedAccountIntegration?.settings?.figma?.account; return ( }> Figma {error === "access_denied" && ( Whoops, you need to accept the permissions in Figma 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.FIGMA_CLIENT_ID ? ( <> Link your {{ appName }} account to Figma to enable previews of design files you have access to, directly within documents. {linkedAccountIntegration ? ( Enabled on{" "} ) : (

} />

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