mirror of
https://ghfast.top/https://github.com/discourse/discourse-yearly-review.git
synced 2026-07-17 11:57:00 +08:00
Some checks failed
Discourse Plugin / ci (push) Has been cancelled
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.
45 lines
1.1 KiB
Text
45 lines
1.1 KiB
Text
import Component from "@glimmer/component";
|
|
import { trustHTML } from "@ember/template";
|
|
import replaceEmoji from "discourse/helpers/replace-emoji";
|
|
import getURL from "discourse/lib/get-url";
|
|
import { i18n } from "discourse-i18n";
|
|
|
|
export function janNextYear() {
|
|
return new Date(new Date().getFullYear() + 1, 0, 1);
|
|
}
|
|
|
|
export default class YearlyReviewAdminNotice extends Component {
|
|
static shouldRender(args) {
|
|
return Boolean(args.isNewDashboard);
|
|
}
|
|
|
|
get toBeCreatedDate() {
|
|
return moment(janNextYear()).format(i18n("dates.full_with_year_no_time"));
|
|
}
|
|
|
|
get settingsUrl() {
|
|
return getURL(
|
|
"/admin/site_settings/category/plugins?filter=plugin%3Adiscourse-yearly-review"
|
|
);
|
|
}
|
|
|
|
<template>
|
|
<div class="yearly-review-admin-notice alert alert-info">
|
|
{{replaceEmoji
|
|
(trustHTML
|
|
(i18n
|
|
"yearly_review.admin_notice"
|
|
to_be_created_date=this.toBeCreatedDate
|
|
settings_url=this.settingsUrl
|
|
)
|
|
)
|
|
}}
|
|
</div>
|
|
</template>
|
|
}
|
|
|
|
export class LegacyDashboardYearlyReviewAdminNotice extends YearlyReviewAdminNotice {
|
|
static shouldRender() {
|
|
return true;
|
|
}
|
|
}
|