${this._renderPanels(beforeSpacer, selectedPanel)}
+ >${this._renderPanels(beforeSpacer, selectedPanel, true)}
${this._renderSpacer()}${this._renderHiddenPanels()}
`;
@@ -690,6 +712,28 @@ class HaSidebar extends SubscribeMixin(LitElement) {
fireEvent(this, "hass-edit-sidebar", { editMode: false });
}
+ private async _changePosition(ev): Promise {
+ ev.preventDefault();
+ const oldIndex = (ev.currentTarget as any).index as number;
+ const name = ((ev.currentTarget as any).title as string) || "";
+
+ const positionString = await showPromptDialog(this, {
+ title: this.hass!.localize("ui.sidebar.change_position"),
+ text: this.hass!.localize("ui.sidebar.change_position_dialog_text", {
+ name,
+ }),
+ inputType: "number",
+ inputMin: "1",
+ placeholder: String(oldIndex + 1),
+ });
+
+ if (!positionString) return;
+ const position = parseInt(positionString);
+ if (isNaN(position)) return;
+ const newIndex = Math.max(0, position - 1);
+ this._panelMove(oldIndex, newIndex);
+ }
+
private async _hidePanel(ev: Event) {
ev.preventDefault();
const panel = (ev.currentTarget as any).panel;
@@ -940,7 +984,7 @@ class HaSidebar extends SubscribeMixin(LitElement) {
ha-md-list-item .item-text {
display: none;
- max-width: calc(100% - 56px);
+ max-width: 100%;
font-weight: 500;
font-size: 14px;
}
@@ -971,6 +1015,19 @@ class HaSidebar extends SubscribeMixin(LitElement) {
color: var(--text-accent-color, var(--text-primary-color));
}
+ .position-badge {
+ display: block;
+ width: 24px;
+ line-height: 24px;
+ box-sizing: border-box;
+ border-radius: 50%;
+ font-weight: 500;
+ text-align: center;
+ font-size: 14px;
+ background-color: var(--app-header-edit-background-color, #455a64);
+ color: var(--app-header-edit-text-color, white);
+ }
+
ha-svg-icon + .badge {
position: absolute;
top: 4px;
diff --git a/src/resources/ha-sidebar-edit-style.ts b/src/resources/ha-sidebar-edit-style.ts
index efd4ddee10..10dc29f913 100644
--- a/src/resources/ha-sidebar-edit-style.ts
+++ b/src/resources/ha-sidebar-edit-style.ts
@@ -58,7 +58,7 @@ export const sidebarEditStyle = css`
}
:host([expanded]) .hide-panel {
- display: block;
+ display: inline-block;
}
:host([expanded]) .show-panel {
diff --git a/src/translations/en.json b/src/translations/en.json
index 8b79462fee..519b6a2968 100644
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -2016,7 +2016,9 @@
"sidebar_toggle": "Sidebar toggle",
"done": "Done",
"hide_panel": "Hide panel",
- "show_panel": "Show panel"
+ "show_panel": "Show panel",
+ "change_position": "Change panel position",
+ "change_position_dialog_text": "What position do you want to move your ''{name}'' panel to?"
},
"panel": {
"my": {