mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 08:43:25 +08:00
DEV: Convert topic-timeline to gjs (#29483)
Some checks are pending
Licenses / run (push) Waiting to run
Linting / run (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, chat) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, themes) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (annotations, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, themes) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Chrome) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox ESR) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox Evergreen) (push) Waiting to run
Some checks are pending
Licenses / run (push) Waiting to run
Linting / run (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, chat) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, themes) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (annotations, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, themes) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Chrome) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox ESR) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox Evergreen) (push) Waiting to run
This commit is contained in:
parent
671f7beadb
commit
cf156d0f51
|
@ -0,0 +1,76 @@
|
|||
import Component from "@glimmer/component";
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
import { action } from "@ember/object";
|
||||
import { modifier } from "ember-modifier";
|
||||
import Container from "discourse/components/topic-timeline/container";
|
||||
import concatClass from "discourse/helpers/concat-class";
|
||||
|
||||
export default class TopicTimeline extends Component {
|
||||
@tracked docked = false;
|
||||
@tracked dockedBottom = false;
|
||||
enteredIndex = this.args.prevEvent
|
||||
? this.args.prevEvent.postIndex - 1
|
||||
: this.args.enteredIndex;
|
||||
|
||||
addShowClass = modifier((el) => {
|
||||
if (this.args.fullscreen) {
|
||||
el.classList.add("show");
|
||||
}
|
||||
});
|
||||
|
||||
@action
|
||||
setDocked(value) {
|
||||
if (this.docked !== value) {
|
||||
this.docked = value;
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
setDockedBottom(value) {
|
||||
if (this.dockedBottom !== value) {
|
||||
this.dockedBottom = value;
|
||||
}
|
||||
}
|
||||
|
||||
<template>
|
||||
<div
|
||||
{{this.addShowClass}}
|
||||
class={{concatClass
|
||||
"timeline-container"
|
||||
(if @fullscreen "timeline-fullscreen")
|
||||
(if this.docked "timeline-docked")
|
||||
(if this.dockedBottom "timeline-docked-bottom")
|
||||
}}
|
||||
>
|
||||
<div class="topic-timeline">
|
||||
<Container
|
||||
@model={{@model}}
|
||||
@enteredIndex={{this.enteredIndex}}
|
||||
@jumpTop={{@jumpTop}}
|
||||
@jumpBottom={{@jumpBottom}}
|
||||
@jumpEnd={{@jumpEnd}}
|
||||
@jumpToIndex={{@jumpToIndex}}
|
||||
@jumpToPostPrompt={{@jumpToPostPrompt}}
|
||||
@fullscreen={{@fullscreen}}
|
||||
@toggleMultiSelect={{@toggleMultiSelect}}
|
||||
@showTopicSlowModeUpdate={{@showTopicSlowModeUpdate}}
|
||||
@showTopReplies={{@showTopReplies}}
|
||||
@deleteTopic={{@deleteTopic}}
|
||||
@recoverTopic={{@recoverTopic}}
|
||||
@toggleClosed={{@toggleClosed}}
|
||||
@toggleArchived={{@toggleArchived}}
|
||||
@toggleVisibility={{@toggleVisibility}}
|
||||
@showTopicTimerModal={{@showTopicTimerModal}}
|
||||
@showFeatureTopic={{@showFeatureTopic}}
|
||||
@showChangeTimestamp={{@showChangeTimestamp}}
|
||||
@resetBumpDate={{@resetBumpDate}}
|
||||
@convertToPublicTopic={{@convertToPublicTopic}}
|
||||
@convertToPrivateMessage={{@convertToPrivateMessage}}
|
||||
@replyToPost={{@replyToPost}}
|
||||
@setDocked={{this.setDocked}}
|
||||
@setDockedBottom={{this.setDockedBottom}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<div
|
||||
class={{concat-class "timeline-container" this.classes}}
|
||||
{{did-insert this.addShowClass}}
|
||||
>
|
||||
<div class="topic-timeline">
|
||||
<TopicTimeline::Container
|
||||
@model={{@model}}
|
||||
@enteredIndex={{this.enteredIndex}}
|
||||
@jumpTop={{@jumpTop}}
|
||||
@jumpBottom={{@jumpBottom}}
|
||||
@jumpEnd={{@jumpEnd}}
|
||||
@jumpToIndex={{@jumpToIndex}}
|
||||
@jumpToPostPrompt={{@jumpToPostPrompt}}
|
||||
@fullscreen={{@fullscreen}}
|
||||
@toggleMultiSelect={{@toggleMultiSelect}}
|
||||
@showTopicSlowModeUpdate={{@showTopicSlowModeUpdate}}
|
||||
@showTopReplies={{@showTopReplies}}
|
||||
@deleteTopic={{@deleteTopic}}
|
||||
@recoverTopic={{@recoverTopic}}
|
||||
@toggleClosed={{@toggleClosed}}
|
||||
@toggleArchived={{@toggleArchived}}
|
||||
@toggleVisibility={{@toggleVisibility}}
|
||||
@showTopicTimerModal={{@showTopicTimerModal}}
|
||||
@showFeatureTopic={{@showFeatureTopic}}
|
||||
@showChangeTimestamp={{@showChangeTimestamp}}
|
||||
@resetBumpDate={{@resetBumpDate}}
|
||||
@convertToPublicTopic={{@convertToPublicTopic}}
|
||||
@convertToPrivateMessage={{@convertToPrivateMessage}}
|
||||
@replyToPost={{@replyToPost}}
|
||||
@setDocked={{this.setDocked}}
|
||||
@setDockedBottom={{this.setDockedBottom}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
|
@ -1,63 +0,0 @@
|
|||
import Component from "@glimmer/component";
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
import { action } from "@ember/object";
|
||||
import { service } from "@ember/service";
|
||||
import { bind } from "discourse-common/utils/decorators";
|
||||
|
||||
export default class TopicTimeline extends Component {
|
||||
@service siteSettings;
|
||||
@service currentUser;
|
||||
|
||||
@tracked enteredIndex = this.args.enteredIndex;
|
||||
@tracked docked = false;
|
||||
@tracked dockedBottom = false;
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
|
||||
if (this.args.prevEvent) {
|
||||
this.enteredIndex = this.args.prevEvent.postIndex - 1;
|
||||
}
|
||||
}
|
||||
|
||||
get createdAt() {
|
||||
return new Date(this.args.model.created_at);
|
||||
}
|
||||
|
||||
get classes() {
|
||||
const classes = [];
|
||||
if (this.args.fullscreen) {
|
||||
classes.push("timeline-fullscreen");
|
||||
}
|
||||
|
||||
if (this.docked) {
|
||||
classes.push("timeline-docked");
|
||||
if (this.dockedBottom) {
|
||||
classes.push("timeline-docked-bottom");
|
||||
}
|
||||
}
|
||||
|
||||
return classes.join(" ");
|
||||
}
|
||||
|
||||
@bind
|
||||
addShowClass(element) {
|
||||
if (this.args.fullscreen && !this.args.addShowClass) {
|
||||
element.classList.add("show");
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
setDocked(value) {
|
||||
if (this.docked !== value) {
|
||||
this.docked = value;
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
setDockedBottom(value) {
|
||||
if (this.dockedBottom !== value) {
|
||||
this.dockedBottom = value;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user