Add heading card when creating a new view (#22123)

This commit is contained in:
Paul Bottein 2024-09-27 11:19:19 +02:00 committed by GitHub
parent 570ad38bac
commit ac9654c1de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 3 deletions

View File

@ -379,7 +379,19 @@ export class HuiDialogEditView extends LitElement {
};
if (viewConf.type === SECTION_VIEW_LAYOUT && !viewConf.sections?.length) {
viewConf.sections = [{ type: "grid", cards: [] }];
viewConf.sections = [
{
type: "grid",
cards: [
{
type: "heading",
heading: this.hass!.localize(
"ui.panel.lovelace.editor.section.default_section_title"
),
},
],
},
];
} else if (!viewConf.cards?.length) {
viewConf.cards = [];
}

View File

@ -249,7 +249,9 @@ export class SectionsView extends LitElement implements LovelaceViewElement {
cards: [
{
type: "heading",
heading: "New Section",
heading: this.hass!.localize(
"ui.panel.lovelace.editor.section.default_section_title"
),
},
],
});

View File

@ -5669,7 +5669,8 @@
"section": {
"add_badge": "Add badge",
"add_card": "[%key:ui::panel::lovelace::editor::edit_card::add%]",
"create_section": "Create section"
"create_section": "Create section",
"default_section_title": "New section"
},
"delete_section": {
"title": "Delete section",