import {Theme} from '@emotion/react'; import styled from '@emotion/styled'; import ActivityAuthor from 'sentry/components/activity/author'; import LinkWithConfirmation from 'sentry/components/links/linkWithConfirmation'; import {Tooltip} from 'sentry/components/tooltip'; import {t} from 'sentry/locale'; import ConfigStore from 'sentry/stores/configStore'; import {User} from 'sentry/types'; import EditorTools from './editorTools'; type Props = { authorName: string; onDelete: () => void; onEdit: () => void; user?: User; }; const NoteHeader = ({authorName, user, onEdit, onDelete}: Props) => { const activeUser = ConfigStore.get('user'); const canEdit = activeUser && (activeUser.isSuperuser || user?.id === activeUser.id); return (
{authorName} {canEdit && ( {t('Edit')} {t('Remove')} )}
); }; const getActionStyle = (p: {theme: Theme}) => ` padding: 0 7px; color: ${p.theme.gray200}; font-weight: normal; `; const Edit = styled('a')` ${getActionStyle}; margin-left: 7px; &:hover { color: ${p => p.theme.gray300}; } `; const Remove = styled('span')` ${getActionStyle}; border-left: 1px solid ${p => p.theme.border}; &:hover { color: ${p => p.theme.error}; } `; export default NoteHeader;