2020-07-31 17:06:22 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { View } from 'react-native';
|
|
|
|
|
|
|
|
import styles from './styles';
|
|
|
|
import Wrapper from './Wrapper';
|
2020-07-31 18:22:30 +00:00
|
|
|
import UnreadBadge from '../UnreadBadge';
|
2020-07-31 17:06:22 +00:00
|
|
|
import TypeIcon from './TypeIcon';
|
|
|
|
import LastMessage from './LastMessage';
|
|
|
|
import Title from './Title';
|
|
|
|
import UpdatedAt from './UpdatedAt';
|
|
|
|
import Touchable from './Touchable';
|
[NEW] Add/Create/Remove channel on a team (#3090)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
import Tag from './Tag';
|
|
|
|
import I18n from '../../i18n';
|
2020-07-31 17:06:22 +00:00
|
|
|
|
|
|
|
const RoomItem = ({
|
|
|
|
rid,
|
|
|
|
type,
|
|
|
|
prid,
|
|
|
|
name,
|
|
|
|
avatar,
|
|
|
|
width,
|
|
|
|
avatarSize,
|
|
|
|
username,
|
|
|
|
showLastMessage,
|
|
|
|
status,
|
|
|
|
useRealName,
|
|
|
|
theme,
|
|
|
|
isFocused,
|
|
|
|
isGroupChat,
|
|
|
|
isRead,
|
|
|
|
date,
|
|
|
|
accessibilityLabel,
|
|
|
|
favorite,
|
|
|
|
lastMessage,
|
|
|
|
alert,
|
|
|
|
hideUnreadStatus,
|
|
|
|
unread,
|
|
|
|
userMentions,
|
|
|
|
groupMentions,
|
2020-10-30 17:35:07 +00:00
|
|
|
tunread,
|
|
|
|
tunreadUser,
|
|
|
|
tunreadGroup,
|
2020-07-31 17:06:22 +00:00
|
|
|
testID,
|
2020-07-31 18:22:30 +00:00
|
|
|
swipeEnabled,
|
2020-07-31 17:06:22 +00:00
|
|
|
onPress,
|
[NEW] Add/Create/Remove channel on a team (#3090)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
onLongPress,
|
2020-07-31 17:06:22 +00:00
|
|
|
toggleFav,
|
|
|
|
toggleRead,
|
2021-04-07 18:31:25 +00:00
|
|
|
hideChannel,
|
[NEW] Add/Create/Remove channel on a team (#3090)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
teamMain,
|
|
|
|
autoJoin
|
2020-07-31 17:06:22 +00:00
|
|
|
}) => (
|
|
|
|
<Touchable
|
|
|
|
onPress={onPress}
|
[NEW] Add/Create/Remove channel on a team (#3090)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
onLongPress={onLongPress}
|
2020-07-31 17:06:22 +00:00
|
|
|
width={width}
|
|
|
|
favorite={favorite}
|
|
|
|
toggleFav={toggleFav}
|
|
|
|
isRead={isRead}
|
|
|
|
rid={rid}
|
|
|
|
toggleRead={toggleRead}
|
|
|
|
hideChannel={hideChannel}
|
|
|
|
testID={testID}
|
|
|
|
type={type}
|
|
|
|
theme={theme}
|
|
|
|
isFocused={isFocused}
|
2020-07-31 18:22:30 +00:00
|
|
|
swipeEnabled={swipeEnabled}
|
2020-07-31 17:06:22 +00:00
|
|
|
>
|
|
|
|
<Wrapper
|
|
|
|
accessibilityLabel={accessibilityLabel}
|
|
|
|
avatar={avatar}
|
|
|
|
avatarSize={avatarSize}
|
|
|
|
type={type}
|
|
|
|
theme={theme}
|
2020-10-30 13:51:04 +00:00
|
|
|
rid={rid}
|
2020-07-31 17:06:22 +00:00
|
|
|
>
|
|
|
|
{showLastMessage
|
|
|
|
? (
|
|
|
|
<>
|
|
|
|
<View style={styles.titleContainer}>
|
|
|
|
<TypeIcon
|
|
|
|
type={type}
|
|
|
|
prid={prid}
|
|
|
|
status={status}
|
|
|
|
isGroupChat={isGroupChat}
|
2021-04-07 18:31:25 +00:00
|
|
|
theme={theme}
|
|
|
|
teamMain={teamMain}
|
2020-07-31 17:06:22 +00:00
|
|
|
/>
|
|
|
|
<Title
|
|
|
|
name={name}
|
|
|
|
theme={theme}
|
|
|
|
hideUnreadStatus={hideUnreadStatus}
|
|
|
|
alert={alert}
|
|
|
|
/>
|
[NEW] Add/Create/Remove channel on a team (#3090)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
{
|
|
|
|
autoJoin ? <Tag name={I18n.t('Auto-join')} /> : null
|
|
|
|
}
|
2020-07-31 17:06:22 +00:00
|
|
|
<UpdatedAt
|
|
|
|
date={date}
|
|
|
|
theme={theme}
|
|
|
|
hideUnreadStatus={hideUnreadStatus}
|
|
|
|
alert={alert}
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
<View style={styles.row}>
|
|
|
|
<LastMessage
|
|
|
|
lastMessage={lastMessage}
|
|
|
|
type={type}
|
|
|
|
showLastMessage={showLastMessage}
|
|
|
|
username={username}
|
|
|
|
alert={alert && !hideUnreadStatus}
|
|
|
|
useRealName={useRealName}
|
|
|
|
theme={theme}
|
|
|
|
/>
|
|
|
|
<UnreadBadge
|
|
|
|
unread={unread}
|
|
|
|
userMentions={userMentions}
|
|
|
|
groupMentions={groupMentions}
|
2020-10-30 17:35:07 +00:00
|
|
|
tunread={tunread}
|
|
|
|
tunreadUser={tunreadUser}
|
|
|
|
tunreadGroup={tunreadGroup}
|
2020-07-31 17:06:22 +00:00
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
: (
|
|
|
|
<View style={[styles.titleContainer, styles.flex]}>
|
|
|
|
<TypeIcon
|
|
|
|
type={type}
|
|
|
|
prid={prid}
|
|
|
|
status={status}
|
|
|
|
isGroupChat={isGroupChat}
|
2021-04-07 18:31:25 +00:00
|
|
|
theme={theme}
|
|
|
|
teamMain={teamMain}
|
2020-07-31 17:06:22 +00:00
|
|
|
/>
|
|
|
|
<Title
|
|
|
|
name={name}
|
|
|
|
theme={theme}
|
|
|
|
hideUnreadStatus={hideUnreadStatus}
|
|
|
|
alert={alert}
|
|
|
|
/>
|
[NEW] Add/Create/Remove channel on a team (#3090)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
{
|
|
|
|
autoJoin ? <Tag name={I18n.t('Auto-join')} /> : null
|
|
|
|
}
|
2020-07-31 17:06:22 +00:00
|
|
|
<UnreadBadge
|
|
|
|
unread={unread}
|
|
|
|
userMentions={userMentions}
|
|
|
|
groupMentions={groupMentions}
|
2020-10-30 17:35:07 +00:00
|
|
|
tunread={tunread}
|
|
|
|
tunreadUser={tunreadUser}
|
|
|
|
tunreadGroup={tunreadGroup}
|
2020-07-31 17:06:22 +00:00
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
</Wrapper>
|
|
|
|
</Touchable>
|
|
|
|
);
|
|
|
|
|
|
|
|
RoomItem.propTypes = {
|
|
|
|
rid: PropTypes.string.isRequired,
|
|
|
|
type: PropTypes.string.isRequired,
|
|
|
|
prid: PropTypes.string,
|
|
|
|
name: PropTypes.string.isRequired,
|
|
|
|
avatar: PropTypes.string.isRequired,
|
|
|
|
showLastMessage: PropTypes.bool,
|
|
|
|
username: PropTypes.string,
|
|
|
|
avatarSize: PropTypes.number,
|
|
|
|
testID: PropTypes.string,
|
|
|
|
width: PropTypes.number,
|
|
|
|
status: PropTypes.string,
|
|
|
|
useRealName: PropTypes.bool,
|
|
|
|
theme: PropTypes.string,
|
|
|
|
isFocused: PropTypes.bool,
|
|
|
|
isGroupChat: PropTypes.bool,
|
|
|
|
isRead: PropTypes.bool,
|
2021-04-07 18:31:25 +00:00
|
|
|
teamMain: PropTypes.bool,
|
2020-07-31 17:06:22 +00:00
|
|
|
date: PropTypes.string,
|
|
|
|
accessibilityLabel: PropTypes.string,
|
|
|
|
lastMessage: PropTypes.object,
|
|
|
|
favorite: PropTypes.bool,
|
|
|
|
alert: PropTypes.bool,
|
|
|
|
hideUnreadStatus: PropTypes.bool,
|
|
|
|
unread: PropTypes.number,
|
|
|
|
userMentions: PropTypes.number,
|
|
|
|
groupMentions: PropTypes.number,
|
2020-10-30 17:35:07 +00:00
|
|
|
tunread: PropTypes.array,
|
|
|
|
tunreadUser: PropTypes.array,
|
|
|
|
tunreadGroup: PropTypes.array,
|
2020-07-31 18:22:30 +00:00
|
|
|
swipeEnabled: PropTypes.bool,
|
2020-07-31 17:06:22 +00:00
|
|
|
toggleFav: PropTypes.func,
|
|
|
|
toggleRead: PropTypes.func,
|
|
|
|
onPress: PropTypes.func,
|
[NEW] Add/Create/Remove channel on a team (#3090)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
onLongPress: PropTypes.func,
|
|
|
|
hideChannel: PropTypes.func,
|
|
|
|
autoJoin: PropTypes.bool
|
2020-07-31 17:06:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
RoomItem.defaultProps = {
|
|
|
|
avatarSize: 48,
|
2020-07-31 18:22:30 +00:00
|
|
|
status: 'offline',
|
|
|
|
swipeEnabled: true
|
2020-07-31 17:06:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default RoomItem;
|