discourse/app/assets/javascripts/admin/addon/components/admin-config-areas/look-and-feel-themes.gjs
Jordan Vidrine f902e0fdd7
Some checks are pending
Licenses / run (push) Waiting to run
Linting / run (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (annotations, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, themes) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, chat) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, themes) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Chrome) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox ESR) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox Evergreen) (push) Waiting to run
UX: Look and feel changes (#29245)
This PR:

- Removes components from being displayed in the card
- Adds a DMenu to house previous footer actions
- Allows themes to be updated from this grid, with an animation and different border to show the update is happening
- Stops position of cards changing when default changes
- Fixes outline colour not changing when default changes
- Show a global notice on the page when previewing a theme
- Allows updating a theme from the grid, and showing an indicator of what theme needs to be updated
- Moves "Set as default" to the dropdown for the theme
- Show screenshot for theme if it is available
- Prevent page reloading when updating the theme
- Fixes theme install modal on grid page
- Temporarily remove sorting of default theme to the top
2024-10-29 12:25:17 +10:00

70 lines
1.9 KiB
Plaintext

import Component from "@glimmer/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
import I18n from "discourse-i18n";
import AdminPageSubheader from "admin/components/admin-page-subheader";
import InstallThemeModal from "admin/components/modal/install-theme";
import ThemesGrid from "admin/components/themes-grid";
export default class AdminConfigAreasLookAndFeelThemes extends Component {
@service modal;
@service router;
@service toasts;
@action
installModal() {
this.modal.show(InstallThemeModal, {
model: { ...this.installThemeOptions() },
});
}
// TODO (martin) These install methods may not belong here and they
// are incomplete or have stubbed or omitted properties. We may want
// to move this to the new config route or a dedicated component
// that sits in the route.
installThemeOptions() {
return {
selectedType: "theme",
userId: null,
content: [],
installedThemes: this.args.themes,
addTheme: this.addTheme,
updateSelectedType: () => {},
};
}
@action
addTheme(theme) {
this.toasts.success({
data: {
message: I18n.t("admin.customize.theme.install_success", {
theme: theme.name,
}),
},
duration: 2000,
});
this.router.refresh();
}
<template>
<AdminPageSubheader
@titleLabel="admin.config_areas.look_and_feel.themes.title"
@descriptionLabel="admin.customize.theme.themes_intro_new"
@learnMoreUrl="https://meta.discourse.org/t/93648"
>
<:actions as |actions|>
<actions.Primary
@action={{this.installModal}}
@label="admin.customize.install"
@icon="upload"
class="admin-look-and-feel__install-theme"
/>
</:actions>
</AdminPageSubheader>
<div class="admin-detail">
<ThemesGrid @themes={{@themes}} />
</div>
</template>
}