import {RouteComponentProps} from 'react-router'; import styled from '@emotion/styled'; import {Button} from 'sentry/components/button'; import ClippedBox from 'sentry/components/clippedBox'; import Confirm from 'sentry/components/confirm'; import Link from 'sentry/components/links/link'; import Panel from 'sentry/components/panels/panel'; import PanelBody from 'sentry/components/panels/panelBody'; import PanelHeader from 'sentry/components/panels/panelHeader'; import {IconDelete} from 'sentry/icons'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import {Project} from 'sentry/types'; import recreateRoute from 'sentry/utils/recreateRoute'; import {LoaderScript} from 'sentry/views/settings/project/projectKeys/list/loaderScript'; import ProjectKeyCredentials from 'sentry/views/settings/project/projectKeys/projectKeyCredentials'; import {ProjectKey} from 'sentry/views/settings/project/projectKeys/types'; type Props = { data: ProjectKey; hasWriteAccess: boolean; onRemove: (data: ProjectKey) => void; onToggle: (isActive: boolean, data: ProjectKey) => void; orgId: string; project: Project; projectId: string; } & Pick, 'routes' | 'location' | 'params'>; function KeyRow({ data, onRemove, onToggle, hasWriteAccess, routes, location, params, project, }: Props) { const handleEnable = () => onToggle(true, data); const handleDisable = () => onToggle(false, data); const editUrl = recreateRoute(`${data.id}/`, {routes, params, location}); const platform = project.platform || 'other'; const isBrowserJavaScript = platform === 'javascript'; const isJsPlatform = platform.startsWith('javascript'); return ( <PanelHeaderLink to={editUrl}>{data.label}</PanelHeaderLink> {!data.isActive && ( <small> {' \u2014 '} {t('Disabled')} </small> )} onRemove(data)} confirmText={t('Remove Key')} message={t( 'Are you sure you want to remove this key? This action is irreversible.' )} >