From b5ecbf3e421e9e6f1dbab9f3f851d265ae8470c6 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Mon, 14 Dec 2020 19:22:35 -0500 Subject: [TMA-406&201] User Handle UI for Individual Moments (#129) * initial work * made big progress towards flatlist moment view * UI done, just need to pass in data now * minor fixes to get things actually running correctly * vertical scroll working * initial index working * moment drawer text color to red * moved report to drawer * removed garbage * added ? --- src/components/profile/Avatar.tsx | 5 +- src/components/profile/MomentMoreInfoDrawer.tsx | 61 +++++++++++++++++++++---- 2 files changed, 54 insertions(+), 12 deletions(-) (limited to 'src/components/profile') diff --git a/src/components/profile/Avatar.tsx b/src/components/profile/Avatar.tsx index d3c53043..ba4ec36c 100644 --- a/src/components/profile/Avatar.tsx +++ b/src/components/profile/Avatar.tsx @@ -1,12 +1,13 @@ -import React, {useContext} from 'react'; +import React from 'react'; import {Image, StyleSheet} from 'react-native'; import {useSelector} from 'react-redux'; import {RootState} from '../../store/rootreducer'; import {ScreenType} from '../../types'; const PROFILE_DIM = 100; + interface AvatarProps { - style: object; + style?: object; userXId: string | undefined; screenType: ScreenType; } diff --git a/src/components/profile/MomentMoreInfoDrawer.tsx b/src/components/profile/MomentMoreInfoDrawer.tsx index 18462cbb..91fb3d2b 100644 --- a/src/components/profile/MomentMoreInfoDrawer.tsx +++ b/src/components/profile/MomentMoreInfoDrawer.tsx @@ -1,18 +1,19 @@ import React from 'react'; -import {Alert, TouchableOpacity} from 'react-native'; +import {Alert, StyleSheet, TouchableOpacity, ViewProps} from 'react-native'; import MoreIcon from '../../assets/icons/more_horiz-24px.svg'; -import {deleteMoment} from '../../services'; +import {deleteMoment, sendReport} from '../../services'; import {GenericMoreInfoDrawer} from '../common'; -interface MomentMoreInfoDrawerProps { +interface MomentMoreInfoDrawerProps extends ViewProps { isOpen: boolean; setIsOpen: (visible: boolean) => void; momentId: string; - dismissScreenAndUpdate: Function; + isOwnProfile: boolean; + dismissScreenAndUpdate: () => void; } const MomentMoreInfoDrawer: React.FC = (props) => { - const {momentId, setIsOpen, dismissScreenAndUpdate} = props; + const {momentId, setIsOpen, isOwnProfile, dismissScreenAndUpdate} = props; const handleDeleteMoment = async () => { setIsOpen(false); @@ -38,21 +39,61 @@ const MomentMoreInfoDrawer: React.FC = (props) => { }); }; + const handleReportMoment = async () => { + setIsOpen(false); + setTimeout(() => { + Alert.alert( + 'Report Issue', + undefined, + [ + { + text: 'Mark as inappropriate', + onPress: () => sendReport(momentId, 'Mark as inappropriate'), + }, + { + text: 'Cancel', + style: 'cancel', + }, + { + text: 'Mark as abusive', + onPress: () => sendReport(momentId, 'Mark as abusive'), + }, + ], + {cancelable: false}, + ); + }, 500); + }; + return ( <> { setIsOpen(true); }}> - + {isOwnProfile ? ( + + ) : ( + + )} ); }; +const styles = StyleSheet.create({ + icon: { + marginRight: '3%', + }, +}); + export default MomentMoreInfoDrawer; -- cgit v1.2.3-70-g09d2