2023-02-23 10:32:53 -05:00
|
|
|
import {
|
|
|
|
attributeBindings,
|
|
|
|
classNameBindings,
|
|
|
|
classNames,
|
|
|
|
tagName,
|
|
|
|
} from "@ember-decorators/component";
|
2019-10-23 12:30:52 -04:00
|
|
|
import Component from "@ember/component";
|
2019-11-07 16:38:28 -05:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2018-07-19 14:33:11 -04:00
|
|
|
|
2023-02-23 10:32:53 -05:00
|
|
|
@tagName("th")
|
|
|
|
@classNames("admin-report-table-header")
|
|
|
|
@classNameBindings("label.mainProperty", "label.type", "isCurrentSort")
|
|
|
|
@attributeBindings("label.title:title")
|
|
|
|
export default class AdminReportTableHeader extends Component {
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("currentSortLabel.sortProperty", "label.sortProperty")
|
2018-07-19 14:33:11 -04:00
|
|
|
isCurrentSort(currentSortField, labelSortField) {
|
|
|
|
return currentSortField === labelSortField;
|
2023-02-23 10:32:53 -05:00
|
|
|
}
|
2018-07-19 14:33:11 -04:00
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("currentSortDirection")
|
2018-07-19 14:33:11 -04:00
|
|
|
sortIcon(currentSortDirection) {
|
|
|
|
return currentSortDirection === 1 ? "caret-up" : "caret-down";
|
2023-02-23 10:32:53 -05:00
|
|
|
}
|
|
|
|
}
|