Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing highlighting of message in message table by id. (6.1) #21390

Merged
merged 3 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading