Skip to content

Commit

Permalink
Fixing highlighting of message in message table by id. (6.1) (#21390)
Browse files Browse the repository at this point in the history
* Fixing highlighting of message in message table by id.

* Typing improvements.

* Adding changelog snippet.
  • Loading branch information
dennisoelkers authored Jan 21, 2025
1 parent 2813ab5 commit 717b97b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/issue-19058.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type = "fixed"
message = "Fixing highlighting of message in message table by id."

issues = ["19058"]
pulls = ["21389"]
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as React from 'react';
import { useCallback, useContext, useMemo } from 'react';
import PropTypes from 'prop-types';
import * as Immutable from 'immutable';
import styled, { css } from 'styled-components';
import styled from 'styled-components';

import { AdditionalContext } from 'views/logic/ActionContext';
import { useStore } from 'stores/connect';
Expand Down Expand Up @@ -52,11 +52,11 @@ export const TableBody = styled.tbody<{ $expanded?: boolean, $highlighted?: bool
&& {
border-top: 0;
${$expanded ? css`
${$expanded ? `
border-left: 7px solid ${theme.colors.variant.light.info};
` : ''}
${$highlighted ? css`
${$highlighted ? `
border-left: 7px solid ${theme.colors.variant.light.success};
` : ''}
}
Expand Down Expand Up @@ -100,19 +100,19 @@ type Props = {
message: Message,
selectedFields?: Immutable.OrderedSet<string>,
showMessageRow?: boolean,
toggleDetail: (string) => void,
toggleDetail: (messageId: string) => void,
};

const isDecoratedField = (field, decorationStats) => decorationStats
const isDecoratedField = (field: string | number, decorationStats: Message['decoration_stats']) => decorationStats
&& (decorationStats.added_fields[field] !== undefined || decorationStats.changed_fields[field] !== undefined);

const fieldType = (fieldName, { decoration_stats: decorationStats }: {
decoration_stats?: any
}, fields) => (isDecoratedField(fieldName, decorationStats)
? FieldType.Decorated
: ((fields && fields.find((f) => f.name === fieldName)) || { type: FieldType.Unknown }).type);
const fieldType = (fieldName: string, { decoration_stats: decorationStats }: Message, fields: FieldTypeMappingsList) => (
isDecoratedField(fieldName, decorationStats)
? FieldType.Decorated
: ((fields?.find((f) => f.name === fieldName)) ?? { type: FieldType.Unknown }).type
);

const Strong = ({ children, strong = false }: React.PropsWithChildren<{ strong: boolean }>) => (strong
const Strong = ({ children = undefined, strong }: React.PropsWithChildren<{ strong: boolean }>) => (strong
? <strong>{children}</strong>

: <>{children}</>);
Expand Down

0 comments on commit 717b97b

Please sign in to comment.