Skip to content

Commit

Permalink
chore: make code more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
janmonschke committed May 20, 2022
1 parent f88cb30 commit c33b051
Showing 1 changed file with 26 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { AGENT_STATUS_FIELD_NAME } from '../../../../timelines/components/timeli

const FIELDS_WITHOUT_ACTIONS: { [field: string]: boolean } = { [AGENT_STATUS_FIELD_NAME]: true };

const style = { flexGrow: 0 };

export const SummaryValueCell: React.FC<AlertSummaryRow['description']> = ({
data,
eventId,
Expand All @@ -25,32 +27,36 @@ export const SummaryValueCell: React.FC<AlertSummaryRow['description']> = ({
timelineId,
values,
isReadOnly,
}) => (
<>
<FieldValueCell
contextId={timelineId}
data={data}
eventId={eventId}
fieldFromBrowserField={fieldFromBrowserField}
linkValue={linkValue}
isDraggable={isDraggable}
style={{ flexGrow: 0 }}
values={values}
/>
{timelineId !== TimelineId.active && !isReadOnly && !FIELDS_WITHOUT_ACTIONS[data.field] && (
<ActionCell
}) => {
const hoverActionsEnabled = !FIELDS_WITHOUT_ACTIONS[data.field];

return (
<>
<FieldValueCell
contextId={timelineId}
data={data}
eventId={eventId}
fieldFromBrowserField={fieldFromBrowserField}
linkValue={linkValue}
timelineId={timelineId}
isDraggable={isDraggable}
style={style}
values={values}
applyWidthAndPadding={false}
hideAddToTimeline={false}
/>
)}
</>
);
{timelineId !== TimelineId.active && !isReadOnly && hoverActionsEnabled && (
<ActionCell
contextId={timelineId}
data={data}
eventId={eventId}
fieldFromBrowserField={fieldFromBrowserField}
linkValue={linkValue}
timelineId={timelineId}
values={values}
applyWidthAndPadding={false}
hideAddToTimeline={false}
/>
)}
</>
);
};

SummaryValueCell.displayName = 'SummaryValueCell';

0 comments on commit c33b051

Please sign in to comment.