Skip to content

Feature/zone icons#695

Open
regnerus wants to merge 3 commits into
developfrom
feature/zone-icons
Open

Feature/zone icons#695
regnerus wants to merge 3 commits into
developfrom
feature/zone-icons

Conversation

@regnerus
Copy link
Copy Markdown
Contributor

Adds a shared Zone icon API backed by a JSON manifest, including legacy icon resolution and tests for the new public helpers.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a shared Zone icon API to node-homey-lib, backed by a JSON manifest, including legacy icon ID resolution and a small test suite to validate the new public helpers.

Changes:

  • Introduces lib/Zone with getIcons() and resolveIcon() (manifest-driven, with legacy ID mapping).
  • Exposes getZoneIcons() / resolveZoneIcon() (and Zone) from the root index.js.
  • Adds assets/zone/icons.json manifest and test/zone.js coverage for active/legacy/unknown icon resolution.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
test/zone.js Adds tests covering active icon enumeration, on-disk asset presence, and legacy/unknown resolution behavior.
lib/Zone/index.js Implements manifest-backed Zone icon listing, caching, legacy ID remapping, and descriptor creation.
index.js Exports Zone and binds new top-level helpers getZoneIcons / resolveZoneIcon.
assets/zone/icons.json Defines the default icon, active icons list, and legacy icon remapping rules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/Zone/index.js
Comment on lines +72 to +76
static _createIconDescriptor({
id,
fileName,
}) {
const descriptor = {
Comment thread assets/zone/icons.json
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The svg file names in both Sketch as in this file should use - not _

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in commit 74a9333: all zone SVG filenames and manifest references now use hyphens instead of underscores.

Copy link
Copy Markdown
Contributor

@nozols nozols May 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HarwinBorger we cannot just change these file paths, that is a breaking change for consumers of this library. I don't think that's worth it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed with @HarwinBorger privately on Slack, I agree that the naming is currently inconsistent. However, I also agree with @nozols that changing this would be a breaking change and is out of scope for this PR.

If we want to make the naming more consistent, we should first inventory which consumers rely on the current naming and check whether we can change this safely in separate PRs.

@HarwinBorger could you revert your changes for this PR?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added these icons like two weeks ago so I doubt anyone uses them at this point.

Just bump a major version :)

Comment thread lib/Zone/index.js
* @param {string | null | undefined} icon
* @returns {ZoneIconDescriptor}
*/
static resolveIcon(icon) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot is this the best name for the function?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kept the name resolveIcon (current HEAD 74a9333) because it stays concise within Zone and aligns with the public resolveZoneIcon export; it resolves an icon id to the descriptor.

Copilot AI requested a review from HarwinBorger May 13, 2026 06:27
Comment thread test/zone.js
it('returns active zone icons', function() {
const icons = HomeyLib.getZoneIcons();

assert.strictEqual(icons.length, 47);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to check icons.length > 0 instead, then we don't have to update the tests if we add more icons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants