import styled from '@emotion/styled'; import {Button, LinkButton} from 'sentry/components/button'; import ConfirmDelete from 'sentry/components/confirmDelete'; import {IconDelete, IconStats, IconUpgrade} from 'sentry/icons'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import type {SentryApp} from 'sentry/types/integrations'; import type {Organization} from 'sentry/types/organization'; type Props = { app: SentryApp; onDelete: (app: SentryApp) => void; org: Organization; showDelete: boolean; showPublish: boolean; disableDeleteReason?: string; // If you want to disable the publish or delete buttons, pass in a reason to display to the user in a tooltip disablePublishReason?: string; onPublish?: () => void; }; function ActionButtons({ org, app, showPublish, showDelete, onPublish, onDelete, disablePublishReason, disableDeleteReason, }: Props) { const appDashboardButton = ( } to={`/settings/${org.slug}/developer-settings/${app.slug}/dashboard/`} > {t('Dashboard')} ); const publishRequestButton = showPublish ? ( } size="xs" onClick={onPublish} > {t('Publish')} ) : null; const deleteConfirmMessage = t( `Deleting %s will also delete any and all of its installations. This is a permanent action. Do you wish to continue?`, app.slug ); const deleteButton = showDelete ? ( disableDeleteReason ? ( } aria-label={t('Delete')} /> ) : ( onDelete && ( onDelete(app)} > } aria-label={t('Delete')} /> ) ) ) : null; return ( {appDashboardButton} {publishRequestButton} {deleteButton} ); } const ButtonHolder = styled('div')` flex-direction: row; display: flex; & > * { margin-left: ${space(0.5)}; } `; const StyledButton = styled(Button)` color: ${p => p.theme.subText}; `; const StyledLinkButton = styled(LinkButton)` color: ${p => p.theme.subText}; `; export default ActionButtons;