Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor spacer chip #1112

Merged
merged 2 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/cards/chips-card/chips-card-chips-editor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css, CSSResultGroup, html, PropertyValues, TemplateResult } from "lit";
import { css, CSSResultGroup, html, nothing, PropertyValues, TemplateResult } from "lit";
import { customElement, property, state } from "lit/decorators.js";
import { guard } from "lit/directives/guard.js";
import type { SortableEvent } from "sortablejs";
Expand All @@ -20,6 +20,8 @@ declare global {
}
}

const NON_EDITABLE_CHIPS = new Set<LovelaceChipConfig["type"]>(["spacer"]);

@customElement("mushroom-chips-card-chips-editor")
export class ChipsCardEditorChips extends MushroomBaseElement {
@property({ attribute: false }) protected chips?: LovelaceChipConfig[];
Expand Down Expand Up @@ -76,8 +78,8 @@ export class ChipsCardEditorChips extends MushroomBaseElement {
</div>
</div>
`}
${chipConf.type == "spacer"
? ""
${NON_EDITABLE_CHIPS.has(chipConf.type)
? nothing
: html`
<ha-icon-button
.label=${customLocalize(
Expand Down
1 change: 1 addition & 0 deletions src/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
"entity": "Entité",
"light": "Lumière",
"menu": "Menu",
"spacer": "Espacement",
"template": "Template",
"weather": "Météo"
}
Expand Down