mirror of
https://github.com/discourse/discourse.git
synced 2024-12-03 18:03:40 +08:00
a433b30650
This conversion was achieved using the ember-native-class-codemod, plus a handful of manual fixes/tweaks
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
import { classNameBindings, classNames } from "@ember-decorators/component";
|
|
import Component from "@ember/component";
|
|
import { action, computed } from "@ember/object";
|
|
import { ajax } from "discourse/lib/ajax";
|
|
|
|
@classNames("section", "dashboard-new-features")
|
|
@classNameBindings("hasUnseenFeatures:ordered-first")
|
|
export default class DashboardNewFeatures extends Component {
|
|
newFeatures = null;
|
|
releaseNotesLink = null;
|
|
|
|
constructor() {
|
|
super(...arguments);
|
|
|
|
ajax("/admin/dashboard/new-features.json").then((json) => {
|
|
if (this.isDestroying || this.isDestroyed) {
|
|
return;
|
|
}
|
|
|
|
this.setProperties({
|
|
newFeatures: json.new_features,
|
|
hasUnseenFeatures: json.has_unseen_features,
|
|
releaseNotesLink: json.release_notes_link,
|
|
});
|
|
});
|
|
}
|
|
|
|
@computed("newFeatures")
|
|
get columnCountClass() {
|
|
return this.newFeatures.length > 2 ? "three-or-more-items" : "";
|
|
}
|
|
|
|
@action
|
|
dismissNewFeatures() {
|
|
ajax("/admin/dashboard/mark-new-features-as-seen.json", {
|
|
type: "PUT",
|
|
}).then(() => this.set("hasUnseenFeatures", false));
|
|
}
|
|
}
|