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

refactor: unify "Select Chat": use one component #4440

Merged
merged 2 commits into from
Jan 11, 2025

Conversation

WofWca
Copy link
Collaborator

@WofWca WofWca commented Dec 24, 2024

For:

  • webxdc sendToChat()
  • mailto dialog
  • "Forward Message" dialog

What this commit comes down to:

  • Take the ForwardTo dialog and use it to create
    a more generic, reusable SelectChat dialog.
  • Make those similar dialogs use the new SelectChat component,
    instead of defining their markup and logic manually.

The dialogs have practically the same markup and the same
search logic, with very little differences.
They apparently were copy-pasted from ForwardMessage dialog,
which is the oldest of them all.

It's getting pretty annoying to maintain them, with all the
RovingTabindex and InfiniteLoader, so, it's about time
to unify them.

This is mainly a refactor, but causes a few small visual changes.
For example, this fixes a small visual bug
in the WebxdcSendToChat dialog
where the search field takes full height
when there are no search results.

This commit does not compile.
This is a preparation for the unification of the
"Select Chat" dialogs.
The rename is performed in a separate commit to preserve git history.

ForwardMessage is the oldest such "Select Chat" dialog,
from which apparently all the other ones were copy-pasted.
For:
- webxdc `sendToChat()`
- mailto dialog
- "Forward Message" dialog

What this commit comes down to:
- Take the ForwardTo dialog and use it to create
  a more generic, reusable SelectChat dialog.
- Make those similar dialogs use the new SelectChat component,
  instead of defining their markup and logic manually.

The dialogs have practically the same markup and the same
search logic, with very little differences.
They apparently were copy-pasted from `ForwardMessage` dialog,
which is the oldest of them all.

It's getting pretty annoying to maintain them, with all the
`RovingTabindex` and `InfiniteLoader`, so, it's about time
to unify them.

This is mainly a refactor, but causes a few small visual changes.
For example, this fixes a small visual bug
in the `WebxdcSendToChat` dialog
where the search field takes full height
when there are no search results.
Copy link
Contributor

@nicodh nicodh left a comment

Choose a reason for hiding this comment

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

Reviewed by testing & reading

@WofWca WofWca requested a review from Simon-Laux January 10, 2025 16:44
@WofWca
Copy link
Collaborator Author

WofWca commented Jan 10, 2025

@Simon-Laux Could you please see if you agree with the general idea of this MR?

Copy link
Member

@Simon-Laux Simon-Laux left a comment

Choose a reason for hiding this comment

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

Good idea. removing code without removing functionality is always good 👍

#3030 would affect all 3 dialogs, so having only one place to add contacts to is also nice for that.

@WofWca WofWca merged commit 2d33d5b into main Jan 11, 2025
13 of 14 checks passed
@WofWca WofWca deleted the wofwca/refactor-unify-select-chat-dialogs branch January 11, 2025 12:17
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