discourse-yearly-review/assets/javascripts/discourse/initializers/yearly-review-admin-notice.js
Osama Sayegh 97720c573f
Some checks failed
Discourse Plugin / ci (push) Has been cancelled
DEV: Render the yearly review notice on both admin dashboards (#118)
The end-of-year admin notice now renders on both the old and the
redesigned admin dashboard, so sites still on the old dashboard keep
seeing it.
2026-07-13 10:12:45 +03:00

30 lines
894 B
JavaScript

import { withPluginApi } from "discourse/lib/plugin-api";
import YearlyReviewAdminNotice, {
LegacyDashboardYearlyReviewAdminNotice,
} from "discourse/plugins/discourse-yearly-review/discourse/components/yearly-review-admin-notice";
export default {
name: "yearly-review-admin-notice",
initialize(container) {
withPluginApi((api) => {
const siteSettings = container.lookup("service:site-settings");
if (!siteSettings.yearly_review_enabled) {
return;
}
// Only show this in December of the current year (getMonth is 0-based).
const now = new Date();
if (now.getMonth() === 11) {
api.renderInOutlet(
"admin-dashboard-top",
LegacyDashboardYearlyReviewAdminNotice
);
api.renderInOutlet(
"admin-dashboard-after-header",
YearlyReviewAdminNotice
);
}
});
},
};