Skip to content

Add project_name_editable attribute to web component#1009

Merged
floehopper merged 7 commits intomainfrom
edit-project-name-in-wc
May 17, 2024
Merged

Add project_name_editable attribute to web component#1009
floehopper merged 7 commits intomainfrom
edit-project-name-in-wc

Conversation

@floehopper
Copy link
Contributor

@floehopper floehopper commented May 15, 2024

Addresses #986 which is part of RaspberryPiFoundation/editor-standalone#16.

This will allow us to make the project name editable in editor-standalone (see RaspberryPiFoundation/editor-standalone#125) while leaving other projects using the web component (e.g. projects-ui) and the integrated version in editor-ui unchanged.

Note that this new attribute only affects the ProjectName component in the ProjectBar and not the one in the sidebar, i.e. in ProjectsPanel.

This property is only being used to decide whether to make the project
name editable in the `ProjectName` component inside the `ProjectBar`
component. Renaming it like this makes it more intention-revealing and
thus makes the code easier to understand.
* Invert the relevant conditions in `ProjectName`.
* Invert the relevant default property values.
* Invert the property value set in `WebComponentProject` and in the unit
  test for `ProjectName`.
I think this makes the code more readable.
This state tracks whether the user is in the process of editing the
project name or not and so I think the new name better reflects it's
purpose.

My actual motivation is that I want to more clearly distinguish
`isEditable` & `setEditable` from the `projectNameEditable` property
which I'm planning to rename to just `editable` in a subsequent commit.
This will allow us to make the project name editable in
editor-standalone while leaving other projects using the web component
and the integrated version in editor-ui unchanged.
@github-actions
Copy link

@floehopper floehopper changed the title Add project_name_editable attribute to web component Add project_name_editable attribute to web component May 15, 2024
Copy link
Contributor

@loiswells97 loiswells97 left a comment

Choose a reason for hiding this comment

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

This looks great overall. My only comment is that the variable name for the boolean that determines whether the name is editable changes throughout (projectNameEditable -> nameEditable -> editable). Maybe this is intentional though?

@floehopper
Copy link
Contributor Author

floehopper commented May 17, 2024

My only comment is that the variable name for the boolean that determines whether the name is editable changes throughout (projectNameEditable -> nameEditable -> editable). Maybe this is intentional though?

Yes, it was intentional - I felt as if the context is different in each case - see Remove redundant prefixes from projectNameEditable, e.g. it doesn't make much sense to me to use a property called projectNameEditable in the ProjectName component - editable makes more sense to me, because the projectName prefix is redundant.

@loiswells97
Copy link
Contributor

My only comment is that the variable name for the boolean that determines whether the name is editable changes throughout (projectNameEditable -> nameEditable -> editable). Maybe this is intentional though?

Yes, it was intentional - I felt as if the context is different in each case - see Remove redundant prefixes from projectNameEditable, e.g. it doesn't make much sense to me to use a property called projectNameEditable in the ProjectName component - editable makes more sense to me, because the projectName prefix is redundant.

Okay, fair enough, I think that makes sense 👍 Let's leave it as it is in that case

Copy link
Contributor

@loiswells97 loiswells97 left a comment

Choose a reason for hiding this comment

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

Looks great, let's get this out there! 👍

@floehopper floehopper merged commit 043f525 into main May 17, 2024
@floehopper floehopper deleted the edit-project-name-in-wc branch May 17, 2024 09:35
@floehopper floehopper mentioned this pull request Jun 3, 2024
floehopper added a commit that referenced this pull request Jun 4, 2024
### Added

- Add `project_name_editable` attribute to web component (#1009)
- Fires custom event when the theme changes (#1015)
- Add `output_only` attribute to web component (#1019 & originally #782)
- Add `assets_identifier` attribute to web component (#1019 & originally
#901)
- Enhance `code` attribute on web component to override project main
component content (#1019 & originally #901)
- Add `runCode`, `stopCode` & `rerunCode` methods to web component
(#1019 & originally #899)
- Send error details in "editor-runCompleted" event (#1019 & originally
#915)
- Return error details to web component (#1019 & originally #915)
- Add `output_panels` attribute to web component (#1019 & originally
#909)

### Changed

- Remove unused `/embedded/projects/:identifier` route (#1013)

### Fixed

- Remove unused `REACT_APP_LOGIN_ENABLED` env var (#1006)
- Fix infinite remix loop when `BYPASS_AUTH` set in `editor-api` (#1007)
- Fixes for docker-compose.yml (#1008)
- Fix deprecation warnings in GitHub Actions (#1011)
- Removed unused `isEmbedded` param from `useProject` call in
`EmbeddedViewer` (#1016)
- Improvements to Cypress specs in CI (#1017)
- Fix warnings and verbose output when starting Webpack Dev Server
(#1018)
- Add e2e spec for project remix behaviour in web component (#1020)
- Fix initial value of `user` in `WebComponentLoader` (#1021)
- Make `authKey` in e2e web component spec more realistic (#1022)
- Remove unused `ComponentStore` (#1023)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants