-
Notifications
You must be signed in to change notification settings - Fork 13.1k
[IMPROVE] Message rewrite #24866
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
Merged
Merged
[IMPROVE] Message rewrite #24866
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
bf6e350
SelectMessages on MailExportForm
juliajforesti a9a96ef
fix types
juliajforesti a19ebaa
useCountSelected implemented
juliajforesti 02b9d74
clear selection on tab close
juliajforesti 06325f8
REVIEW
ggazzo 9352eec
review
ggazzo 1a3a93a
Add CheckBox on MailExport MessageSelect
juliajforesti e0c680a
Merge branch 'message-template-3' of https://github.com/RocketChat/Ro…
juliajforesti 235b52c
Add reset and clearStore methods on SelectedMessagesProvider
juliajforesti d78b1ca
Remove jquery handlers
juliajforesti 5ce6d7b
fix ci
ggazzo c617390
CI
ggazzo 2d3c523
Convert MailExportForm to tsx
juliajforesti 54b26f2
fix
juliajforesti 1b7900d
Convert ExportMessages to tsx
juliajforesti 0ca4241
Convert FileExport to tsx
juliajforesti 1186590
Merge branch 'message-template-3' of https://github.com/RocketChat/Ro…
juliajforesti 68df80b
Add selected style props on Message.tsx
juliajforesti 26ef2e5
fix types
juliajforesti 6e6d68c
Add isEditing prop to MessageTemplate
juliajforesti 536e9bf
Merge branch 'message-template-2' of https://github.com/RocketChat/Ro…
juliajforesti 778f549
review changes
juliajforesti 27fc576
Merge remote-tracking branch 'origin/message-template-2' into message…
ggazzo 05b524e
Merge branch 'message-template-2' into message-template-3
ggazzo be025d9
update fuselage next version
juliajforesti c1b0ef0
fix chat.react
ggazzo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
client/views/room/MessageList/contexts/SelectedMessagesContext.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import { OffCallbackHandler } from '@rocket.chat/emitter'; | ||
| import { createContext, useCallback, useContext, useMemo } from 'react'; | ||
| import { useSubscription } from 'use-subscription'; | ||
|
|
||
| import { selectedMessageStore } from '../../providers/SelectedMessagesProvider'; | ||
|
|
||
| type SelectMessageContextValue = { | ||
| selectedMessageStore: typeof selectedMessageStore; | ||
| }; | ||
|
|
||
| export const SelectedMessageContext = createContext({ | ||
| selectedMessageStore, | ||
| } as SelectMessageContextValue); | ||
|
|
||
| export const useIsSelectedMessage = (mid: string): boolean => { | ||
| const { selectedMessageStore } = useContext(SelectedMessageContext); | ||
| const subscription = useMemo( | ||
| () => ({ | ||
| getCurrentValue: (): boolean => selectedMessageStore.isSelected(mid), | ||
| subscribe: (callback: () => void): OffCallbackHandler => selectedMessageStore.on(mid, callback), | ||
| }), | ||
| [mid, selectedMessageStore], | ||
| ); | ||
| return useSubscription(subscription); | ||
| }; | ||
|
|
||
| export const useIsSelecting = (): boolean => { | ||
| const { selectedMessageStore } = useContext(SelectedMessageContext); | ||
|
|
||
| return useSubscription( | ||
| useMemo( | ||
| () => ({ | ||
| getCurrentValue: (): boolean => selectedMessageStore.getIsSelecting(), | ||
| subscribe: (callback: () => void): OffCallbackHandler => selectedMessageStore.on('toggleIsSelecting', callback), | ||
| }), | ||
| [selectedMessageStore], | ||
| ), | ||
| ); | ||
| }; | ||
|
|
||
| export const useToggleSelect = (mid: string): (() => void) => { | ||
| const { selectedMessageStore } = useContext(SelectedMessageContext); | ||
| return useCallback(() => { | ||
| selectedMessageStore.toggle(mid); | ||
| }, [mid, selectedMessageStore]); | ||
| }; | ||
|
|
||
| export const useCountSelected = (): number => { | ||
| const { selectedMessageStore } = useContext(SelectedMessageContext); | ||
|
|
||
| return useSubscription( | ||
| useMemo( | ||
| () => ({ | ||
| getCurrentValue: (): number => selectedMessageStore.count(), | ||
| subscribe: (callback: () => void): OffCallbackHandler => selectedMessageStore.on('change', callback), | ||
| }), | ||
| [selectedMessageStore], | ||
| ), | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.