// @flow import * as React from 'react'; import { inject, observer } from 'mobx-react'; import { find } from 'lodash'; import styled from 'styled-components'; import Button from 'components/Button'; import CenteredContent from 'components/CenteredContent'; import PageTitle from 'components/PageTitle'; import HelpText from 'components/HelpText'; import SlackButton from './components/SlackButton'; import CollectionsStore from 'stores/CollectionsStore'; import IntegrationsStore from 'stores/IntegrationsStore'; import Notice from 'shared/components/Notice'; import getQueryVariable from 'shared/utils/getQueryVariable'; type Props = { collections: CollectionsStore, integrations: IntegrationsStore, }; @observer class Slack extends React.Component { error: ?string; componentDidMount() { this.error = getQueryVariable('error'); this.props.integrations.fetchPage(); } get commandIntegration() { return find(this.props.integrations.slackIntegrations, { type: 'command', }); } render() { const { collections, integrations } = this.props; return (

Slack

{this.error === 'access_denied' && ( Whoops, you need to accept the permissions in Slack to connect Outline to your team. Try again? )} Preview Outline links your team mates share and use the{' '} /outline slash command in Slack to search for documents in your teams wiki.

{this.commandIntegration ? ( ) : ( )}

 

Collections

Connect Outline collections to Slack channels and messages will be posted in Slack when documents are published or updated. {collections.orderedData.map(collection => { const integration = find(integrations.slackIntegrations, { collectionId: collection.id, }); if (integration) { return ( {collection.name} posting activity to the{' '} {integration.settings.channel} Slack channel ); } return ( {collection.name} ); })}
); } } const List = styled.ol` list-style: none; margin: 8px 0; padding: 0; `; const ListItem = styled.li` display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #eaebea; `; const Code = styled.code` padding: 4px 6px; margin: 0 2px; background: #eaebea; border-radius: 4px; `; export default inject('collections', 'integrations')(Slack);