1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-24 17:51:14 +02:00
unleash.unleash/frontend/src/component/addons/AddonForm/AddonInstall/AddonInstall.tsx
Nuno Góis 383e522127
feat: Slack App addon (#4238)
https://linear.app/unleash/issue/2-1232/implement-first-iteration-of-the-new-slack-app-addon

This PR implements the first iteration of the new Slack App addon.
Unlike the old Slack addon, this one uses a Slack App (bot) that is
installed to Slack workspaces in order to post messages. This uses
`@slack/web-api`, which internally uses the latest Slack API endpoints
like `postMessage`.

This is currently behind a flag: `slackAppAddon`.

The current flow is that the Unleash Slack App is installed from
whatever source:
 - Unleash addons page;
 - Direct link;
 - https://unleash-slack-app.vercel.app/ (temporary URL);
 - Slack App Directory (in the future);
 - Etc;

After installed, we resolve the authorization to an `access_token` that
the user can paste into the Unleash Slack App addon configuration form.


https://github.com/Unleash/unleash/assets/14320932/6a6621b9-5b8a-4921-a279-30668be6d46c

Co-authored by: @daveleek

---------

Co-authored-by: David Leek <david@getunleash.io>
2023-07-14 09:49:34 +01:00

40 lines
1.0 KiB
TypeScript

import React from 'react';
import {
StyledFormSection,
StyledHelpText,
StyledTitle,
} from '../AddonForm.styles';
import { Button } from '@mui/material';
import { Link } from 'react-router-dom';
export interface IAddonInstallProps {
url: string;
title?: string;
helpText?: string;
}
export const AddonInstall = ({
url,
title = 'Install addon',
helpText = 'Click this button to install this addon.',
}: IAddonInstallProps) => {
return (
<React.Fragment>
<StyledFormSection>
<StyledTitle>{title}</StyledTitle>
<StyledHelpText>{helpText}</StyledHelpText>
<Button
type="button"
variant="outlined"
component={Link}
target="_blank"
rel="noopener noreferrer"
to={url}
>
Install
</Button>
</StyledFormSection>
</React.Fragment>
);
};