discourse/app/assets/javascripts/admin/addon/components/admin-plugin-config-page.gjs
Martin Brennan 2ed8f96e67
UX: Implement new top-level nav on admin plugin pages (#27126)
This uses a new nav style with the heirarchy:

```
Breadcrumbs
  |- Title
    |- Description
      |- Third-Level Navigation
```

The navigation bar uses the transparent red-underlined
buttons similar to the user activity page.

Over time all admin pages will use this, but this starts
with the new plugin show page.

---------

Co-authored-by: Ella <ella.estigoy@gmail.com>
2024-05-29 12:20:55 +10:00

69 lines
2.0 KiB
Plaintext

import Component from "@glimmer/component";
import { LinkTo } from "@ember/routing";
import { inject as service } from "@ember/service";
import DBreadcrumbsContainer from "discourse/components/d-breadcrumbs-container";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
import i18n from "discourse-common/helpers/i18n";
import AdminPluginConfigArea from "./admin-plugin-config-area";
import AdminPluginConfigMetadata from "./admin-plugin-config-metadata";
import AdminPluginConfigTopNav from "./admin-plugin-config-top-nav";
export default class AdminPluginConfigPage extends Component {
@service currentUser;
@service adminPluginNavManager;
get mainAreaClasses() {
let classes = ["admin-plugin-config-page__main-area"];
if (this.adminPluginNavManager.isSidebarMode) {
classes.push("-with-inner-sidebar");
} else {
classes.push("-without-inner-sidebar");
}
return classes.join(" ");
}
<template>
<div class="admin-plugin-config-page">
<DBreadcrumbsContainer />
<DBreadcrumbsItem as |linkClass|>
<LinkTo @route="admin" class={{linkClass}}>
{{i18n "admin_title"}}
</LinkTo>
</DBreadcrumbsItem>
<DBreadcrumbsItem as |linkClass|>
<LinkTo @route="adminPlugins" class={{linkClass}}>
{{i18n "admin.plugins.title"}}
</LinkTo>
</DBreadcrumbsItem>
<DBreadcrumbsItem as |linkClass|>
<LinkTo
@route="adminPlugins.show"
@model={{@plugin}}
class={{linkClass}}
>
{{@plugin.nameTitleized}}
</LinkTo>
</DBreadcrumbsItem>
<AdminPluginConfigMetadata @plugin={{@plugin}} />
{{#if this.adminPluginNavManager.isTopMode}}
<AdminPluginConfigTopNav />
{{/if}}
<div class="admin-plugin-config-page__content">
<div class={{this.mainAreaClasses}}>
<AdminPluginConfigArea>
{{yield}}
</AdminPluginConfigArea>
</div>
</div>
</div>
</template>
}