diff --git a/plugins/chat/assets/javascripts/discourse/components/styleguide/chat-thread-list-item.hbs b/plugins/chat/assets/javascripts/discourse/components/styleguide/chat-thread-list-item.hbs new file mode 100644 index 00000000000..b4c67be041e --- /dev/null +++ b/plugins/chat/assets/javascripts/discourse/components/styleguide/chat-thread-list-item.hbs @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/plugins/chat/assets/javascripts/discourse/components/styleguide/chat-thread-list-item.js b/plugins/chat/assets/javascripts/discourse/components/styleguide/chat-thread-list-item.js new file mode 100644 index 00000000000..b6108bb0271 --- /dev/null +++ b/plugins/chat/assets/javascripts/discourse/components/styleguide/chat-thread-list-item.js @@ -0,0 +1,9 @@ +import Component from "@glimmer/component"; +import fabricators from "discourse/plugins/chat/discourse/lib/fabricators"; +import { inject as service } from "@ember/service"; + +export default class ChatStyleguideChatThreadListItem extends Component { + @service currentUser; + + thread = fabricators.thread(); +} diff --git a/plugins/chat/assets/javascripts/discourse/components/styleguide/organisms/chat.hbs b/plugins/chat/assets/javascripts/discourse/components/styleguide/organisms/chat.hbs index 85c37a190fa..a1fe944aac2 100644 --- a/plugins/chat/assets/javascripts/discourse/components/styleguide/organisms/chat.hbs +++ b/plugins/chat/assets/javascripts/discourse/components/styleguide/organisms/chat.hbs @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/plugins/chat/assets/javascripts/discourse/lib/fabricators.js b/plugins/chat/assets/javascripts/discourse/lib/fabricators.js index 9e483f47d4d..6c514b1e08b 100644 --- a/plugins/chat/assets/javascripts/discourse/lib/fabricators.js +++ b/plugins/chat/assets/javascripts/discourse/lib/fabricators.js @@ -11,6 +11,7 @@ import ChatChannel, { } from "discourse/plugins/chat/discourse/models/chat-channel"; import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message"; import ChatThread from "discourse/plugins/chat/discourse/models/chat-thread"; +import ChatThreadPreview from "discourse/plugins/chat/discourse/models/chat-thread-preview"; import ChatDirectMessage from "discourse/plugins/chat/discourse/models/chat-direct-message"; import ChatMessageReaction from "discourse/plugins/chat/discourse/models/chat-message-reaction"; import User from "discourse/models/user"; @@ -126,6 +127,14 @@ function threadFabricator(args = {}) { return ChatThread.create(channel, { id: args.id || sequence++, original_message: args.original_message || messageFabricator({ channel }), + preview: args.preview || threadPreviewFabricator({ channel }), + }); +} +function threadPreviewFabricator(args = {}) { + return ChatThreadPreview.create({ + last_reply_id: args.last_reply_id || sequence++, + last_reply_created_at: args.last_reply_created_at || Date.now(), + last_reply_excerpt: args.last_reply_excerpt || "This is a reply", }); } @@ -163,6 +172,7 @@ export default { directMessageChannel: directMessageChannelFabricator, message: messageFabricator, thread: threadFabricator, + threadPreview: threadPreviewFabricator, reaction: reactionFabricator, upload: uploadFabricator, category: categoryFabricator, diff --git a/plugins/chat/assets/javascripts/discourse/models/chat-thread-preview.js b/plugins/chat/assets/javascripts/discourse/models/chat-thread-preview.js index 9b04d4cbe50..e790c156480 100644 --- a/plugins/chat/assets/javascripts/discourse/models/chat-thread-preview.js +++ b/plugins/chat/assets/javascripts/discourse/models/chat-thread-preview.js @@ -1,8 +1,8 @@ import { tracked } from "@glimmer/tracking"; export default class ChatThreadPreview { - static create(channel, args = {}) { - return new ChatThreadPreview(channel, args); + static create(args = {}) { + return new ChatThreadPreview(args); } @tracked lastReplyId;