Skip to content

Commit

Permalink
feat(ui-kit/chat): update
Browse files Browse the repository at this point in the history
  • Loading branch information
njfamirm authored and AliMD committed Mar 6, 2023
1 parent c191e09 commit 3c51a71
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
12 changes: 8 additions & 4 deletions ui/ui-kit/src/chat/chat-footer.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {AlwatrBaseElement, css, customElement, html} from '@alwatr/element';
import {setLocale, localeContextConsumer, commonLocale} from '@alwatr/i18n';

import './chat-text-input.js';
import '../button/icon-button.js';

import type {IconButtonContent} from '../button/icon-button.js';

declare global {
interface HTMLElementTagNameMap {
'alwatr-chat-footer': AlwatrChatFooter;
Expand Down Expand Up @@ -36,12 +37,15 @@ export class AlwatrChatFooter extends AlwatrBaseElement {
override render(): unknown {
this._logger.logMethod('render');
return html`
<alwatr-icon-button .icon=${'happy-outline'} @click=${this._changeLocale}></alwatr-icon-button>
<alwatr-icon-button
.content=${<IconButtonContent>{icon: 'happy-outline'}}
@click=${this._sendMessage}
></alwatr-icon-button>
<alwatr-chat-text-input></alwatr-chat-text-input>
`;
}

protected _changeLocale(): void {
setLocale(localeContextConsumer.getValue()?.language !== 'fa' ? commonLocale.fa : commonLocale.en);
protected _sendMessage(): void {
this._logger.logMethod('_sendMessage');
}
}
5 changes: 3 additions & 2 deletions ui/ui-kit/src/chat/chat-list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AlwatrBaseElement, css, customElement, html, nothing, property} from '@alwatr/element';
import {AlwatrBaseElement, css, customElement, html, mapObject, nothing, property} from '@alwatr/element';

import './chat-message.js';

Expand Down Expand Up @@ -75,7 +75,8 @@ export class AlwatrChatList extends AlwatrBaseElement {
override render(): unknown {
this._logger.logMethod('render');
if (this.storage == null) return nothing;
return html`${map(
return html`${mapObject(
this,
this.storage.data,
(message) => html`
<alwatr-chat-message .message=${message} ?self=${message.from === this.currentUser}></alwatr-chat-message>
Expand Down
13 changes: 6 additions & 7 deletions ui/ui-kit/src/chat/chat-text-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {message} from '@alwatr/i18n';

import '../button/icon-button.js';

import type {AlwatrStandardIconButton} from '../button/icon-button.js';
import type {AlwatrStandardIconButton, IconButtonContent} from '../button/icon-button.js';

declare global {
interface HTMLElementTagNameMap {
Expand Down Expand Up @@ -67,12 +67,11 @@ export class AlwatrChatTextInput extends LocalizeMixin(SignalMixin(AlwatrBaseEle
override render(): unknown {
this._logger.logMethod('render');
return html`
<textarea
rows="1"
placeholder=${message('chat_text_input_placeholder')}
@input=${this.__inputChange}
></textarea>
<alwatr-icon-button .icon=${'send'} flip-rtl disabled></alwatr-icon-button>
<textarea rows="1" placeholder=${message('chat_text_input_placeholder')} @input=${this.__inputChange}></textarea>
<alwatr-icon-button
.content=${<IconButtonContent>{icon: 'send-outline', flipRtl: true}}
disabled
></alwatr-icon-button>
`;
}

Expand Down
1 change: 0 additions & 1 deletion uniquely/com-pwa/src/page-order/page-order-tracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
property,
UnresolvedMixin,
} from '@alwatr/element';
import {message} from '@alwatr/i18n';
import '@alwatr/ui-kit/button/button.js';
import '@alwatr/ui-kit/card/surface.js';
import '@alwatr/ui-kit/chat/chat.js';
Expand Down

0 comments on commit 3c51a71

Please sign in to comment.