-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39757 from Expensify/feature-groupChats2
[Group Chats] Add remaining features
- Loading branch information
Showing
52 changed files
with
1,729 additions
and
355 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,64 @@ | ||
import React, {useState} from 'react'; | ||
import {View} from 'react-native'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import * as Report from '@userActions/Report'; | ||
import type {Report as OnyxReportType} from '@src/types/onyx'; | ||
import Button from './Button'; | ||
import ConfirmModal from './ConfirmModal'; | ||
import * as Expensicons from './Icon/Expensicons'; | ||
|
||
type ChatDetailsQuickActionsBarProps = { | ||
report: OnyxReportType; | ||
}; | ||
|
||
function ChatDetailsQuickActionsBar({report}: ChatDetailsQuickActionsBarProps) { | ||
const styles = useThemeStyles(); | ||
const [isLastMemberLeavingGroupModalVisible, setIsLastMemberLeavingGroupModalVisible] = useState(false); | ||
const {translate} = useLocalize(); | ||
const isPinned = !!report.isPinned; | ||
return ( | ||
<View style={[styles.flexRow, styles.ph5, styles.mb5]}> | ||
<View style={[styles.flex1, styles.pr3]}> | ||
<ConfirmModal | ||
danger | ||
title={translate('groupChat.lastMemberTitle')} | ||
isVisible={isLastMemberLeavingGroupModalVisible} | ||
onConfirm={() => { | ||
setIsLastMemberLeavingGroupModalVisible(false); | ||
Report.leaveGroupChat(report.reportID); | ||
}} | ||
onCancel={() => setIsLastMemberLeavingGroupModalVisible(false)} | ||
prompt={translate('groupChat.lastMemberWarning')} | ||
confirmText={translate('common.leave')} | ||
cancelText={translate('common.cancel')} | ||
/> | ||
<Button | ||
onPress={() => { | ||
if (Object.keys(report?.participants ?? {}).length === 1) { | ||
setIsLastMemberLeavingGroupModalVisible(true); | ||
return; | ||
} | ||
|
||
Report.leaveGroupChat(report.reportID); | ||
}} | ||
icon={Expensicons.Exit} | ||
style={styles.flex1} | ||
text={translate('common.leave')} | ||
/> | ||
</View> | ||
<View style={[styles.flex1]}> | ||
<Button | ||
onPress={() => Report.togglePinnedState(report.reportID, isPinned)} | ||
icon={Expensicons.Pin} | ||
style={styles.flex1} | ||
text={isPinned ? translate('common.unPin') : translate('common.pin')} | ||
/> | ||
</View> | ||
</View> | ||
); | ||
} | ||
|
||
ChatDetailsQuickActionsBar.displayName = 'ChatDetailsQuickActionsBar'; | ||
|
||
export default ChatDetailsQuickActionsBar; |
This file contains 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 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 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 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 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 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.