Skip to content

Commit

Permalink
Chat - remove avatar for typingIndicator and column gap when avatar i…
Browse files Browse the repository at this point in the history
…s not shown (#28397)
  • Loading branch information
Zedwag authored Nov 20, 2024
1 parent 827ff1b commit 1a7142e
Show file tree
Hide file tree
Showing 44 changed files with 3 additions and 43 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

.dx-chat-messagegroup-alignment-start {
grid-template-columns: $messagegroup-start-template;
}

.dx-chat-messagegroup-alignment-start:has(.dx-avatar) {
column-gap: $messagegroup-start-gap;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
$template,
$padding,
$row-gap,
$column-gap,
$font-size,
$color,
$bubble-padding-block,
Expand All @@ -20,7 +19,6 @@
grid-template-columns: $template;
padding-bottom: $padding;
row-gap: $row-gap;
column-gap: $column-gap;
}

.dx-chat-typingindicator-text {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
$chat-typingindicator-template,
$chat-typingindicator-padding,
$chat-typingindicator-row-gap,
$chat-typingindicator-column-gap,
$chat-typingindicator-font-size,
$chat-typingindicator-color,
$chat-typingindicator-bubble-padding-block,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ $chat-messagelist-day-header-first-padding-top: 20px !default;
$chat-typingindicator-template: $chat-messagegroup-alignment-start-template !default;
$chat-typingindicator-padding: null !default;
$chat-typingindicator-row-gap: $chat-messagegroup-gap !default;
$chat-typingindicator-column-gap: $chat-messagegroup-alignment-start-gap !default;
$chat-typingindicator-font-size: $chat-information-font-size !default;
$chat-typingindicator-bubble-padding-block: null !default;
$chat-typingindicator-bubble-padding-inline: null !default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
$chat-typingindicator-template,
$chat-typingindicator-padding,
$chat-typingindicator-row-gap,
$chat-typingindicator-column-gap,
$chat-typingindicator-font-size,
$chat-typingindicator-color,
$chat-typingindicator-bubble-padding-block,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ $chat-messagelist-day-header-first-padding-top: 20px !default;
$chat-typingindicator-template: $chat-messagegroup-alignment-start-template !default;
$chat-typingindicator-padding: null !default;
$chat-typingindicator-row-gap: $chat-messagegroup-gap !default;
$chat-typingindicator-column-gap: $chat-messagegroup-alignment-start-gap !default;
$chat-typingindicator-font-size: $chat-information-font-size !default;
$chat-typingindicator-bubble-padding-block: null !default;
$chat-typingindicator-bubble-padding-inline: null !default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
$chat-typingindicator-template,
$chat-typingindicator-padding,
$chat-typingindicator-row-gap,
$chat-typingindicator-column-gap,
$chat-typingindicator-font-size,
$chat-typingindicator-color,
$chat-typingindicator-bubble-padding-block,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ $chat-messagelist-day-header-first-padding-top: 20px !default;
$chat-typingindicator-template: $chat-messagegroup-alignment-start-template !default;
$chat-typingindicator-padding: null !default;
$chat-typingindicator-row-gap: $chat-messagegroup-gap !default;
$chat-typingindicator-column-gap: $chat-messagegroup-alignment-start-gap !default;
$chat-typingindicator-font-size: $chat-information-font-size !default;
$chat-typingindicator-bubble-padding-block: null !default;
$chat-typingindicator-bubble-padding-inline: null !default;
Expand Down
11 changes: 0 additions & 11 deletions packages/devextreme/js/__internal/ui/chat/typingindicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import type { User } from '@js/ui/chat';
import DOMComponent from '@ts/core/widget/dom_component';
import type { OptionChanged } from '@ts/core/widget/types';

import Avatar from './avatar';

const CHAT_TYPINGINDICATOR_CLASS = 'dx-chat-typingindicator';
const CHAT_TYPINGINDICATOR_CONTENT_CLASS = 'dx-chat-typingindicator-content';
const CHAT_TYPINGINDICATOR_TEXT_CLASS = 'dx-chat-typingindicator-text';
Expand Down Expand Up @@ -48,7 +46,6 @@ class TypingIndicator extends DOMComponent<TypingIndicator, Properties> {

_renderContent(): void {
this._renderContentElement();
this._renderAvatar();
this._renderTextElement();
this._updateText();
this._renderBubble();
Expand All @@ -60,14 +57,6 @@ class TypingIndicator extends DOMComponent<TypingIndicator, Properties> {
.appendTo(this.element());
}

_renderAvatar(): void {
if (this._$content) {
const $avatar = $('<div>').appendTo(this._$content);

this._createComponent($avatar, Avatar, { name: '' });
}
}

_renderTextElement(): void {
if (this._$content) {
this._$text = $('<div>')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ const CHAT_TYPINGINDICATOR_TEXT_CLASS = 'dx-chat-typingindicator-text';
const CHAT_TYPINGINDICATOR_BUBBLE_CLASS = 'dx-chat-typingindicator-bubble';
const CHAT_TYPINGINDICATOR_CIRCLE_CLASS = 'dx-chat-typingindicator-circle';

const AVATAR_CLASS = 'dx-avatar';

const moduleConfig = {
beforeEach: function() {
const init = (options = {}) => {
Expand All @@ -34,12 +32,6 @@ QUnit.module('TypingIndicator', moduleConfig, () => {
});

QUnit.module('Render', () => {
QUnit.test('root element should contain avatar element', function(assert) {
const $avatar = this.$element.find(`.${AVATAR_CLASS}`);

assert.strictEqual($avatar.length, 1);
});

QUnit.test('root element should contain text element', function(assert) {
const $text = this.$element.find(`.${CHAT_TYPINGINDICATOR_TEXT_CLASS}`);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
import $ from 'jquery';

import TypingIndicator from '__internal/ui/chat/typingindicator';
import Avatar from '__internal/ui/chat/avatar';

const CHAT_TYPINGINDICATOR_TEXT_CLASS = 'dx-chat-typingindicator-text';
const CHAT_TYPINGINDICATOR_BUBBLE_CLASS = 'dx-chat-typingindicator-bubble';
const CHAT_TYPINGINDICATOR_CIRCLE_CLASS = 'dx-chat-typingindicator-circle';

const AVATAR_CLASS = 'dx-avatar';

const moduleConfig = {
beforeEach: function() {
const init = (options = {}) => {
this.instance = new TypingIndicator($('#component'), options);

this.$element = $(this.instance.$element());

this.getAvatarElement = () => this.$element.find(`.${AVATAR_CLASS}`);
this.getTextElement = () => this.$element.find(`.${CHAT_TYPINGINDICATOR_TEXT_CLASS}`);
this.getBubbleElement = () => this.$element.find(`.${CHAT_TYPINGINDICATOR_BUBBLE_CLASS}`);
this.getCircleElement = () => this.$element.find(`.${CHAT_TYPINGINDICATOR_CIRCLE_CLASS}`);

this.$avatar = this.getAvatarElement();
this.$text = this.getTextElement();
this.$bubble = this.getBubbleElement();
this.$circles = this.getCircleElement();
Expand All @@ -38,16 +33,6 @@ const moduleConfig = {
};

QUnit.module('TypingIndicator', moduleConfig, () => {
QUnit.module('Avatar integration', () => {
QUnit.test('should have correct name option', function(assert) {
this.reinit({ typingUsers: [{}] });

const avatar = Avatar.getInstance(this.$avatar);

assert.strictEqual(avatar.option('name'), '');
});
});

QUnit.module('Render', () => {
QUnit.test('should be initialized with correct type', function(assert) {
assert.ok(this.instance instanceof TypingIndicator);
Expand Down Expand Up @@ -111,7 +96,6 @@ QUnit.module('TypingIndicator', moduleConfig, () => {

this.instance.option({ typingUsers: [{ name: 'Alice' }] });

assert.strictEqual(this.getAvatarElement().length, 1, 'Avatar is rendered');
assert.strictEqual(this.getTextElement().length, 1, 'Text is rendered');
assert.strictEqual(this.getBubbleElement().length, 1, 'Bubble is rendered');
assert.strictEqual(this.getCircleElement().length, 3, 'Circles are rendered');
Expand Down

0 comments on commit 1a7142e

Please sign in to comment.