Skip to content

feat(nodes): Display role-specific icons#4572

Merged
jamesarich merged 2 commits into
mainfrom
feat/role-icons
Feb 17, 2026
Merged

feat(nodes): Display role-specific icons#4572
jamesarich merged 2 commits into
mainfrom
feat/role-icons

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

This pull request enhances the UI component system to support icons for enum-based dropdowns, and updates the device role display throughout the app to show a role-specific icon instead of a generic one. It introduces a new icon mapping for device roles, adds a custom drawable for router roles, and updates relevant UI components and usages to leverage these improvements.

UI Component Improvements:

  • Refactored DropDownPreference to support custom icons and labels for enum items, introducing a new DropDownItem data class and optional itemIcon and itemLabel lambdas. Deprecated and unrecognized enum values are now filtered out, and deprecated detection is handled via reflection. [1] [2] [3] [4] [5] [6]

Device Role Icon Mapping:

  • Added a composable MeshtasticIcons.role function that maps Config.DeviceConfig.Role enum values to specific Material icons or a custom vector drawable for routers, providing a unique icon for each role. [1] [2] [3]

UI Usage Updates:

  • Updated all usages of device role icons in NodeDetailsSection, NodeItem, and TelemetryInfo to use the new MeshtasticIcons.role mapping, ensuring consistent and meaningful iconography for roles. [1] [2] [3] [4] [5]

Settings Screen Enhancements:

  • Modified the device role dropdown in the settings screen to display the appropriate icon and label for each role using the new itemIcon and itemLabel parameters. [1] [2]

Assets:

  • Added a custom vector drawable (mountain_flag_24px.xml) for the router role icon.
image

This commit introduces dynamic, role-specific icons for nodes, enhancing the user interface by providing a clearer visual representation of a device's function within the mesh.

A new `MeshtasticIcons.role()` function has been added to `core/ui` which maps each `Config.DeviceConfig.Role` to a distinct `ImageVector`. This allows for more granular and intuitive icons for roles such as `ROUTER`, `REPEATER`, `TRACKER`, `SENSOR`, and more.

The `NodeDetailsSection` and `NodeItem` composables in the `feature/node` module have been updated to utilize this new functionality, replacing the generic role icon with specific icons based on the node's configured role.

Additionally, a new `RoleInfo` composable overload that accepts a `Config.DeviceConfig.Role` enum has been created, improving type safety and code clarity.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
…ction

This commit enhances the `DropDownPreference` composable to support leading icons for both the selected item and the items in the dropdown list. It also refactors the role selection UI to utilize this new capability.

Specific changes include:

-   **`DropDownPreference` Refactor**:
    -   Introduced a `DropDownItem` data class to encapsulate the value, label, and an optional icon for each item.
    -   Overloaded `DropDownPreference` to accept a list of `DropDownItem` objects.
    -   The composable now displays an icon next to the selected item and in the dropdown list if provided.
    -   Added a helper for `Enum` types to automatically filter out `@Deprecated` values.

-   **Role Selection UI**:
    -   A new `mountain_flag_24px` icon has been added and is now used for the `ROUTER` role.
    -   The device role dropdown in the radio configuration screen now displays an icon next to each role, improving clarity and user experience.

-   **Iconography**:
    -   The `MeshtasticIcons.role` function is now a `@Composable` function to support vector resources.
    -   Removed deprecated `ROUTER_CLIENT` and `REPEATER` roles from the icon mapping.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
@github-actions github-actions Bot added the enhancement New feature or request label Feb 17, 2026
@codecov

codecov Bot commented Feb 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 14.79%. Comparing base (8c5bc65) to head (75b28fc).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...meshtastic/core/ui/component/DropDownPreference.kt 0.00% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4572   +/-   ##
=======================================
  Coverage   14.79%   14.79%           
=======================================
  Files         427      428    +1     
  Lines       14841    14845    +4     
  Branches     2455     2456    +1     
=======================================
+ Hits         2195     2197    +2     
- Misses      12329    12330    +1     
- Partials      317      318    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jamesarich jamesarich added this pull request to the merge queue Feb 17, 2026
Merged via the queue into main with commit 5d198c7 Feb 17, 2026
9 checks passed
@jamesarich jamesarich deleted the feat/role-icons branch February 17, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant