frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Picture elements position

Open 4ybaka opened this issue 5 months ago • 9 comments

Proposed change

This change simplifies configuration of Picture Elements card. Today when you need to position element you need to edit position in yaml (using keyboard) and compare with new position on card. It requires 3-5 edits that is not efficient. With this change when you are in element edit mode you can click on card where current element should be placed and position in yaml config will be updated with chosen position.

Type of change

  • [ ] Dependency upgrade
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [x] New feature (thank you!)
  • [ ] Breaking change (fix/feature causing existing functionality to break)
  • [ ] Code quality improvements to existing code or addition of tests

Example configuration


Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • [x] The code change is tested and works locally.
  • [x] There is no commented out code in this PR.
  • [ ] Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

4ybaka avatar Jun 01 '25 18:06 4ybaka

Can someone explain what linter expects here?

Checking formatting... [warn] src/panels/lovelace/editor/config-elements/hui-picture-elements-card-editor.ts [warn] Code style issues found in the above file. Run Prettier with --write to fix. Error: Process completed with exit code 1.

4ybaka avatar Jun 09 '25 20:06 4ybaka

yarn lint:eslint will give you more info but yarn format will probably just fix it for you

MindFreeze avatar Jun 12 '25 13:06 MindFreeze

Should I run it in devcontainer? I got next error there:

ha-venvvscode ➜ /workspaces/frontend $ yarn format

/workspaces/frontend/gallery/src/components/page-description.ts
  5:23  error  Missing file extension for "../../build/import-pages"  import/extensions

/workspaces/frontend/gallery/src/ha-gallery.ts
  12:32  error  Missing file extension for "../build/import-pages"  import/extensions

✖ 2 problems (2 errors, 0 warnings)

4ybaka avatar Jun 12 '25 17:06 4ybaka

Usage example PowerToys_IkkZlFEihu

4ybaka avatar Jun 13 '25 08:06 4ybaka

The prettier warnings are still causing the CI to fail: You can run yarn run format:prettier to fix.

silamon avatar Jun 14 '25 08:06 silamon

The prettier warnings are still causing the CI to fail: You can run yarn run format:prettier to fix.

fixed

4ybaka avatar Jun 14 '25 21:06 4ybaka

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1:

Learn more about our pull request process.

home-assistant[bot] avatar Jun 15 '25 14:06 home-assistant[bot]

A text hint in the editor would be nice to explain that you can do this. I can't find a good example to guide you though

MindFreeze avatar Jun 15 '25 14:06 MindFreeze

A text hint in the editor would be nice to explain that you can do this. I can't find a good example to guide you though

I have very bad UX skills so I can only add a note to the "Style" title but I don't think it is a good idea.

4ybaka avatar Jun 15 '25 15:06 4ybaka

We would really like to have this but there are a couple of issues with it:

  • Isn't discoverable. This can easily be fixed by adding a <ha-alert> or something in the editor of the element when its position is appropriate
  • This will cause unexpected behavior when editing composable cards like grid,horizontal-stack or vertical-stack with multiple picture-elements cards in them. This is not easy to solve and we want to come up with a general strategy for cards to send events to their specific editors because it can be useful for other cards too.

MindFreeze avatar Jul 14 '25 10:07 MindFreeze

I'm afraid I will not be able to help with solution for 2, I have not enough knowledge about HA Frontend codebase. I hope core contributors will be able to define a solution for that problem and then I can follow the guidelines for this change.

4ybaka avatar Jul 22 '25 22:07 4ybaka

Related: https://github.com/home-assistant/frontend/pull/25049

bramkragten avatar Oct 01 '25 08:10 bramkragten

This seems to have gone stale, we do want this feature, so I will create a task that can be picked up later to finish this.

bramkragten avatar Oct 29 '25 10:10 bramkragten