Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve names edit handling (fixes #123) (fixes #149) #404

Merged

Conversation

BlitzundBogen
Copy link
Contributor

@BlitzundBogen BlitzundBogen commented Mar 15, 2024

Added some fixes and improvements in names' edit handling.

Fixes:

  • name-type not selected
  • fix show-more feature

Features:

  • add sort to surname
  • add delete to name and surname

UX/UI improvements:

  • use editable list for names
  • add name edit form validation
  • improve name-type vs. custom-type handling
  • some minor styling

Fixes:

@BlitzundBogen BlitzundBogen changed the title Improve names handling (fixes #123) (fixes #149) Improve names edit handling (fixes #123) (fixes #149) Mar 15, 2024
@DavidMStraub
Copy link
Member

Great, thanks! Let me know when it's ready for review.

One comment: please don't modify the langugage JSONs, they are updated via Weblate. Unfortunately changing the english string is only possible by adding a new one (unless I'm mistaken).

@BlitzundBogen
Copy link
Contributor Author

Great, thanks! Let me know when it's ready for review.

One comment: please don't modify the langugage JSONs, they are updated via Weblate. Unfortunately changing the english string is only possible by adding a new one (unless I'm mistaken).

I was also unsure about the language jsons. I will change it.

Generally I am not a JavaScript crack at all, so I am really happy for feedback for improvements. 😄
Also I have still issues getting the test locally to run. I guess after fixing this, I might be review ready. I let you know when I am ready.

@DavidMStraub
Copy link
Member

Also I have still issues getting the test locally to run. I guess after fixing this, I might be review ready. I let you know when I am ready.

Unfortunately there are no unit tests for this repo as I'm not good with Javascript unit tests 🙁 . Are you referring to the Web API (Python) tests?

: given
return html`${given} ${surname} ${suffix}`
return html`${given} ${nick ? `"${nick}" ` : ''}${surname} ${suffix}`
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice to use typographical quotation marks (although strictly speaking that would even by locale dependent)

Copy link
Member

Choose a reason for hiding this comment

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

But on second thought I am not sure I would like to always have the nickname displayed as part of the page title ... does Gramps Desktop do it like that? I think we can use that as guidance to have a more consistent user experience. For instance, if both Gramps & Gramps Web would display nicknames as part of the person profile's title, I would likely want to move more informal nick names to a secondary name to prevent them from showing up...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How do you deal with those kind of suggestions in the project? Should I open a discussion here in gitlab?

But you are right. I guess the best thing would be, if the user could choose (and define it in the user settings).

The scenario I came up with this was: It used to be like that, that parents and children often share the same given name. Sometimes they differ in second or third given names (which might not be known). To make it easier to distinguish persons, this might help.

I will remove this for now.

In my family tree there are some persons with this issue 😄 This is why they mostly have a nickname. To distinguish e.g. between mother and daughter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I can implement this when solving #67

for="button-switch-type"
content="${this._hasCustomType
? this._('Switch to default type')
: this._('Add custom type')}"
Copy link
Member

Choose a reason for hiding this comment

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

I suggest to leave the string as it was orginally to not lose the translations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do that. Still I would like to propose to add the string 'Add custom type' for this scenario. It's more self explaning. But I woulf leave it like it was for now. 😄

Copy link
Contributor Author

@BlitzundBogen BlitzundBogen Mar 21, 2024

Choose a reason for hiding this comment

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

Or maybe I add the string. From UX-perspective I see it like this:
If I set a custom type and save it will become a "default type" (as it is now in the default types list in the frontend). When users read "switch" they might expect to see the custom type set before there.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure what you mean. There are two kinds of types in Gramps: default types and custom types. The default types are translated, while the custom types are just arbitrary strings. You can either select from a list of default types, or use a custom type instead. If you want to replace a custom type by a default type again, you have to switch back to the dropdown list.

Copy link
Member

Choose a reason for hiding this comment

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

After trying it out I get your point and I think you're right 😄 I missed the fact that the dropdown contains both custom and default types.

So: great idea.

@DavidMStraub
Copy link
Member

I couldn't resist to already add a couple of comments. The code looks really good overall!

@BlitzundBogen
Copy link
Contributor Author

Also I have still issues getting the test locally to run. I guess after fixing this, I might be review ready. I let you know when I am ready.

Unfortunately there are no unit tests for this repo as I'm not good with Javascript unit tests 🙁 . Are you referring to the Web API (Python) tests?

I haven't really gotten into this by now. I just thought there were some, because there is this "test"-script in the package.json. But okay, then I will ignore this. Maybe I can add some someday 😄

@BlitzundBogen
Copy link
Contributor Author

Great, thanks! Let me know when it's ready for review.

One comment: please don't modify the langugage JSONs, they are updated via Weblate. Unfortunately changing the english string is only possible by adding a new one (unless I'm mistaken).

I am still not quite sure how to introduce new strings. I found the strings.js, but those translations seem to come from the backend. I saw in one commit a string added to the en.json? So this seems to be the way to go!?!

Or does Weblate identifies them inside the code? (I doubt it. 😄 )

@BlitzundBogen BlitzundBogen marked this pull request as ready for review March 21, 2024 18:50
@DavidMStraub
Copy link
Member

Yes, just add new strings to en.json.

@DavidMStraub
Copy link
Member

I tried out your code, great work! It brings the whole name editing experience to a new level. Just two small things:

  • The only feature that's still missing is changing the primary name. That would be relatively simple to implement I guess using e.g. a "star" button. Up to you if you want to add it, we can always add it later
  • I was confused by the presence of the delete and up/down buttons if the name details are not expanded yet, because they have no effect/meaning:

image

Can you hide them?

@BlitzundBogen
Copy link
Contributor Author

BlitzundBogen commented Mar 27, 2024

I tried out your code, great work! It brings the whole name editing experience to a new level. Just two small things:

* The only feature that's still missing is changing the primary name. That would be relatively simple to implement I guess using e.g. a "star" button. Up to you if you want to add it, we can always add it later

* I was confused by the presence of the delete and up/down buttons if the name details are not expanded yet, because they have no effect/meaning:

Can you hide them?

Thanks a lot! And yes!

1.I wanted to add changing the primary name. Thanks for the hint. Just forgot it last week. 😄
2. You are right. I will hide the editing options until the details are shown. When you have more names in the list, it's not so bad. But I definitely see the point.

@DavidMStraub
Copy link
Member

Hi @BlitzundBogen should we merge it as is right now or two you want to implement the two points above? However there is a conflict right now.

@BlitzundBogen
Copy link
Contributor Author

Hi @BlitzundBogen should we merge it as is right now or two you want to implement the two points above? However there is a conflict right now.

I am sorry, I didn't have the time to improve. I will try to at least solve the conflicts this week. If I do not find the time I will definitely find it the week after. Then I could also do the improvements.

@BlitzundBogen
Copy link
Contributor Author

I had some issues with my dev environment again, which took me some time to solve. For now only the order of names/changing primary name is missing. I would suggest, if you are ready to merge, just do it and I will open a new PR for this issue. If I am faster, i will add it here. But currently I doubt that. 😄

PS: David, what happened to you profile? I cannot find you anymore. 😱

@m-breitbach
Copy link

I am a big fan of these changes, thank you for taking care. Looking forward to do thorough testing and giving feedback. (I have no dev setup yet, so I will have to wait until the release. Is there documentation for a proper dev setup?)

@DavidMStraub
Copy link
Member

Is there documentation for a proper dev setup

Not sure about the "proper" 😉 but here is the documentation: https://www.grampsweb.org/dev-frontend/setup/

@DavidMStraub
Copy link
Member

PS: David, what happened to you profile? I cannot find you anymore. 😱

Yes, Github (or its AI) suspended my account (in error) and it took them one month to process my appeal 😭

@DavidMStraub
Copy link
Member

I'm rebasing now.

@DavidMStraub DavidMStraub force-pushed the feature/improve-names-handling branch from 6999dd9 to b589112 Compare June 29, 2024 10:43
@DavidMStraub DavidMStraub merged commit fdebaf5 into gramps-project:main Jun 29, 2024
1 check passed
@DavidMStraub
Copy link
Member

🎉

DavidMStraub pushed a commit to DavidMStraub/Gramps.js that referenced this pull request Jul 1, 2024
…project#149) (gramps-project#404)

* Fix type not shown as selected

* Align names edit ux as editable list

* Add delete name

* Add validation to name form

* Improve name type ux

* Use classMap instead of style

* Add ui improvements to surnames

* Fix show more in name edit

* Add edit features to surnames

* Add nick to name

* Use existing strings

* Adjust call and remove nickname

* Add language strings

* Only show edit buttons on "show more"

---------

Co-authored-by: BlitzundBogen <code@blitzundbogen.de>
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.

3 participants