From ec1fa316519086300ffe0062a55970302b77032e Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Wed, 3 Apr 2024 18:12:41 +0800 Subject: [PATCH] moved locale selector as tray componentm, created basic aht components --- addon/components/chat-container.hbs | 5 +- addon/components/chat-container.js | 18 +- addon/components/chat-tray.hbs | 27 ++ addon/components/chat-tray.js | 29 +++ addon/components/chat-window.hbs | 55 ++++- addon/components/chat-window.js | 38 ++- addon/components/layout/header.hbs | 2 + addon/components/locale-selector-tray.hbs | 30 +++ addon/components/locale-selector-tray.js | 144 +++++++++++ addon/components/notification-tray.hbs | 68 +++--- addon/styles/addon.css | 1 + addon/styles/components/attacher.css | 6 +- addon/styles/components/chat.css | 230 ++++++++++++++++++ addon/styles/components/dashboard.css | 2 +- addon/styles/components/drawer.css | 8 +- addon/styles/components/full-calendar.css | 12 +- addon/styles/components/input.css | 9 +- addon/styles/components/kanban.css | 10 +- addon/styles/components/navbar.css | 8 +- addon/styles/components/notification-tray.css | 4 +- addon/styles/components/otp-input.css | 12 +- addon/styles/components/table.css | 6 +- addon/styles/components/tabs.css | 2 +- addon/styles/components/timeline.css | 2 +- addon/styles/layout/legacy.css | 2 +- addon/styles/layout/next.css | 39 +-- app/components/chat-tray.js | 1 + app/components/locale-selector-tray.js | 1 + .../integration/components/chat-tray-test.js | 26 ++ .../components/locale-selector-tray-test.js | 26 ++ 30 files changed, 709 insertions(+), 114 deletions(-) create mode 100644 addon/components/chat-tray.hbs create mode 100644 addon/components/chat-tray.js create mode 100644 addon/components/locale-selector-tray.hbs create mode 100644 addon/components/locale-selector-tray.js create mode 100644 addon/styles/components/chat.css create mode 100644 app/components/chat-tray.js create mode 100644 app/components/locale-selector-tray.js create mode 100644 tests/integration/components/chat-tray-test.js create mode 100644 tests/integration/components/locale-selector-tray-test.js diff --git a/addon/components/chat-container.hbs b/addon/components/chat-container.hbs index 18fc8ac..26819fe 100644 --- a/addon/components/chat-container.hbs +++ b/addon/components/chat-container.hbs @@ -1,6 +1,5 @@ -
- Chat - {{#each this.chatChannels as |chatChannel|}} +
+ {{#each this.chat.openChannels as |chatChannel|}} {{/each}}
\ No newline at end of file diff --git a/addon/components/chat-container.js b/addon/components/chat-container.js index 8a15ca9..146800d 100644 --- a/addon/components/chat-container.js +++ b/addon/components/chat-container.js @@ -1,21 +1,11 @@ import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; +import { inject as service } from '@ember/service'; import { action } from '@ember/object'; export default class ChatContainerComponent extends Component { - @tracked chatChannels = [{ - title: "test", - public_id: "test", - chats: [ - { - owner: "Doljko", - message: "Hello" - } - ] - }]; - @tracked isVisible = false; - - @action openChatbox () { - this.isVisible = true + @service chat; + constructor(owner) { + super(...arguments); } } diff --git a/addon/components/chat-tray.hbs b/addon/components/chat-tray.hbs new file mode 100644 index 0000000..1c24f18 --- /dev/null +++ b/addon/components/chat-tray.hbs @@ -0,0 +1,27 @@ +
+ + +
+ + {{!-- {{#if this.notifications.length}} +
{{this.notifications.length}}
+ {{/if}} --}} +
+
+ +
+
+
+
+ {{#each this.channels as |channel|}} + + {{/each}} +
+
+
+
+
\ No newline at end of file diff --git a/addon/components/chat-tray.js b/addon/components/chat-tray.js new file mode 100644 index 0000000..2bbcb35 --- /dev/null +++ b/addon/components/chat-tray.js @@ -0,0 +1,29 @@ +import Component from '@glimmer/component'; +import { tracked } from '@glimmer/tracking'; +import { inject as service } from '@ember/service'; +import { action } from '@ember/object'; +import { task } from 'ember-concurrency'; + +export default class ChatTrayComponent extends Component { + @service chat; + @service socket; + @tracked channels = []; + + constructor(owner) { + super(...arguments); + this.chat.loadChannels.perform({ + withChannels: (channels) => { + this.channels = channels; + }, + }); + } + + @action openChannel(chatChannelRecord) { + this.chat.openChannel(chatChannelRecord); + } + + @action startChat() { + const chatChannelRecord = this.chat.createChatChannel(); + this.openChannel(chatChannelRecord); + } +} diff --git a/addon/components/chat-window.hbs b/addon/components/chat-window.hbs index 7fb614e..354e24f 100644 --- a/addon/components/chat-window.hbs +++ b/addon/components/chat-window.hbs @@ -1,15 +1,46 @@ -{{! template-lint-disable no-inline-styles }} -
-
Lanna
-
- hi,how are you? -
-
-
- -
-
- + +
+
+
+ {{#each this.channel.participants as |chatParticipant|}} +
{{chatParticipant.name}}
+ {{/each}} +
+
+
+ {{#each this.channel.messages as |chatMessage|}} +
+
+ {{this.user.name}} +
{{chatMessage.sender.name}}
+
+
+
+ {{chatMessage.content}} +
+
{{chatMessage.createdAgo}}
+
+
+ {{/each}} +
+
+
+
+