Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
2460a77
first commit, layout in message box
reinaldonetof Aug 27, 2021
f7f95d0
no match header done
reinaldonetof Aug 27, 2021
61e4af6
permissions, settings and fetch to canned response
reinaldonetof Aug 31, 2021
a103bfc
WatermelonDB configured for canned responses
reinaldonetof Aug 31, 2021
75ccaac
fetch canned responses to watermelon and substr completed
reinaldonetof Aug 31, 2021
e31695b
conditional to show canned response only inside omnichannel
reinaldonetof Sep 1, 2021
6d5119e
View canned responses in actions view
reinaldonetof Sep 1, 2021
e0d9d47
Canned view
reinaldonetof Sep 2, 2021
db582ee
canned response item
reinaldonetof Sep 2, 2021
f6668bb
fetch to get canned responses with filter and list working
reinaldonetof Sep 2, 2021
f2447a9
on text change
reinaldonetof Sep 2, 2021
8ea8234
Pagination with debounce and usecallback
reinaldonetof Sep 3, 2021
6cfa6f6
fetch done
reinaldonetof Sep 6, 2021
5d89135
on use canned response button
reinaldonetof Sep 6, 2021
d829212
tags added to watermelon
reinaldonetof Sep 7, 2021
c93d9a0
canned response details and department to index cannedresponse list
reinaldonetof Sep 8, 2021
5bc9cd1
No match canned to canned list
reinaldonetof Sep 8, 2021
ac1e72e
CannedResponseItem stories
reinaldonetof Sep 8, 2021
bf0307e
index stories
reinaldonetof Sep 8, 2021
5a91eca
isMasterDetail fix
reinaldonetof Sep 8, 2021
4e9619c
getDepartment when open and minor tweaks
reinaldonetof Sep 8, 2021
16cf45d
minor tweak
reinaldonetof Sep 8, 2021
a8f4231
minor tweaks
reinaldonetof Sep 9, 2021
8479eaf
fetch getCannedResponse to api
reinaldonetof Sep 13, 2021
b91c895
ptbr.json and fixed some style
reinaldonetof Sep 13, 2021
dc0ee8e
Removed canned response from watermelon
reinaldonetof Sep 13, 2021
2a33584
Merge branch 'develop' into new.canned-responses
reinaldonetof Sep 13, 2021
da95a14
merge develop into branch and fix some props
reinaldonetof Sep 15, 2021
1d95680
fix bug when join and try to send canned response from inside the can…
reinaldonetof Sep 16, 2021
c457f18
conditional to send text in getDepartments, 25 as count in list
reinaldonetof Sep 16, 2021
b9771a9
fix the this.room in messagebox, minor tweaks in layout
reinaldonetof Sep 16, 2021
2d51a6a
new type of filter departments
reinaldonetof Sep 17, 2021
efa5087
minor tweak
reinaldonetof Sep 17, 2021
ffa9e6c
mback hasPermission to before new changes
reinaldonetof Sep 17, 2021
a5fd22a
minor tweak canned response item stories
reinaldonetof Sep 17, 2021
74e170b
Moved SearchHeader to containers
reinaldonetof Sep 17, 2021
4f89ee0
search text on Header completed
reinaldonetof Sep 17, 2021
1ccb6c2
storyshot
reinaldonetof Sep 17, 2021
e2e054b
implemented the refresh control
reinaldonetof Sep 17, 2021
3310a77
Merge branch 'develop' into new.canned-responses
reinaldonetof Sep 17, 2021
494cdf5
minor tweaks
reinaldonetof Sep 17, 2021
e1c9448
Merge branch 'new.canned-responses' of https://github.com/RocketChat/…
reinaldonetof Sep 17, 2021
8eeba5f
removed header canned and minor tweaks
reinaldonetof Sep 17, 2021
7890fed
Fix minor style
diegolmello Sep 17, 2021
b93c0e1
Unwanted podfile change
diegolmello Sep 17, 2021
5bdcf02
Pair review fixes :)
diegolmello Sep 17, 2021
811eff1
minor tweaks and backgroundContainer
reinaldonetof Sep 20, 2021
79ac996
minor tweak with props
reinaldonetof Sep 20, 2021
8514d52
minor tweak
reinaldonetof Sep 20, 2021
f7f0db4
storyshot
reinaldonetof Sep 20, 2021
842b087
log and return when not room
reinaldonetof Sep 20, 2021
ecc75ba
fix public to global _id
reinaldonetof Sep 21, 2021
8d2af80
Merge branch 'develop' into new.canned-responses
diegolmello Sep 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
587 changes: 587 additions & 0 deletions __tests__/__snapshots__/Storyshots.test.js.snap

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions app/constants/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,8 @@ export default {
},
Jitsi_Enable_Channels: {
type: 'valuesAsBoolean'
},
Canned_Responses_Enable: {
type: 'valueAsBoolean'
}
};
49 changes: 49 additions & 0 deletions app/containers/MessageBox/Mentions/MentionHeaderList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React, { useContext } from 'react';
import { View, Text, ActivityIndicator, TouchableOpacity } from 'react-native';
import PropTypes from 'prop-types';

import { MENTIONS_TRACKING_TYPE_CANNED } from '../constants';
import styles from '../styles';
import sharedStyles from '../../../views/Styles';
import I18n from '../../../i18n';
import { themes } from '../../../constants/colors';
import { CustomIcon } from '../../../lib/Icons';
import MessageboxContext from '../Context';

const MentionHeaderList = ({ trackingType, hasMentions, theme, loading }) => {
const context = useContext(MessageboxContext);
const { onPressNoMatchCanned } = context;

if (trackingType === MENTIONS_TRACKING_TYPE_CANNED) {
if (loading) {
return (
<View style={styles.wrapMentionHeaderListRow}>
<ActivityIndicator style={styles.loadingPaddingHeader} size='small' />
<Text style={[styles.mentionHeaderList, { color: themes[theme].auxiliaryText }]}>{I18n.t('Searching')}</Text>
</View>
);
}

if (!hasMentions) {
return (
<TouchableOpacity style={[styles.wrapMentionHeaderListRow, styles.mentionNoMatchHeader]} onPress={onPressNoMatchCanned}>
<Text style={[styles.mentionHeaderListNoMatchFound, { color: themes[theme].auxiliaryText }]}>
{I18n.t('No_match_found')} <Text style={sharedStyles.textSemibold}>{I18n.t('Check_canned_responses')}</Text>
</Text>
<CustomIcon name='chevron-right' size={24} color={themes[theme].auxiliaryText} />
</TouchableOpacity>
);
}
}

return null;
};

MentionHeaderList.propTypes = {
trackingType: PropTypes.string,
hasMentions: PropTypes.bool,
theme: PropTypes.string,
loading: PropTypes.bool
};

export default MentionHeaderList;
17 changes: 16 additions & 1 deletion app/containers/MessageBox/Mentions/MentionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Avatar from '../../Avatar';
import MessageboxContext from '../Context';
import FixedMentionItem from './FixedMentionItem';
import MentionEmoji from './MentionEmoji';
import { MENTIONS_TRACKING_TYPE_COMMANDS, MENTIONS_TRACKING_TYPE_EMOJIS } from '../constants';
import { MENTIONS_TRACKING_TYPE_EMOJIS, MENTIONS_TRACKING_TYPE_COMMANDS, MENTIONS_TRACKING_TYPE_CANNED } from '../constants';
import { themes } from '../../../constants/colors';
import { IEmoji } from '../../EmojiPicker/interfaces';

Expand All @@ -17,6 +17,8 @@ interface IMessageBoxMentionItem {
username: string;
t: string;
id: string;
shortcut: string;
text: string;
} & IEmoji;
trackingType: string;
theme: string;
Expand All @@ -32,6 +34,8 @@ const MentionItem = ({ item, trackingType, theme }: IMessageBoxMentionItem) => {
return `mention-item-${item.name || item}`;
case MENTIONS_TRACKING_TYPE_COMMANDS:
return `mention-item-${item.command || item}`;
case MENTIONS_TRACKING_TYPE_CANNED:
return `mention-item-${item.shortcut || item}`;
default:
return `mention-item-${item.username || item.name || item}`;
}
Expand Down Expand Up @@ -68,6 +72,17 @@ const MentionItem = ({ item, trackingType, theme }: IMessageBoxMentionItem) => {
);
}

if (trackingType === MENTIONS_TRACKING_TYPE_CANNED) {
content = (
<>
<Text style={[styles.cannedItem, { color: themes[theme].titleText }]}>!{item.shortcut}</Text>
<Text numberOfLines={1} style={[styles.cannedMentionText, { color: themes[theme].auxiliaryTintColor }]}>
{item.text}
</Text>
</>
);
}

return (
<TouchableOpacity
style={[
Expand Down
14 changes: 11 additions & 3 deletions app/containers/MessageBox/Mentions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,43 @@ import React from 'react';
import { FlatList, View } from 'react-native';
import { dequal } from 'dequal';

import MentionHeaderList from './MentionHeaderList';
import styles from '../styles';
import MentionItem from './MentionItem';
import { themes } from '../../../constants/colors';

interface IMessageBoxMentions {
mentions: [];
mentions: any[];
trackingType: string;
theme: string;
loading: boolean;
}

const Mentions = React.memo(
({ mentions, trackingType, theme }: IMessageBoxMentions) => {
({ mentions, trackingType, theme, loading }: IMessageBoxMentions) => {
if (!trackingType) {
return null;
}
return (
<View testID='messagebox-container'>
<FlatList
style={[styles.mentionList, { backgroundColor: themes[theme].auxiliaryBackground }]}
ListHeaderComponent={() => (
<MentionHeaderList trackingType={trackingType} hasMentions={mentions.length > 0} theme={theme} loading={loading} />
)}
data={mentions}
extraData={mentions}
renderItem={({ item }) => <MentionItem item={item} trackingType={trackingType} theme={theme} />}
keyExtractor={(item: any) => item.rid || item.name || item.command || item}
keyExtractor={item => item.rid || item.name || item.command || item.shortcut || item}
keyboardShouldPersistTaps='always'
/>
</View>
);
},
(prevProps, nextProps) => {
if (prevProps.loading !== nextProps.loading) {
return false;
}
if (prevProps.theme !== nextProps.theme) {
return false;
}
Expand Down
1 change: 1 addition & 0 deletions app/containers/MessageBox/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export const MENTIONS_TRACKING_TYPE_USERS = '@';
export const MENTIONS_TRACKING_TYPE_EMOJIS = ':';
export const MENTIONS_TRACKING_TYPE_COMMANDS = '/';
export const MENTIONS_TRACKING_TYPE_ROOMS = '#';
export const MENTIONS_TRACKING_TYPE_CANNED = '!';
export const MENTIONS_COUNT_TO_DISPLAY = 4;
Loading