Conversation
Set rows and inner widgets to Fill so content fills the card. Wrap value_text in a container, use metric::GAP spacing, and simplify inner column assembly for connected/disconnected cases.
## Summary Adds a per-widget settings dialog for per-widget tweaks, and ships two issue-driven features inside it: custom widget names (#78) and conditional visibility rules (#77). ### Per-widget settings dialog - New `WindowKind::WidgetSettings { entity_id }` — a small dedicated window per widget, mirroring the main Settings shape (chrome + sections + footer with the entity_id hint). - Opened from a **sliders icon** in the widget's top-right corner, or from a sliders shortcut in **Settings → Sensors** so hidden widgets stay reachable. - Three sections wired up: **Display** (custom name), **Behavior** (priority), **Show only when…** (visibility rule). - Built entirely on the existing `settings_components` set — `page_with_sections`, `section`, `item_with_picker`, `item_with_input`, `item_with_toggle` — so it stays consistent with every other settings page. - Priority quick-dots on the widget stay as a shortcut; dialog and dots write to the same `widget_priorities` map. ### Custom widget names (closes #78) - `widget_names: HashMap<String, String>` on Config; empty value drops the override. - `Snapdash::display_name(entity_id)` resolves: override → HA `friendly_name` → bare entity_id without the domain prefix. Used by both widget title and dialog title. - Live text input — the dialog title updates as you type. ### Conditional visibility rules (closes #77) - New `widget_visibility` module with `VisibilityRule { trigger, condition }` and 5 condition types: `StateEquals`, `StateNotEquals`, `IsAvailable`, `NumericGt`, `NumericLt`. Cross-entity or self-triggering, state-only. Numeric thresholds stored as raw `String` so the UI can bind them directly; invalid numbers fail-closed and hide the widget. - `Snapdash::reconcile_visibility` re-evaluates every rule-gated widget on `HaEvent::InitialState` / `StateChanged` and emits `OpenEntity` / `CloseWindow` for the deltas. Widgets without a rule are left alone — user controls those, otherwise manual close would bounce right back. - `entity_windows_opening` race-guard set so a flurry of HA events during the async `window::open` round-trip doesn't double-open the same widget. - Bulk boot-open filters by `is_widget_visible` — gated widgets wait for the first HA snapshot. Hide-until-known by default. - Editor section in the dialog: enable toggle, trigger entity input with live ✓/⚠ found-in-HA hint, condition picker, value input (variant-dependent), and a live **Currently visible/hidden** preview. Toggle-off explicitly re-opens the widget (reconcile only iterates rules that exist). - **Hidden by rule** pill badge in Settings → Sensors active list so a rule-hidden widget stays findable, with the sliders shortcut next to it for one-click access to the dialog. ## Notable extras - New `Icon::Sliders` glyph (lucide `sliders-horizontal`) — used by both the on-widget trigger and the active-sensors-list shortcut so they visually pair. - `widget_visibility` ships with unit tests covering every condition branch + unknown-trigger / non-numeric fallthrough. - Sensors row layout was reworked so the badge and the sliders icon always sit at the right edge regardless of friendly_name / entity_id wrapping. ## Closes - #77 (Conditional widgets) - #78 (Custom widget names)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 335fe1d3aa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
If the last window closes but any configured widget has a visibility rule, keep the process alive so future state changes can reopen widgets. Preserve original exit behavior for users without rules; rule users can quit via Settings → Quit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.