From 5087e86f7d86897f073ddf743dd186e6fac304c1 Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 17 Mar 2020 18:29:17 +1100 Subject: [PATCH] Group options pane toggle --- stylesheets/_session_conversation.scss | 24 +++- stylesheets/_session_group_panel.scss | 2 +- .../conversation/SessionConversation.tsx | 132 ++++++++++++------ .../SessionGroupSettings.tsx | 14 +- 4 files changed, 119 insertions(+), 53 deletions(-) rename ts/components/session/{ => conversation}/SessionGroupSettings.tsx (96%) diff --git a/stylesheets/_session_conversation.scss b/stylesheets/_session_conversation.scss index ade04fc42..7ba849eb5 100644 --- a/stylesheets/_session_conversation.scss +++ b/stylesheets/_session_conversation.scss @@ -41,7 +41,6 @@ $composition-container-height: 60px; .conversation-item { display: flex; flex-grow: 1; - flex-direction: column; height: 100%; outline: none; @@ -65,6 +64,27 @@ $composition-container-height: 60px; } } } + + &__content { + display: flex; + flex-direction: column; + outline: none; + } + + &__options-pane { + position: absolute; + height: 100%; + right: 0vw; + + transition: transform $session-transition-duration ease-in-out; + transform: translateX(100%); + will-change: transform; + + &.show { + transform: none; + transition: transform $session-transition-duration ease-in-out; + } + } } .conversation-header { @@ -179,7 +199,7 @@ $composition-container-height: 60px; display: flex; flex-grow: 1; min-height: $composition-container-height; - padding: $composition-container-height / 3 0px; + padding: 16px 0px; textarea { font-family: 'SF Pro Text'; diff --git a/stylesheets/_session_group_panel.scss b/stylesheets/_session_group_panel.scss index 1557f13bb..6ec497c16 100644 --- a/stylesheets/_session_group_panel.scss +++ b/stylesheets/_session_group_panel.scss @@ -75,7 +75,7 @@ margin-top: auto; width: 100%; border: none; - height: 3.5rem; + height: 60px; background-color: black; flex-shrink: 0; align-items: center; diff --git a/ts/components/session/conversation/SessionConversation.tsx b/ts/components/session/conversation/SessionConversation.tsx index 1eee4466a..e8cf7fc6d 100644 --- a/ts/components/session/conversation/SessionConversation.tsx +++ b/ts/components/session/conversation/SessionConversation.tsx @@ -11,8 +11,8 @@ import { TimerNotification } from '../../conversation/TimerNotification'; import { getTimestamp } from './SessionConversationManager'; - import { SessionScrollButton } from '../SessionScrollButton'; +import { SessionGroupSettings } from './SessionGroupSettings'; interface State { conversationKey: string; @@ -26,6 +26,7 @@ interface State { displayScrollToBottomButton: boolean; messageFetchTimestamp: number; showRecordingView: boolean; + showOptionsPane: boolean; } export class SessionConversation extends React.Component { @@ -53,6 +54,7 @@ export class SessionConversation extends React.Component { displayScrollToBottomButton: false, messageFetchTimestamp: 0, showRecordingView: false, + showOptionsPane: true, }; this.handleScroll = this.handleScroll.bind(this); @@ -63,6 +65,9 @@ export class SessionConversation extends React.Component { this.renderTimerNotification = this.renderTimerNotification.bind(this); this.renderFriendRequest = this.renderFriendRequest.bind(this); + // Group options panels + this.toggleOptionsPane = this.toggleOptionsPane.bind(this); + // Recording View render and unrender this.onLoadVoiceNoteView = this.onLoadVoiceNoteView.bind(this); this.onExitVoiceNoteView = this.onExitVoiceNoteView.bind(this); @@ -88,7 +93,9 @@ export class SessionConversation extends React.Component { }, 100); }); - console.log(`[unread] Loaded conversation:`, this.props.conversations.conversationLookup[this.state.conversationKey]); + + //FIXME VINCE + // Only now should you renderGroupOptionsPane } public componentDidUpdate(){ @@ -113,7 +120,7 @@ export class SessionConversation extends React.Component { public render() { console.log(`[vince][info] Props`, this.props); - const { messages, conversationKey, doneInitialScroll, showRecordingView } = this.state; + const { messages, conversationKey, doneInitialScroll, showRecordingView, showOptionsPane } = this.state; const loading = !doneInitialScroll || messages.length === 0; const selectionMode = !!this.state.selectedMessages.length; @@ -124,50 +131,83 @@ export class SessionConversation extends React.Component { const sendMessageFn = conversationModel.sendMessage.bind(conversationModel); return ( -
-
- {this.renderHeader()} -
- - + <> +
+
+ {this.renderHeader()} +
-
- { loading && ( -
- )} + -
- {this.renderMessages()} -
+
+ { loading && ( +
+ )} + +
+ {this.renderMessages()} +
+
+ + + { showRecordingView && ( +
+ )}
- - - { showRecordingView && ( -
+ + { !isRss && ( + )} +
- - { !isRss && ( - - )} - -
+ +
+ {/* Don't render this to the DOM unless it needs to be rendered */} + {/* { showOptionsPane && ( */} + ({ + name: item.getName(), + value: item.get('seconds'), + })) + } + isPublic={conversation.isPublic} + isAdmin={conversation.isAdmin} + amMod={conversation.amMod} + onGoBack={this.toggleOptionsPane} + onInviteFriends={() => null} + onLeaveGroup={() => null} + onUpdateGroupName={() => null} + onUpdateGroupMembers={() => null} + onShowLightBox={(options: any) => null} + onSetDisappearingMessages={(seconds: number) => null} + /> + {/* )} */} + +
+ + ); } @@ -251,6 +291,8 @@ export class SessionConversation extends React.Component { onAddModerators={headerProps.onAddModerators} onRemoveModerators={headerProps.onRemoveModerators} onInviteFriends={headerProps.onInviteFriends} + + onAvatarClick={headerProps.onAvatarClick} /> ); } @@ -492,6 +534,10 @@ export class SessionConversation extends React.Component { return null; } + public toggleOptionsPane() { + const { showOptionsPane } = this.state; + this.setState({ showOptionsPane: !showOptionsPane }); + } public async handleScroll() { const messageContainer = this.messageContainerRef.current; @@ -661,7 +707,7 @@ export class SessionConversation extends React.Component { userPubKey: pubkey, }); } else if (!conversation.isRss()) { - conversation.showGroupSettings(); + this.toggleOptionsPane(); } }, }; diff --git a/ts/components/session/SessionGroupSettings.tsx b/ts/components/session/conversation/SessionGroupSettings.tsx similarity index 96% rename from ts/components/session/SessionGroupSettings.tsx rename to ts/components/session/conversation/SessionGroupSettings.tsx index ce9a39e45..d3cb6e70f 100644 --- a/ts/components/session/SessionGroupSettings.tsx +++ b/ts/components/session/conversation/SessionGroupSettings.tsx @@ -1,15 +1,15 @@ import React from 'react'; -import { SessionIconButton, SessionIconSize, SessionIconType } from './icon'; -import { Avatar } from '../Avatar'; +import { SessionIconButton, SessionIconSize, SessionIconType } from '../icon'; +import { Avatar } from '../../Avatar'; import { SessionButton, SessionButtonColor, SessionButtonType, -} from './SessionButton'; -import { SessionDropdown } from './SessionDropdown'; -import { MediaGallery } from '../conversation/media-gallery/MediaGallery'; +} from '../SessionButton'; +import { SessionDropdown } from '../SessionDropdown'; +import { MediaGallery } from '../../conversation/media-gallery/MediaGallery'; import _ from 'lodash'; -import { TimerOption } from '../conversation/ConversationHeader'; +import { TimerOption } from '../../conversation/ConversationHeader'; interface Props { id: string; @@ -312,7 +312,7 @@ export class SessionGroupSettings extends React.Component {