mirror of
https://github.com/discourse/discourse.git
synced 2024-12-14 08:53:44 +08:00
3ad2fd032b
* UX: More additions * UX: more * DEV: Add admin/config/themes route * UX: Use admin config card * syntax merge fixes * cleanup * cleanup * checkbox * more * error * save on click * more * fix setter * DEV: Implement vanilla checkbox * cleanup * UX: save themes as default * DEV: Add component list to card * DEV: Add placeholder for no screenshots * DEV: Fix default theme reactivity Also add content/optionalAction yields to config area card and put the theme user selectable checkbox there, along with adding styles. * DEV: Change to generic "look and feel" config area * DEV: Auto redirect to themes on base look and feel route * UX: Remove computed from sorted themes * linting * UX: Turn update icon into button that routes to settings * DEV: remove unused function * UX: center icons with title * DEV: Lint * UX: Hook up theme preview button * DEV: Minor fixes --------- Co-authored-by: Martin Brennan <martin@discourse.org> Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
73 lines
2.3 KiB
Plaintext
73 lines
2.3 KiB
Plaintext
import Component from "@glimmer/component";
|
|
import { tracked } from "@glimmer/tracking";
|
|
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
|
|
import { service } from "@ember/service";
|
|
import { htmlSafe } from "@ember/template";
|
|
import { ajax } from "discourse/lib/ajax";
|
|
import i18n from "discourse-common/helpers/i18n";
|
|
import { bind } from "discourse-common/utils/decorators";
|
|
import AdminConfigAreaCard from "admin/components/admin-config-area-card";
|
|
import DashboardNewFeatureItem from "admin/components/dashboard-new-feature-item";
|
|
|
|
export default class DashboardNewFeatures extends Component {
|
|
@service currentUser;
|
|
|
|
@tracked newFeatures = null;
|
|
@tracked groupedNewFeatures = null;
|
|
@tracked isLoaded = false;
|
|
|
|
@bind
|
|
loadNewFeatures() {
|
|
ajax("/admin/whats-new.json")
|
|
.then((json) => {
|
|
const items = json.new_features.reduce((acc, feature) => {
|
|
const key = moment(feature.released_at || feature.created_at).format(
|
|
"YYYY-MM"
|
|
);
|
|
acc[key] = acc[key] || [];
|
|
acc[key].push(feature);
|
|
return acc;
|
|
}, {});
|
|
|
|
this.groupedNewFeatures = Object.keys(items).map((date) => {
|
|
return {
|
|
date: moment
|
|
.tz(date, this.currentUser.user_option.timezone)
|
|
.format("MMMM YYYY"),
|
|
features: items[date],
|
|
};
|
|
});
|
|
this.isLoaded = true;
|
|
})
|
|
.finally(() => {
|
|
this.isLoaded = true;
|
|
});
|
|
}
|
|
|
|
<template>
|
|
<div
|
|
class="admin-config-area__primary-content"
|
|
{{didInsert this.loadNewFeatures}}
|
|
>
|
|
{{#if this.groupedNewFeatures}}
|
|
{{#each this.groupedNewFeatures as |groupedFeatures|}}
|
|
<AdminConfigAreaCard @translatedHeading={{groupedFeatures.date}}>
|
|
<:content>
|
|
{{#each groupedFeatures.features as |feature|}}
|
|
<DashboardNewFeatureItem @item={{feature}} />
|
|
{{/each}}
|
|
</:content>
|
|
</AdminConfigAreaCard>
|
|
{{/each}}
|
|
{{else if this.isLoaded}}
|
|
{{htmlSafe
|
|
(i18n
|
|
"admin.dashboard.new_features.previous_announcements"
|
|
url="https://meta.discourse.org/tags/c/announcements/67/release-notes"
|
|
)
|
|
}}
|
|
{{/if}}
|
|
</div>
|
|
</template>
|
|
}
|