Indicate when reaction is from the current user

This commit is contained in:
Ken Powers 2020-01-29 13:58:50 -08:00 committed by GitHub
parent c2d1979c1e
commit 7461250caf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 105 additions and 28 deletions

View file

@ -14,10 +14,12 @@ interface Props {
export class Intl extends React.Component<Props> {
public static defaultProps: Partial<Props> = {
renderText: ({ text }) => text,
renderText: ({ text, key }) => (
<React.Fragment key={key}>{text}</React.Fragment>
),
};
public getComponent(index: number): FullJSX | undefined {
public getComponent(index: number, key: number): FullJSX | undefined {
const { id, components } = this.props;
if (!components || !components.length || components.length <= index) {
@ -29,7 +31,7 @@ export class Intl extends React.Component<Props> {
return;
}
return components[index];
return <React.Fragment key={key}>{components[index]}</React.Fragment>;
}
public render() {
@ -61,8 +63,9 @@ export class Intl extends React.Component<Props> {
key += 1;
}
results.push(this.getComponent(componentIndex));
results.push(this.getComponent(componentIndex, key));
componentIndex += 1;
key += 1;
// @ts-ignore
lastTextIndex = FIND_REPLACEMENTS.lastIndex;