diff --git a/src/panels/lovelace/editor/config-elements/hui-cover-position-favorite-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-cover-position-favorite-card-feature-editor.ts
index 34d52cd543..a06acf236b 100644
--- a/src/panels/lovelace/editor/config-elements/hui-cover-position-favorite-card-feature-editor.ts
+++ b/src/panels/lovelace/editor/config-elements/hui-cover-position-favorite-card-feature-editor.ts
@@ -1,41 +1,12 @@
-import { html, LitElement, nothing } from "lit";
-import { customElement, property, state } from "lit/decorators";
-import "../../../../components/ha-alert";
-import type { HomeAssistant } from "../../../../types";
-import type {
- CoverPositionFavoriteCardFeatureConfig,
- LovelaceCardFeatureContext,
-} from "../../card-features/types";
-import type { LovelaceCardFeatureEditor } from "../../types";
+import { customElement } from "lit/decorators";
+import type { LocalizeKeys } from "../../../../common/translations/localize";
+import type { CoverPositionFavoriteCardFeatureConfig } from "../../card-features/types";
+import { HuiFavoriteCardFeatureEditorBase } from "./hui-favorite-card-feature-editor-base";
@customElement("hui-cover-position-favorite-card-feature-editor")
-export class HuiCoverPositionFavoriteCardFeatureEditor
- extends LitElement
- implements LovelaceCardFeatureEditor
-{
- @property({ attribute: false }) public hass?: HomeAssistant;
-
- @property({ attribute: false }) public context?: LovelaceCardFeatureContext;
-
- @state() private _config?: CoverPositionFavoriteCardFeatureConfig;
-
- public setConfig(config: CoverPositionFavoriteCardFeatureConfig): void {
- this._config = config;
- }
-
- protected render() {
- if (!this.hass || !this._config) {
- return nothing;
- }
-
- return html`
-
- ${this.hass.localize(
- "ui.panel.lovelace.editor.features.types.cover-position-favorite.description"
- )}
-
- `;
- }
+export class HuiCoverPositionFavoriteCardFeatureEditor extends HuiFavoriteCardFeatureEditorBase {
+ protected readonly _descriptionKey =
+ "ui.panel.lovelace.editor.features.types.cover-position-favorite.description" satisfies LocalizeKeys;
}
declare global {
diff --git a/src/panels/lovelace/editor/config-elements/hui-cover-tilt-favorite-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-cover-tilt-favorite-card-feature-editor.ts
index 639fdc7633..9ad4492511 100644
--- a/src/panels/lovelace/editor/config-elements/hui-cover-tilt-favorite-card-feature-editor.ts
+++ b/src/panels/lovelace/editor/config-elements/hui-cover-tilt-favorite-card-feature-editor.ts
@@ -1,41 +1,12 @@
-import { html, LitElement, nothing } from "lit";
-import { customElement, property, state } from "lit/decorators";
-import "../../../../components/ha-alert";
-import type { HomeAssistant } from "../../../../types";
-import type {
- CoverTiltFavoriteCardFeatureConfig,
- LovelaceCardFeatureContext,
-} from "../../card-features/types";
-import type { LovelaceCardFeatureEditor } from "../../types";
+import { customElement } from "lit/decorators";
+import type { LocalizeKeys } from "../../../../common/translations/localize";
+import type { CoverTiltFavoriteCardFeatureConfig } from "../../card-features/types";
+import { HuiFavoriteCardFeatureEditorBase } from "./hui-favorite-card-feature-editor-base";
@customElement("hui-cover-tilt-favorite-card-feature-editor")
-export class HuiCoverTiltFavoriteCardFeatureEditor
- extends LitElement
- implements LovelaceCardFeatureEditor
-{
- @property({ attribute: false }) public hass?: HomeAssistant;
-
- @property({ attribute: false }) public context?: LovelaceCardFeatureContext;
-
- @state() private _config?: CoverTiltFavoriteCardFeatureConfig;
-
- public setConfig(config: CoverTiltFavoriteCardFeatureConfig): void {
- this._config = config;
- }
-
- protected render() {
- if (!this.hass || !this._config) {
- return nothing;
- }
-
- return html`
-
- ${this.hass.localize(
- "ui.panel.lovelace.editor.features.types.cover-tilt-favorite.description"
- )}
-
- `;
- }
+export class HuiCoverTiltFavoriteCardFeatureEditor extends HuiFavoriteCardFeatureEditorBase {
+ protected readonly _descriptionKey =
+ "ui.panel.lovelace.editor.features.types.cover-tilt-favorite.description" satisfies LocalizeKeys;
}
declare global {
diff --git a/src/panels/lovelace/editor/config-elements/hui-favorite-card-feature-editor-base.ts b/src/panels/lovelace/editor/config-elements/hui-favorite-card-feature-editor-base.ts
new file mode 100644
index 0000000000..c09e2611e1
--- /dev/null
+++ b/src/panels/lovelace/editor/config-elements/hui-favorite-card-feature-editor-base.ts
@@ -0,0 +1,41 @@
+import { html, LitElement, nothing } from "lit";
+import { property, state } from "lit/decorators";
+import type { LocalizeKeys } from "../../../../common/translations/localize";
+import "../../../../components/ha-alert";
+import type { HomeAssistant } from "../../../../types";
+import type {
+ LovelaceCardFeatureConfig,
+ LovelaceCardFeatureContext,
+} from "../../card-features/types";
+import type { LovelaceCardFeatureEditor } from "../../types";
+
+export abstract class HuiFavoriteCardFeatureEditorBase<
+ TConfig extends LovelaceCardFeatureConfig,
+>
+ extends LitElement
+ implements LovelaceCardFeatureEditor
+{
+ @property({ attribute: false }) public hass?: HomeAssistant;
+
+ @property({ attribute: false }) public context?: LovelaceCardFeatureContext;
+
+ @state() private _config?: TConfig;
+
+ protected abstract readonly _descriptionKey: LocalizeKeys;
+
+ public setConfig(config: TConfig): void {
+ this._config = config;
+ }
+
+ protected render() {
+ if (!this.hass || !this._config) {
+ return nothing;
+ }
+
+ return html`
+
+ ${this.hass.localize(this._descriptionKey)}
+
+ `;
+ }
+}
diff --git a/src/panels/lovelace/editor/config-elements/hui-valve-position-favorite-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-valve-position-favorite-card-feature-editor.ts
index d82050b701..bf90c1b9df 100644
--- a/src/panels/lovelace/editor/config-elements/hui-valve-position-favorite-card-feature-editor.ts
+++ b/src/panels/lovelace/editor/config-elements/hui-valve-position-favorite-card-feature-editor.ts
@@ -1,41 +1,12 @@
-import { html, LitElement, nothing } from "lit";
-import { customElement, property, state } from "lit/decorators";
-import "../../../../components/ha-alert";
-import type { HomeAssistant } from "../../../../types";
-import type {
- LovelaceCardFeatureContext,
- ValvePositionFavoriteCardFeatureConfig,
-} from "../../card-features/types";
-import type { LovelaceCardFeatureEditor } from "../../types";
+import { customElement } from "lit/decorators";
+import type { LocalizeKeys } from "../../../../common/translations/localize";
+import type { ValvePositionFavoriteCardFeatureConfig } from "../../card-features/types";
+import { HuiFavoriteCardFeatureEditorBase } from "./hui-favorite-card-feature-editor-base";
@customElement("hui-valve-position-favorite-card-feature-editor")
-export class HuiValvePositionFavoriteCardFeatureEditor
- extends LitElement
- implements LovelaceCardFeatureEditor
-{
- @property({ attribute: false }) public hass?: HomeAssistant;
-
- @property({ attribute: false }) public context?: LovelaceCardFeatureContext;
-
- @state() private _config?: ValvePositionFavoriteCardFeatureConfig;
-
- public setConfig(config: ValvePositionFavoriteCardFeatureConfig): void {
- this._config = config;
- }
-
- protected render() {
- if (!this.hass || !this._config) {
- return nothing;
- }
-
- return html`
-
- ${this.hass.localize(
- "ui.panel.lovelace.editor.features.types.valve-position-favorite.description"
- )}
-
- `;
- }
+export class HuiValvePositionFavoriteCardFeatureEditor extends HuiFavoriteCardFeatureEditorBase {
+ protected readonly _descriptionKey =
+ "ui.panel.lovelace.editor.features.types.valve-position-favorite.description" satisfies LocalizeKeys;
}
declare global {