From 674c73eceda431993975d13dc47a6370e7b63d66 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 22 Apr 2021 18:43:37 -0400 Subject: added delete button --- src/components/messages/ChannelPreview.tsx | 112 ++++++++++++++++++++--------- 1 file changed, 78 insertions(+), 34 deletions(-) (limited to 'src/components') diff --git a/src/components/messages/ChannelPreview.tsx b/src/components/messages/ChannelPreview.tsx index 8bd3a745..6b166b55 100644 --- a/src/components/messages/ChannelPreview.tsx +++ b/src/components/messages/ChannelPreview.tsx @@ -1,10 +1,15 @@ import {useNavigation} from '@react-navigation/core'; import React, {useContext} from 'react'; import {Image, StyleSheet, Text, View} from 'react-native'; -import {TouchableOpacity} from 'react-native-gesture-handler'; +import { + RectButton, + Swipeable, + TouchableOpacity, +} from 'react-native-gesture-handler'; import {useStore} from 'react-redux'; import {ChannelPreviewMessengerProps} from 'stream-chat-react-native'; import {ChatContext} from '../../App'; +import Trash from '../../assets/ionicons/trash-outline.svg'; import {TAGG_LIGHT_BLUE_2} from '../../constants'; import { LocalAttachmentType, @@ -38,39 +43,59 @@ const ChannelPreview: React.FC< const unread = channel.state.unreadCount > 0; return ( - { - setChannel(channel); - navigation.navigate('Chat'); - }}> - - - {online && } - - - - {member?.user?.first_name} {member?.user?.last_name} - - - {channel.state.messages.length > 0 - ? channel.state.messages[channel.state.messages.length - 1].text - : ''} - - - {unread && } - + ( + + { + channel.delete(); + }}> + + Delete + + + )}> + { + setChannel(channel); + navigation.navigate('Chat'); + }}> + + + {online && } + + + + {member?.user?.first_name} {member?.user?.last_name} + + + {channel.state.messages.length > 0 + ? channel.state.messages[channel.state.messages.length - 1].text + : ''} + + + {unread && } + + ); }; @@ -128,6 +153,25 @@ const styles = StyleSheet.create({ borderRadius: normalize(10) / 2, marginLeft: '5%', }, + swipeableContainer: { + alignItems: 'center', + justifyContent: 'center', + backgroundColor: '#C42634', + }, + rightSwipeableButton: { + width: 72, + height: 62, + justifyContent: 'center', + alignItems: 'center', + }, + actionText: { + color: 'white', + fontSize: normalize(12), + fontWeight: '500', + backgroundColor: 'transparent', + paddingHorizontal: '5%', + marginTop: '5%', + }, }); export default ChannelPreview; -- cgit v1.2.3-70-g09d2 From 3a6024fc8282f81845df3643c1a3c7ec38746c71 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 22 Apr 2021 18:57:17 -0400 Subject: added mute/unmute --- src/assets/images/mute.png | Bin 0 -> 1560 bytes src/assets/images/unmute.png | Bin 0 -> 1279 bytes src/components/messages/ChannelPreview.tsx | 41 ++++++++++++++++++++++------- 3 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 src/assets/images/mute.png create mode 100644 src/assets/images/unmute.png (limited to 'src/components') diff --git a/src/assets/images/mute.png b/src/assets/images/mute.png new file mode 100644 index 00000000..b330e259 Binary files /dev/null and b/src/assets/images/mute.png differ diff --git a/src/assets/images/unmute.png b/src/assets/images/unmute.png new file mode 100644 index 00000000..7fe1782d Binary files /dev/null and b/src/assets/images/unmute.png differ diff --git a/src/components/messages/ChannelPreview.tsx b/src/components/messages/ChannelPreview.tsx index 6b166b55..f2662b6a 100644 --- a/src/components/messages/ChannelPreview.tsx +++ b/src/components/messages/ChannelPreview.tsx @@ -41,6 +41,10 @@ const ChannelPreview: React.FC< const member = getMember(channel, state); const online = isOnline(member?.user?.last_active); const unread = channel.state.unreadCount > 0; + const isMuted = channel.muteStatus().muted; + const mutedImage = isMuted + ? require('../../assets/images/unmute.png') + : require('../../assets/images/mute.png'); return ( ( { - channel.delete(); + channel.mute(); + console.log(channel.muteStatus()); }}> - + + {isMuted ? 'Unmute' : 'Mute'} + + { + channel.hide(); + }}> + Delete @@ -156,13 +165,21 @@ const styles = StyleSheet.create({ swipeableContainer: { alignItems: 'center', justifyContent: 'center', - backgroundColor: '#C42634', + flexDirection: 'row', }, - rightSwipeableButton: { + muteButton: { width: 72, - height: 62, + height: '100%', justifyContent: 'center', alignItems: 'center', + backgroundColor: '#C4C4C4', + }, + deleteButton: { + width: 72, + height: '100%', + justifyContent: 'center', + alignItems: 'center', + backgroundColor: '#C42634', }, actionText: { color: 'white', @@ -172,6 +189,10 @@ const styles = StyleSheet.create({ paddingHorizontal: '5%', marginTop: '5%', }, + icon: { + width: normalize(25), + height: normalize(25), + }, }); export default ChannelPreview; -- cgit v1.2.3-70-g09d2 From 80237632843c123253b572f571bb6c336a4fad4e Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 22 Apr 2021 19:01:16 -0400 Subject: fixed mute toggle --- src/components/messages/ChannelPreview.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/components') diff --git a/src/components/messages/ChannelPreview.tsx b/src/components/messages/ChannelPreview.tsx index f2662b6a..4a0cee0b 100644 --- a/src/components/messages/ChannelPreview.tsx +++ b/src/components/messages/ChannelPreview.tsx @@ -55,8 +55,11 @@ const ChannelPreview: React.FC< { - channel.mute(); - console.log(channel.muteStatus()); + if (isMuted) { + channel.unmute(); + } else { + channel.mute(); + } }}> {isMuted ? 'Unmute' : 'Mute'} -- cgit v1.2.3-70-g09d2 From 9fccb2c81f4ccd4bf2891929c8e91d167827548c Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 22 Apr 2021 19:29:47 -0400 Subject: changed method --- src/components/messages/ChannelPreview.tsx | 5 +++++ src/screens/chat/ChatScreen.tsx | 9 --------- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src/components') diff --git a/src/components/messages/ChannelPreview.tsx b/src/components/messages/ChannelPreview.tsx index 8bd3a745..4c3eb9d8 100644 --- a/src/components/messages/ChannelPreview.tsx +++ b/src/components/messages/ChannelPreview.tsx @@ -37,6 +37,11 @@ const ChannelPreview: React.FC< const online = isOnline(member?.user?.last_active); const unread = channel.state.unreadCount > 0; + // Hide channel if no message was exchanged + if (channel.state.messages.length === 0) { + return null; + } + return ( = () => { }, }; - // Hide channel if no message was exchanged - useEffect(() => { - return () => { - if (channel?.state.messages.length === 0) { - channel.hide(); - } - }; - }, []); - useEffect(() => { setTopInset(insets.top + HeaderHeight); }); -- cgit v1.2.3-70-g09d2 From dd0ccf25aaec5d0ef4a9e8a38e97cd8b03bad0a1 Mon Sep 17 00:00:00 2001 From: ankit-thanekar007 Date: Thu, 22 Apr 2021 16:44:48 -0700 Subject: Private Hotifix --- src/components/common/BadgeDetailView.tsx | 2 +- src/components/profile/Content.tsx | 8 +++++++- src/components/profile/ProfileHeader.tsx | 9 ++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'src/components') diff --git a/src/components/common/BadgeDetailView.tsx b/src/components/common/BadgeDetailView.tsx index 32cc7aa4..437b1914 100644 --- a/src/components/common/BadgeDetailView.tsx +++ b/src/components/common/BadgeDetailView.tsx @@ -78,7 +78,7 @@ const BadgeDetailView: React.FC = ({ setTimeout(() => { setSelectedBadgesWithImage(badgesWithImage); setIsLoading(false); - }, 500); + }, 250); }, [selectedBadges]); const removeBadgeCell = async (badge: string) => { diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx index c70d6df5..8298dc9a 100644 --- a/src/components/profile/Content.tsx +++ b/src/components/profile/Content.tsx @@ -145,7 +145,13 @@ const Content: React.FC = ({userXId, screenType}) => { void; + isPrivate?: boolean; }; const ProfileHeader: React.FC = ({ @@ -24,6 +25,7 @@ const ProfileHeader: React.FC = ({ screenType, isBlocked, handleBlockUnblock, + isPrivate, }) => { const { profile: {name = '', university_class = 2021, university}, @@ -67,7 +69,12 @@ const ProfileHeader: React.FC = ({ )} - setBadgeViewVisible(true)}> + { + if (!isPrivate) { + setBadgeViewVisible(true); + } + }}> -- cgit v1.2.3-70-g09d2 From 1c225f0dd7caaffa9501f9a86a1e1f9937b36f56 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 23 Apr 2021 16:09:58 -0400 Subject: fixed slowness --- src/components/messages/ChannelPreview.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/components') diff --git a/src/components/messages/ChannelPreview.tsx b/src/components/messages/ChannelPreview.tsx index 4a0cee0b..87b94179 100644 --- a/src/components/messages/ChannelPreview.tsx +++ b/src/components/messages/ChannelPreview.tsx @@ -1,5 +1,5 @@ import {useNavigation} from '@react-navigation/core'; -import React, {useContext} from 'react'; +import React, {useContext, useState} from 'react'; import {Image, StyleSheet, Text, View} from 'react-native'; import { RectButton, @@ -41,7 +41,7 @@ const ChannelPreview: React.FC< const member = getMember(channel, state); const online = isOnline(member?.user?.last_active); const unread = channel.state.unreadCount > 0; - const isMuted = channel.muteStatus().muted; + const [isMuted, setIsMuted] = useState(channel.muteStatus().muted); const mutedImage = isMuted ? require('../../assets/images/unmute.png') : require('../../assets/images/mute.png'); @@ -60,6 +60,7 @@ const ChannelPreview: React.FC< } else { channel.mute(); } + setIsMuted(!isMuted); }}> {isMuted ? 'Unmute' : 'Mute'} -- cgit v1.2.3-70-g09d2 From 56f6c706ab8b85af2a09130dfc14ece872f3eaca Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 23 Apr 2021 18:00:24 -0400 Subject: changed to useSelector --- src/components/taggs/Tagg.tsx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/components') diff --git a/src/components/taggs/Tagg.tsx b/src/components/taggs/Tagg.tsx index 94011e86..4a58bacb 100644 --- a/src/components/taggs/Tagg.tsx +++ b/src/components/taggs/Tagg.tsx @@ -1,31 +1,31 @@ import {useNavigation} from '@react-navigation/native'; import React, {Fragment, useState} from 'react'; import {Alert, Linking, StyleSheet, TouchableOpacity, View} from 'react-native'; +import {useSelector} from 'react-redux'; import PurpleRingPlus from '../../assets/icons/purple_ring+.svg'; import PurpleRing from '../../assets/icons/purple_ring.svg'; import RingPlus from '../../assets/icons/ring+.svg'; -import Ring from '../../assets/icons/ring.svg'; import WhiteRing from '../../assets/icons/ring-white.svg'; +import Ring from '../../assets/icons/ring.svg'; import { INTEGRATED_SOCIAL_LIST, SOCIAL_ICON_SIZE_ADJUSTMENT, TAGG_RING_DIM, } from '../../constants'; +import { + ERROR_LINK, + ERROR_UNABLE_TO_FIND_PROFILE, + SUCCESS_LINK, +} from '../../constants/strings'; import { getNonIntegratedURL, handlePressForAuthBrowser, registerNonIntegratedSocialLink, } from '../../services'; -import {SmallSocialIcon, SocialIcon, SocialLinkModal} from '../common'; +import {RootState} from '../../store/rootReducer'; import {ScreenType, UserType} from '../../types'; -import { - ERROR_LINK, - ERROR_UNABLE_TO_FIND_PROFILE, - SUCCESS_LINK, -} from '../../constants/strings'; import {canViewProfile, normalize} from '../../utils'; -import {RootState} from '../../store/rootReducer'; -import {useStore} from 'react-redux'; +import {SmallSocialIcon, SocialIcon, SocialLinkModal} from '../common'; interface TaggProps { social: string; @@ -51,7 +51,7 @@ const Tagg: React.FC = ({ whiteRing, }) => { const navigation = useNavigation(); - const state: RootState = useStore().getState(); + const state = useSelector((s: RootState) => s); const [modalVisible, setModalVisible] = useState(false); const youMayPass = isLinked || userXId; -- cgit v1.2.3-70-g09d2