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

Select multiple messages in chat for forwarding & deletion #3606

Closed
wants to merge 35 commits into from

Conversation

farooqkz
Copy link
Collaborator

@farooqkz farooqkz commented Dec 28, 2023

This PR aims to implement selecting multiple messages for forwarding and deleting. Reviews are welcome after christmas :)

i know, this is a draft, bit some comments on testing:

* the "forward/delete" bar needs a "cancel" or "X" button (i think, an "X" to the very right would be pretty straight forward)

* it is not possible to select images as this enlages images - every tap should just select in select mode. at best, we should also handle taps in the backgound left/right of the bubbles (esp. if we hilite messages using a background color)

* if not too hard, i'd prefer to have the "forward/delete bar" at the bottom, replacing the input bar during select mode

otherwise, this is a really BIG enhancement - in comparable few lines of code :) great!

  • We've got a cancel button now
  • Fixed
  • We should get votes for that

image

this would solve one part of #2892 (that issue is about multi select in chatlist, message list and gallery)

@adzialocha adzialocha changed the base branch from master to far-buttons-refactor December 31, 2023 11:14
Copy link
Member

@adzialocha adzialocha left a comment

Choose a reason for hiding this comment

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

I can see some nice patterns here with dedicated components and reducer logic for the selection logic.

As written above I'd suggest to factor out the state as well into an own context, to avoid prop drilling and making Message and MessageList more complex.

You already have some code isolation in place and we could go even further. I'd suggest to create a new folder and move a context implementation, your new components, the reducer and maybe even the CSS module there to make it all represent the "multi select" feature, completly independent from the rest.

CHANGELOG.md Outdated Show resolved Hide resolved
scss/message/_select-mode-mask.scss Outdated Show resolved Hide resolved
Comment on lines 67 to 68
@import 'message/_selected-messages-action.scss';
@import 'message/_select-mode-mask.scss';
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to use CSS modules here instead if possible

scss/message/_selected-messages-action.scss Show resolved Hide resolved
Comment on lines 98 to 100
selectMessage: (id: number) => void
unselectMessage: (id: number) => void
selectedMessages: number[]
Copy link
Member

Choose a reason for hiding this comment

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

MessageList and Message get quite many new props here which I wouldn't see directly as part of the message component itself.

Maybe we can introduce a context here instead to manage the selection state for messages? The context lives in the currently displayed chat and every message can consume the state of the context to understand if it is selected or not.

I've seen you already have a nice reducer. With the context representing the state and the reducer changing it we can have a nice isolated logic. All of this can be moved into own files.

src/renderer/components/message/MessageListAndComposer.tsx Outdated Show resolved Hide resolved
@adzialocha adzialocha changed the title Implementing messages mutli select Select multiple messages in chat Dec 31, 2023
@adzialocha adzialocha changed the title Select multiple messages in chat Allow selecting multiple messages in chat Dec 31, 2023
@adzialocha adzialocha changed the title Allow selecting multiple messages in chat Select multiple messages in chat for forwarding & deletion Dec 31, 2023
@adzialocha
Copy link
Member

Let me know if you need any help with my suggested changes! Also I've changed the target branch to the button refactor one as this branch includes these changes as well, hope that's okay.

@adzialocha adzialocha added the enhancement New feature or request label Dec 31, 2023
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.

does not work for me or I don't understand how to do it, lets put it into draft state again until it is mergeable.

@Simon-Laux Simon-Laux marked this pull request as draft December 31, 2023 19:31
@farooqkz
Copy link
Collaborator Author

does not work for me or I don't understand how to do it, lets put it into draft state again until it is mergeable.

I've began to use Contexts thanks to adz. You can omit my last commit to see the working version with props drilling.

@farooqkz
Copy link
Collaborator Author

farooqkz commented Jan 7, 2024

@adz, I have difficulty implementing your suggestion. Some hints?

On second thought, please give me some more days.

@farooqkz
Copy link
Collaborator Author

farooqkz commented Jan 9, 2024

@adz, I have difficulty implementing your suggestion. Some hints?

On second thought, please give me some more days.

Okay I'm stuck, man!

@adz
Copy link

adz commented Jan 9, 2024

Different adz I think. Interesting project though.

@adzialocha
Copy link
Member

This is a really nice feature and I'd love to see it getting released, maybe in v1.46. @farooqkz we can look at it together whenever you are ready in the next weeks, I'm happy to make some direct code suggestions as well if that's fine with you

Base automatically changed from far-buttons-refactor to master February 19, 2024 12:35
@adzialocha adzialocha removed their assignment Apr 24, 2024
@Simon-Laux Simon-Laux linked an issue Jul 31, 2024 that may be closed by this pull request
@hpk42
Copy link
Contributor

hpk42 commented Oct 17, 2024

Discussed with nico and farooq -- putting this into project resurrection for when the time comes!

@hpk42 hpk42 closed this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Closed PRs and Issues
Development

Successfully merging this pull request may close these issues.

5 participants