discourse/plugins/chat/assets/javascripts/discourse/components/chat-thread.hbs
Joffrey JAFFEUX e6c6c342d9
REFACTOR: composer/thread (#21910)
This commit contains multiple changes to improve the composer behavior especially in the context of a thread:

- Generally rename anything of the form `chatChannelThread...` to `chatThread...``
- Moves the textarea interactor instance inside the composer server
- Improves the focus state and closing of panel related to the use of the Escape shortcut
- Creates `Chat::ThreadList` as a component instead of having `Chat::Thread::ListItem` and others which could imply they were children of a the `Chat::Thread` component
2023-06-07 21:49:15 +02:00

61 lines
1.7 KiB
Handlebars

<div
class={{concat-class
"chat-thread"
(if this.loading "loading")
(if @thread.staged "staged")
}}
data-id={{@thread.id}}
{{did-insert this.setUploadDropZone}}
{{did-insert this.didUpdateThread}}
{{did-update this.didUpdateThread @thread.id}}
{{will-destroy this.unsubscribeFromUpdates}}
>
{{#if @includeHeader}}
<Chat::Thread::Header @channel={{@thread.channel}} @thread={{@thread}} />
{{/if}}
<div
class="chat-thread__body popper-viewport"
{{did-insert this.setScrollable}}
{{on "scroll" this.computeScrollState passive=true}}
>
<div
class="chat-thread__messages chat-messages-scroll chat-messages-container"
{{chat/on-resize this.didResizePane (hash delay=10)}}
>
{{#each @thread.messages key="id" as |message|}}
<ChatMessage
@message={{message}}
@resendStagedMessage={{this.resendStagedMessage}}
@messageDidEnterViewport={{this.messageDidEnterViewport}}
@messageDidLeaveViewport={{this.messageDidLeaveViewport}}
@context="thread"
/>
{{/each}}
{{#if this.loading}}
<ChatSkeleton />
{{/if}}
</div>
</div>
{{#if this.chatThreadPane.selectingMessages}}
<ChatSelectionManager
@selectedMessageIds={{this.chatThreadPane.selectedMessageIds}}
@chatChannel={{@channel}}
@cancelSelecting={{action
this.chatThreadPane.cancelSelecting
@channel.selectedMessages
}}
@context="thread"
/>
{{else}}
<Chat::Composer::Thread
@channel={{@channel}}
@thread={{@thread}}
@onSendMessage={{this.onSendMessage}}
@uploadDropZone={{this.uploadDropZone}}
/>
{{/if}}
<ChatUploadDropZone @model={{@thread}} />
</div>