Skip to content

A platform for community discussion. Free, open, simple.

UX: Add transition to glimmer-topic-timeline fullscreen view (#20149)

Isaac Janzen277c5770b0c3
diff --git a/app/assets/javascripts/discourse/app/components/glimmer-topic-timeline.hbs b/app/assets/javascripts/discourse/app/components/glimmer-topic-timeline.hbs
index d2f7554e385..bfa892fe884 100644
--- a/app/assets/javascripts/discourse/app/components/glimmer-topic-timeline.hbs
+++ b/app/assets/javascripts/discourse/app/components/glimmer-topic-timeline.hbs
@@ -1,4 +1,7 @@
-<div class={{concat "timeline-container " this.class}}>
+<div
+ class={{concat "timeline-container " this.classes}}
+ {{did-insert this.addShowClass}}
+>
<div class="topic-timeline">
<TopicTimeline::Container
@model={{@model}}
diff --git a/app/assets/javascripts/discourse/app/components/glimmer-topic-timeline.js b/app/assets/javascripts/discourse/app/components/glimmer-topic-timeline.js
index 7c7f7889321..0eafc12bc82 100644
--- a/app/assets/javascripts/discourse/app/components/glimmer-topic-timeline.js
+++ b/app/assets/javascripts/discourse/app/components/glimmer-topic-timeline.js
@@ -2,6 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import optionalService from "discourse/lib/optional-service";
import { inject as service } from "@ember/service";
+import { bind } from "discourse-common/utils/decorators";
export default class GlimmerTopicTimeline extends Component {
@service site;
@@ -55,14 +56,10 @@ export default class GlimmerTopicTimeline extends Component {
);
}
- get class() {
+ get classes() {
const classes = [];
if (this.args.fullscreen) {
- if (this.addShowClass) {
- classes.push("timeline-fullscreen show");
- } else {
- classes.push("timeline-fullscreen");
- }
+ classes.push("timeline-fullscreen");
}
if (this.dockAt) {
@@ -75,14 +72,17 @@ export default class GlimmerTopicTimeline extends Component {
return classes.join(" ");
}
- get addShowClass() {
- return this.args.fullscreen && !this.args.addShowClass;
- }
-
get createdAt() {
return new Date(this.args.model.created_at);
}
+ @bind
+ addShowClass(element) {
+ if (this.args.fullscreen && !this.args.addShowClass) {
+ element.classList.add("show");
+ }
+ }
+
willDestroy() {
if (!this.site.mobileView) {
this.intersectionObserver?.disconnect();