2024-06-06 21:07:08 +08:00
|
|
|
import Component from "@glimmer/component";
|
|
|
|
import { tracked } from "@glimmer/tracking";
|
2024-11-20 04:45:18 +08:00
|
|
|
import { i18n } from "discourse-i18n";
|
2024-06-06 21:07:08 +08:00
|
|
|
|
|
|
|
export default class AdminConfigAreaCard extends Component {
|
|
|
|
@tracked collapsed = false;
|
|
|
|
|
2024-07-29 12:20:12 +08:00
|
|
|
get computedHeading() {
|
|
|
|
if (this.args.heading) {
|
2024-11-20 04:45:18 +08:00
|
|
|
return i18n(this.args.heading);
|
2024-07-29 12:20:12 +08:00
|
|
|
}
|
|
|
|
return this.args.translatedHeading;
|
|
|
|
}
|
|
|
|
|
2024-10-15 23:54:38 +08:00
|
|
|
get hasHeading() {
|
|
|
|
return this.args.heading || this.args.translatedHeading;
|
|
|
|
}
|
|
|
|
|
2024-10-28 23:39:51 +08:00
|
|
|
get computedDescription() {
|
|
|
|
if (this.args.description) {
|
2024-11-20 04:45:18 +08:00
|
|
|
return i18n(this.args.description);
|
2024-10-28 23:39:51 +08:00
|
|
|
}
|
|
|
|
return this.args.translatedDescription;
|
|
|
|
}
|
|
|
|
|
|
|
|
get hasDescription() {
|
|
|
|
return this.args.description || this.args.translatedDescription;
|
|
|
|
}
|
|
|
|
|
2024-06-06 21:07:08 +08:00
|
|
|
<template>
|
2024-07-01 10:40:37 +08:00
|
|
|
<section class="admin-config-area-card" ...attributes>
|
2024-10-15 23:54:38 +08:00
|
|
|
<div class="admin-config-area-card__header-wrapper">
|
|
|
|
{{#if this.hasHeading}}
|
|
|
|
<h3
|
|
|
|
class="admin-config-area-card__title"
|
|
|
|
>{{this.computedHeading}}</h3>
|
|
|
|
{{else}}
|
2024-10-17 00:13:36 +08:00
|
|
|
{{#if (has-block "header")}}
|
|
|
|
<h3 class="admin-config-area-card__title">{{yield to="header"}}</h3>
|
|
|
|
{{/if}}
|
2024-10-15 23:54:38 +08:00
|
|
|
{{/if}}
|
|
|
|
{{#if (has-block "headerAction")}}
|
|
|
|
<div class="admin-config-area-card__header-action">
|
|
|
|
{{yield to="headerAction"}}
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
2024-06-06 21:07:08 +08:00
|
|
|
<div class="admin-config-area-card__content">
|
2024-10-28 23:39:51 +08:00
|
|
|
{{#if this.hasDescription}}
|
|
|
|
<p class="admin-config-area-card__description">
|
|
|
|
{{this.computedDescription}}
|
|
|
|
</p>
|
|
|
|
{{/if}}
|
2024-10-15 23:54:38 +08:00
|
|
|
{{yield to="content"}}
|
2024-06-06 21:07:08 +08:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
}
|