-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed chat styling and scroll behaviour, implemented chat feed and us…
…es socket for messages, logs and attachments, several chat functionality improvements
- Loading branch information
Showing
14 changed files
with
478 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,15 @@ | ||
{{yield}} | ||
<a href="#" class="chat-attachment-container" {{on "click" this.download}}> | ||
{{#if this.chatAttachment.isImage}} | ||
<Image src={{this.chatAttachment.url}} @fallbackSrc={{config "defaultValues.placeholderImage"}} alt={{this.chatAttachment.filename}} class="chat-attachment-image-preview" /> | ||
{{else}} | ||
<div class="chat-attachment-file-preview"> | ||
<div class="file-icon file-icon-{{this.extension}}"> | ||
<FaIcon @icon={{this.icon}} /> | ||
</div> | ||
<div class="chat-attachment-file-preview-filename">{{this.chatAttachment.filename}}</div> | ||
</div> | ||
{{/if}} | ||
<Attach::Tooltip @class="clean" @animation="scale" @placement="top"> | ||
<InputInfo @text="Click to download attachment" /> | ||
</Attach::Tooltip> | ||
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,47 @@ | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { action } from '@ember/object'; | ||
import getWithDefault from '@fleetbase/ember-core/utils/get-with-default'; | ||
|
||
export default class ChatWindowAttachmentComponent extends Component {} | ||
export default class ChatWindowAttachmentComponent extends Component { | ||
@tracked chatAttachment; | ||
@tracked icon; | ||
|
||
constructor(owner, { record }) { | ||
super(...arguments); | ||
this.chatAttachment = record; | ||
this.icon = this.getIcon(record); | ||
} | ||
|
||
@action download() { | ||
return this.chatAttachment.download(); | ||
} | ||
|
||
getExtension(chatAttachment) { | ||
const filename = chatAttachment.filename; | ||
const extensionMatch = filename.match(/\.(.+)$/); | ||
return extensionMatch ? extensionMatch[1] : null; | ||
} | ||
|
||
getIcon(chatAttachment) { | ||
this.extension = this.getExtension(chatAttachment); | ||
|
||
return getWithDefault( | ||
{ | ||
xlsx: 'file-excel', | ||
xls: 'file-excel', | ||
xlsb: 'file-excel', | ||
xlsm: 'file-excel', | ||
csv: 'file-spreadsheet', | ||
tsv: 'file-spreadsheet', | ||
docx: 'file-word', | ||
docm: 'file-word', | ||
pdf: 'file-pdf', | ||
ppt: 'file-powerpoint', | ||
pptx: 'file-powerpoint', | ||
}, | ||
this.extension, | ||
'file-alt' | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
{{yield}} | ||
{{#if (has-block)}} | ||
{{yield @channel.feed}} | ||
{{else}} | ||
{{#each @channel.feed as |item|}} | ||
{{component (concat "chat-window/" item.type) record=item.record}} | ||
{{/each}} | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
{{yield}} | ||
<div class="chat-log-container"> | ||
<div class="chat-log-content-bubble-container"> | ||
<div class="chat-log-content-bubble"> | ||
{{this.chatLog.resolved_content}} | ||
</div> | ||
<div class="chat-log-created-at">{{this.chatLog.createdAgo}}</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
|
||
export default class ChatWindowLogComponent extends Component {} | ||
export default class ChatWindowLogComponent extends Component { | ||
@tracked chatLog; | ||
constructor(owner, { record }) { | ||
super(...arguments); | ||
this.chatLog = record; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,22 @@ | ||
{{yield}} | ||
<div class="chat-message-container {{if this.chatMessage.attachments "has-attachments"}}"> | ||
<div class="chat-message-sender-bubble"> | ||
<Image src={{this.chatMessage.sender.avatar_url}} @fallbackSrc={{config "defaultValues.userImage"}} alt={{this.chatMessage.sender.name}} /> | ||
<div class="chat-message-sender-name">{{this.chatMessage.sender.name}}</div> | ||
<Attach::Tooltip @class="clean" @animation="scale" @placement="top"> | ||
<InputInfo @text={{this.chatMessage.sender.name}} /> | ||
</Attach::Tooltip> | ||
</div> | ||
<div class="chat-message-content-bubble-container {{if this.chatMessage.attachments "has-attachments"}}"> | ||
{{#if this.chatMessage.attachments}} | ||
<div class="chat-message-attachments-container"> | ||
{{#each this.chatMessage.attachments as |attachment|}} | ||
<ChatWindow::Attachment @record={{attachment}} /> | ||
{{/each}} | ||
</div> | ||
{{/if}} | ||
<div class="chat-message-content-bubble {{if (eq this.chatMessage.sender_uuid this.currentUser.id) 'sender-bubble'}}"> | ||
{{this.chatMessage.content}} | ||
</div> | ||
<div class="chat-message-created-at">{{this.chatMessage.createdAgo}}</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
|
||
export default class ChatWindowMessageComponent extends Component {} | ||
export default class ChatWindowMessageComponent extends Component { | ||
@tracked chatMessage; | ||
constructor(owner, { record }) { | ||
super(...arguments); | ||
this.chatMessage = record; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.