mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-21 03:19:56 +08:00
Currently all our preinstalled plugins use the default "gear" icon from fontawesome — this PR adds unique icons for each of them using a new plugin API method, `setAdminPluginIcon()`. Plugins without an icon defined will still fall back to the gear icon. Before: <img width="250" alt="image" src="https://github.com/user-attachments/assets/06b5c6e7-0aae-44f8-b8ee-1486b98bfc6b" /> After: <img width="250" alt="image" src="https://github.com/user-attachments/assets/46d45d4b-6c75-4473-ae53-1a0e71c4d6fb" />
22 lines
637 B
JavaScript
Vendored
22 lines
637 B
JavaScript
Vendored
import { withPluginApi } from "discourse/lib/plugin-api";
|
|
|
|
export default {
|
|
name: "discourse-gamification-admin-plugin-configuration-nav",
|
|
|
|
initialize(container) {
|
|
const currentUser = container.lookup("service:current-user");
|
|
if (!currentUser || !currentUser.admin) {
|
|
return;
|
|
}
|
|
|
|
withPluginApi((api) => {
|
|
api.setAdminPluginIcon("discourse-gamification", "trophy");
|
|
api.addAdminPluginConfigurationNav("discourse-gamification", [
|
|
{
|
|
label: "gamification.leaderboard.title",
|
|
route: "adminPlugins.show.discourse-gamification-leaderboards",
|
|
},
|
|
]);
|
|
});
|
|
},
|
|
};
|