Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32161769
D5813.1765043714.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D5813.1765043714.diff
View Options
diff --git a/native/chat/composed-message.react.js b/native/chat/composed-message.react.js
--- a/native/chat/composed-message.react.js
+++ b/native/chat/composed-message.react.js
@@ -138,7 +138,7 @@
);
let inlineSidebar = null;
- if (item.threadCreatedFromMessage) {
+ if (item.threadCreatedFromMessage || item.reactions.size > 0) {
const positioning = isViewer ? 'right' : 'left';
const inlineSidebarPositionStyle =
positioning === 'left'
@@ -146,7 +146,10 @@
: styles.rightInlineSidebar;
inlineSidebar = (
<View style={[styles.inlineSidebar, inlineSidebarPositionStyle]}>
- <InlineSidebar threadInfo={item.threadCreatedFromMessage} />
+ <InlineSidebar
+ threadInfo={item.threadCreatedFromMessage}
+ reactions={item.reactions}
+ />
</View>
);
}
diff --git a/native/chat/inline-sidebar.react.js b/native/chat/inline-sidebar.react.js
--- a/native/chat/inline-sidebar.react.js
+++ b/native/chat/inline-sidebar.react.js
@@ -1,5 +1,6 @@
// @flow
+import invariant from 'invariant';
import * as React from 'react';
import { Text, View } from 'react-native';
import Animated, {
@@ -8,6 +9,7 @@
} from 'react-native-reanimated';
import useInlineSidebarText from 'lib/hooks/inline-sidebar-text.react';
+import type { MessageReactionInfo } from 'lib/selectors/chat-selectors';
import type { ThreadInfo } from 'lib/types/thread-types';
import CommIcon from '../components/comm-icon.react';
@@ -24,7 +26,7 @@
type Props = {
+threadInfo: ?ThreadInfo,
- +reactions?: $ReadOnlyArray<string>,
+ +reactions?: $ReadOnlyMap<string, MessageReactionInfo>,
+disabled?: boolean,
};
function InlineSidebar(props: Props): React.Node {
@@ -41,16 +43,28 @@
const styles = useStyles(unboundStyles);
const reactionList = React.useMemo(() => {
- if (!reactions || reactions.length === 0) {
+ if (!reactions) {
return null;
}
- const reactionItems = reactions.map(reaction => {
- return (
- <Text key={reaction} style={styles.reaction}>
- {reaction}
- </Text>
- );
- });
+
+ let reactionText = '';
+ let index = 0;
+ for (const key of reactions.keys()) {
+ const reactionInfo = reactions.get(key);
+ invariant(reactionInfo, 'reactionInfo should be set');
+
+ if (index > 0) {
+ reactionText += ' ';
+ }
+ reactionText += key;
+ if (reactionInfo.users.size > 1) {
+ reactionText += ` ${reactionInfo.users.size}`;
+ }
+ index++;
+ }
+
+ const reactionItems = <Text style={styles.reaction}>{reactionText}</Text>;
+
return <View style={styles.reactionsContainer}>{reactionItems}</View>;
}, [reactions, styles.reaction, styles.reactionsContainer]);
diff --git a/native/chat/robotext-message.react.js b/native/chat/robotext-message.react.js
--- a/native/chat/robotext-message.react.js
+++ b/native/chat/robotext-message.react.js
@@ -54,10 +54,13 @@
const styles = useStyles(unboundStyles);
let inlineSidebar = null;
- if (item.threadCreatedFromMessage) {
+ if (item.threadCreatedFromMessage || item.reactions.size > 0) {
inlineSidebar = (
<View style={styles.sidebar}>
- <InlineSidebar threadInfo={item.threadCreatedFromMessage} />
+ <InlineSidebar
+ threadInfo={item.threadCreatedFromMessage}
+ reactions={item.reactions}
+ />
</View>
);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 6, 5:55 PM (20 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5839944
Default Alt Text
D5813.1765043714.diff (3 KB)
Attached To
Mode
D5813: [native] introduce reactions to inline sidebar
Attached
Detach File
Event Timeline
Log In to Comment