Update group name colors

This commit is contained in:
Josh Perez 2021-06-07 12:50:18 -04:00 committed by GitHub
parent a374772dc8
commit df7f702dde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 13 deletions

View file

@ -912,8 +912,6 @@
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
color: $color-white-alpha-90;
&__profile-name { &__profile-name {
@include font-caption-bold-italic; @include font-caption-bold-italic;
} }

View file

@ -17,6 +17,7 @@ import {
import { LocalizerType } from '../../types/Util'; import { LocalizerType } from '../../types/Util';
import { ConversationType } from '../../state/ducks/conversations'; import { ConversationType } from '../../state/ducks/conversations';
import { assert } from '../../util/assert'; import { assert } from '../../util/assert';
import { ContactNameColorType } from '../../types/Colors';
export type Contact = Pick< export type Contact = Pick<
ConversationType, ConversationType,
@ -45,6 +46,7 @@ export type Contact = Pick<
export type Props = { export type Props = {
contacts: Array<Contact>; contacts: Array<Contact>;
contactNameColor?: ContactNameColorType;
errors: Array<Error>; errors: Array<Error>;
message: MessagePropsDataType; message: MessagePropsDataType;
receivedAt: number; receivedAt: number;
@ -232,6 +234,7 @@ export class MessageDetail extends React.Component<Props> {
sentAt, sentAt,
clearSelectedMessage, clearSelectedMessage,
contactNameColor,
deleteMessage, deleteMessage,
deleteMessageForEveryone, deleteMessageForEveryone,
displayTapToViewMessage, displayTapToViewMessage,
@ -263,6 +266,7 @@ export class MessageDetail extends React.Component<Props> {
<Message <Message
{...message} {...message}
clearSelectedMessage={clearSelectedMessage} clearSelectedMessage={clearSelectedMessage}
contactNameColor={contactNameColor}
deleteMessage={deleteMessage} deleteMessage={deleteMessage}
deleteMessageForEveryone={deleteMessageForEveryone} deleteMessageForEveryone={deleteMessageForEveryone}
disableMenu disableMenu

View file

@ -15,6 +15,7 @@ import { StateType } from '../reducer';
import { getIntl, getInteractionMode } from '../selectors/user'; import { getIntl, getInteractionMode } from '../selectors/user';
import { renderAudioAttachment } from './renderAudioAttachment'; import { renderAudioAttachment } from './renderAudioAttachment';
import { renderEmojiPicker } from './renderEmojiPicker'; import { renderEmojiPicker } from './renderEmojiPicker';
import { getContactNameColorSelector } from '../selectors/conversations';
type MessageDetailProps = ComponentProps<typeof MessageDetail>; type MessageDetailProps = ComponentProps<typeof MessageDetail>;
@ -79,8 +80,17 @@ const mapStateToProps = (
showVisualAttachment, showVisualAttachment,
} = props; } = props;
const contactNameColor =
message.conversationType === 'group'
? getContactNameColorSelector(state)(
message.conversationId,
message.author.id
)
: undefined;
return { return {
contacts, contacts,
contactNameColor,
errors, errors,
message, message,
receivedAt, receivedAt,

View file

@ -1862,12 +1862,12 @@ describe('both/state/selectors/conversations', () => {
const contactNameColorSelector = getContactNameColorSelector(state); const contactNameColorSelector = getContactNameColorSelector(state);
assert.equal(contactNameColorSelector('group', 'gfe'), '200'); assert.equal(contactNameColorSelector('group', 'gfe'), '200');
assert.equal(contactNameColorSelector('group', 'jih'), '150'); assert.equal(contactNameColorSelector('group', 'jih'), '120');
assert.equal(contactNameColorSelector('group', 'mlk'), '010'); assert.equal(contactNameColorSelector('group', 'mlk'), '300');
assert.equal(contactNameColorSelector('group', 'pon'), '300'); assert.equal(contactNameColorSelector('group', 'pon'), '010');
assert.equal(contactNameColorSelector('group', 'srq'), '210'); assert.equal(contactNameColorSelector('group', 'srq'), '330');
assert.equal(contactNameColorSelector('group', 'vut'), '090'); assert.equal(contactNameColorSelector('group', 'vut'), '230');
assert.equal(contactNameColorSelector('group', 'zyx'), '330'); assert.equal(contactNameColorSelector('group', 'zyx'), '180');
}); });
}); });
}); });

View file

@ -44,19 +44,19 @@ export const ConversationColors = [
export const ContactNameColors = [ export const ContactNameColors = [
'200', '200',
'150', '120',
'010',
'300', '300',
'010',
'210', '210',
'090',
'330', '330',
'230', '230',
'030',
'180', '180',
'030',
'340', '340',
'270', '270',
'090',
'000', '000',
'120', '150',
'240', '240',
'040', '040',
'160', '160',