Header props

pull/1102/head
Vincent 5 years ago
parent a5905536fa
commit 5d11ef1457

@ -61,42 +61,34 @@
window.getConversationByKey = key => { window.getConversationByKey = key => {
// Key is pubkey or public chat name // Key is pubkey or public chat name
const conversation = conversations.models.filter(conv => conv.id === key)[0] || null; const conversation =
conversations.models.filter(conv => conv.id === key)[0] || null;
return conversation; return conversation;
} };
window.getMessagesByKey = async (key, loadLive = false) => { window.getMessagesByKey = async key => {
// loadLive gets messages live, not from the database which can lag behind. // loadLive gets messages live, not from the database which can lag behind.
let messages = []; let messages = [];
let messageSet; const messageSet = await window.Signal.Data.getMessagesByConversation(key, {
limit: 100,
// if (loadLive){ MessageCollection: Whisper.MessageCollection,
messageSet = await window.Signal.Data.getMessagesByConversation( });
key,
{ limit: 100, MessageCollection: Whisper.MessageCollection }
);
// } else {
// const conversation = window.getConversationByKey(key);
// // Grab messages and push to conv object.
// await conversation.fetchMessages();
// messageSet = conversation.messageCollection;
// }
messages = messageSet.models.map(conv => conv.attributes); messages = messageSet.models.map(conv => conv.attributes);
return messages; return messages;
} };
window.getLastMessageByKey = async key => { window.getLastMessageByKey = async key => {
const messageSet = await window.Signal.Data.getMessagesByConversation( const messageSet = await window.Signal.Data.getMessagesByConversation(key, {
key, limit: 1,
{ limit: 1, MessageCollection: Whisper.MessageCollection } MessageCollection: Whisper.MessageCollection,
); });
const message = messageSet.models.map(conv => conv.attributes)[0]; const message = messageSet.models.map(conv => conv.attributes)[0];
return message; return message;
} };
window.ConversationController = { window.ConversationController = {
get(id) { get(id) {

@ -131,7 +131,6 @@
this.messageCollection.on('change:errors', this.handleMessageError, this); this.messageCollection.on('change:errors', this.handleMessageError, this);
this.messageCollection.on('send-error', this.onMessageError, this); this.messageCollection.on('send-error', this.onMessageError, this);
this.throttledBumpTyping = _.throttle(this.bumpTyping, 300); this.throttledBumpTyping = _.throttle(this.bumpTyping, 300);
const debouncedUpdateLastMessage = _.debounce( const debouncedUpdateLastMessage = _.debounce(
this.updateLastMessage.bind(this), this.updateLastMessage.bind(this),
@ -2274,6 +2273,9 @@
}, },
async markRead(newestUnreadDate, providedOptions) { async markRead(newestUnreadDate, providedOptions) {
console.log(`[vince][unread] Marking messages as read!!`);
const options = providedOptions || {}; const options = providedOptions || {};
_.defaults(options, { sendReadReceipts: true }); _.defaults(options, { sendReadReceipts: true });
@ -2285,6 +2287,9 @@
); );
let unreadMessages = await this.getUnread(); let unreadMessages = await this.getUnread();
console.log(`[vince][unread] Unread: `, unreadMessages);
const oldUnread = unreadMessages.filter( const oldUnread = unreadMessages.filter(
message => message.get('received_at') <= newestUnreadDate message => message.get('received_at') <= newestUnreadDate
); );
@ -2310,6 +2315,8 @@
}) })
); );
console.log(`[vince][unread] Read:`, read);
// Some messages we're marking read are local notifications with no sender // Some messages we're marking read are local notifications with no sender
read = _.filter(read, m => Boolean(m.sender)); read = _.filter(read, m => Boolean(m.sender));
unreadMessages = unreadMessages.filter(m => Boolean(m.isIncoming())); unreadMessages = unreadMessages.filter(m => Boolean(m.isIncoming()));

@ -2,4 +2,7 @@ export function searchMessages(query: string): Promise<Array<any>>;
export function searchConversations(query: string): Promise<Array<any>>; export function searchConversations(query: string): Promise<Array<any>>;
export function getPrimaryDeviceFor(pubKey: string): Promise<string | null>; export function getPrimaryDeviceFor(pubKey: string): Promise<string | null>;
export function getMessagesByConversation(conversationId: string, destructurer: any): Promise<Array<any>>; export function getMessagesByConversation(
conversationId: string,
destructurer: any
): Promise<Array<any>>;

@ -146,7 +146,9 @@ const {
// State // State
const { createLeftPane } = require('../../ts/state/roots/createLeftPane'); const { createLeftPane } = require('../../ts/state/roots/createLeftPane');
const { createSessionConversation } = require('../../ts/state/roots/createSessionConversation'); const {
createSessionConversation,
} = require('../../ts/state/roots/createSessionConversation');
const { createStore } = require('../../ts/state/createStore'); const { createStore } = require('../../ts/state/createStore');
const conversationsDuck = require('../../ts/state/ducks/conversations'); const conversationsDuck = require('../../ts/state/ducks/conversations');
const userDuck = require('../../ts/state/ducks/user'); const userDuck = require('../../ts/state/ducks/user');

@ -63,7 +63,9 @@
// Add sessionConversation to the DOM // Add sessionConversation to the DOM
$('#main-view .conversation-stack').html(''); $('#main-view .conversation-stack').html('');
$('#main-view .conversation-stack').append(this.sessionConversationView.el); $('#main-view .conversation-stack').append(
this.sessionConversationView.el
);
}, },
}); });
@ -152,14 +154,17 @@
const filledConversations = conversations.map(async conv => { const filledConversations = conversations.map(async conv => {
const messages = await window.getMessagesByKey(conv.id); const messages = await window.getMessagesByKey(conv.id);
return { ...conv, messages}; return { ...conv, messages };
}); });
const fullFilledConversations = await Promise.all(filledConversations); const fullFilledConversations = await Promise.all(filledConversations);
const initialState = { const initialState = {
conversations: { conversations: {
conversationLookup: Signal.Util.makeLookup(fullFilledConversations, 'id'), conversationLookup: Signal.Util.makeLookup(
fullFilledConversations,
'id'
),
}, },
user: { user: {
regionCode: window.storage.get('regionCode'), regionCode: window.storage.get('regionCode'),

@ -61,7 +61,7 @@ window.isBeforeVersion = (toCheck, baseVersion) => {
}; };
window.CONSTANTS = { window.CONSTANTS = {
SECS_IN_DAY: 60*60*24, SECS_IN_DAY: 60 * 60 * 24,
MAX_LOGIN_TRIES: 3, MAX_LOGIN_TRIES: 3,
MAX_PASSWORD_LENGTH: 32, MAX_PASSWORD_LENGTH: 32,
MAX_USERNAME_LENGTH: 20, MAX_USERNAME_LENGTH: 20,
@ -74,9 +74,10 @@ window.CONSTANTS = {
DEFAULT_MEDIA_FETCH_COUNT: 50, DEFAULT_MEDIA_FETCH_COUNT: 50,
DEFAULT_DOCUMENTS_FETCH_COUNT: 150, DEFAULT_DOCUMENTS_FETCH_COUNT: 150,
DEFAULT_MESSAGE_FETCH_COUNT: 30, DEFAULT_MESSAGE_FETCH_COUNT: 30,
MAX_MESSAGE_FETCH_COUNT: 500,
// Pixels (scroll) from the top of the top of message container // Pixels (scroll) from the top of the top of message container
// at which more messages should be loaded // at which more messages should be loaded
MESSAGE_CONTAINER_BUFFER_OFFSET_PX: 300, MESSAGE_CONTAINER_BUFFER_OFFSET_PX: 30,
MESSAGE_FETCH_INTERVAL: 1, MESSAGE_FETCH_INTERVAL: 1,
}; };

@ -92,22 +92,19 @@ $composition-container-height: 60px;
} }
} }
.session-emoji-panel { .session-emoji-panel {
position: absolute; position: absolute;
bottom: 68px; bottom: 68px;
right: 0px; right: 0px;
min-height: 400px; min-height: 400px;
min-width: 400px; min-width: 400px;
background-color: $session-shade-4; background-color: $session-shade-4;
border: 1px solid $session-shade-6; border: 1px solid $session-shade-6;
border-top-right-radius: 3px; border-top-right-radius: 3px;
border-top-left-radius: 3px; border-top-left-radius: 3px;
padding: $session-margin-lg; padding: $session-margin-lg;
} }
.session-progress { .session-progress {
position: relative; position: relative;
background-color: rgba(30, 30, 30, 0.5); background-color: rgba(30, 30, 30, 0.5);
@ -120,6 +117,5 @@ $composition-container-height: 60px;
height: 3px; height: 3px;
background-color: $session-color-green; background-color: $session-color-green;
} }
} }

@ -80,7 +80,6 @@ export class LeftPane extends React.Component<Props, State> {
} }
public render(): JSX.Element { public render(): JSX.Element {
return ( return (
<div className="module-left-pane-session"> <div className="module-left-pane-session">
<ActionsPanel <ActionsPanel

@ -677,8 +677,8 @@ export class Message extends React.PureComponent<Props, State> {
const shouldRenderAvatar = const shouldRenderAvatar =
(firstMessageOfSeries || (firstMessageOfSeries ||
! collapseMetadata || !collapseMetadata ||
conversationType === 'group') && conversationType === 'group') &&
direction === 'incoming'; direction === 'incoming';
return ( return (

@ -70,7 +70,7 @@ export class TimerNotification extends React.Component<Props> {
return ( return (
<div className="module-timer-notification"> <div className="module-timer-notification">
<div className="module-timer-notification__icon-container"> <div className="module-timer-notification__icon-container">
{ !disabled && ( {!disabled && (
<SessionIcon <SessionIcon
iconType={SessionIconType.Stopwatch} iconType={SessionIconType.Stopwatch}
iconSize={SessionIconSize.Large} iconSize={SessionIconSize.Large}

@ -58,12 +58,14 @@ export class Timestamp extends React.Component<Props> {
// Use relative time for under 24hrs ago. // Use relative time for under 24hrs ago.
const now = Math.floor(Date.now()); const now = Math.floor(Date.now());
const messageAgeInDays = (now - timestamp) / (1000 * window.CONSTANTS.SECS_IN_DAY); const messageAgeInDays =
(now - timestamp) / (1000 * window.CONSTANTS.SECS_IN_DAY);
const daysBeforeRelativeTiming = 1; const daysBeforeRelativeTiming = 1;
const dateString = messageAgeInDays > daysBeforeRelativeTiming const dateString =
? formatRelativeTime(timestamp, { i18n, extended }) messageAgeInDays > daysBeforeRelativeTiming
: moment(timestamp).fromNow(); ? formatRelativeTime(timestamp, { i18n, extended })
: moment(timestamp).fromNow();
return ( return (
<span <span

@ -4,15 +4,14 @@ import TextareaAutosize from 'react-autosize-textarea';
import { SessionIconButton, SessionIconSize, SessionIconType } from './icon'; import { SessionIconButton, SessionIconSize, SessionIconType } from './icon';
import { SessionEmojiPanel } from './SessionEmojiPanel'; import { SessionEmojiPanel } from './SessionEmojiPanel';
interface Props { interface Props {
placeholder?: string; placeholder?: string;
onSendMessage: any; onSendMessage: any;
} }
interface State { interface State {
message: string; message: string;
showEmojiPanel: boolean; showEmojiPanel: boolean;
} }
export class SessionCompositionBox extends React.Component<Props, State> { export class SessionCompositionBox extends React.Component<Props, State> {
@ -22,8 +21,8 @@ export class SessionCompositionBox extends React.Component<Props, State> {
super(props); super(props);
this.state = { this.state = {
message: '', message: '',
showEmojiPanel: false, showEmojiPanel: false,
}; };
this.textarea = React.createRef(); this.textarea = React.createRef();
@ -69,10 +68,7 @@ export class SessionCompositionBox extends React.Component<Props, State> {
/> />
</div> </div>
{ showEmojiPanel && {showEmojiPanel && <SessionEmojiPanel />}
( <SessionEmojiPanel/> )
}
</div> </div>
); );
} }
@ -80,6 +76,6 @@ export class SessionCompositionBox extends React.Component<Props, State> {
public toggleEmojiPanel() { public toggleEmojiPanel() {
this.setState({ this.setState({
showEmojiPanel: !this.state.showEmojiPanel, showEmojiPanel: !this.state.showEmojiPanel,
}) });
} }
} }

@ -40,8 +40,6 @@ export class SessionConversation extends React.Component<any, State> {
const conversation = this.props.conversations.conversationLookup[conversationKey]; const conversation = this.props.conversations.conversationLookup[conversationKey];
const unreadCount = conversation.unreadCount; const unreadCount = conversation.unreadCount;
console.log(`[vince][info] Conversation: `, conversation);
this.state = { this.state = {
sendingProgess: 0, sendingProgess: 0,
prevSendingProgess: 0, prevSendingProgess: 0,
@ -76,6 +74,8 @@ export class SessionConversation extends React.Component<any, State> {
doneInitialScroll: true, doneInitialScroll: true,
}); });
}, 100); }, 100);
console.log(`[vince][info] HeaderProps:`, this.getHeaderProps());
} }
public componentDidUpdate(){ public componentDidUpdate(){
@ -96,11 +96,17 @@ export class SessionConversation extends React.Component<any, State> {
} }
render() { render() {
console.log(`[vince][info] Props`, this.props);
console.log(`[vince][info] Unread: `, this.state.unreadCount);
console.log(`[vince][info] Messages:`, this.state.messages);
// const headerProps = this.props.getHeaderProps; // const headerProps = this.props.getHeaderProps;
const { messages, conversationKey, doneInitialScroll } = this.state; const { messages, conversationKey, doneInitialScroll } = this.state;
const loading = !doneInitialScroll || messages.length === 0; const loading = !doneInitialScroll || messages.length === 0;
const conversation = this.props.conversations.conversationLookup[conversationKey] const conversation = this.props.conversations.conversationLookup[conversationKey];
const isRss = conversation.isRss;
return ( return (
<div className="conversation-item"> <div className="conversation-item">
@ -130,9 +136,12 @@ export class SessionConversation extends React.Component<any, State> {
</div> </div>
<SessionCompositionBox { !isRss && (
<SessionCompositionBox
onSendMessage={() => null} onSendMessage={() => null}
/> />
)}
</div> </div>
); );
} }
@ -302,17 +311,30 @@ export class SessionConversation extends React.Component<any, State> {
); );
} }
public async getMessages(numMessages?: number, fetchInterval = window.CONSTANTS.MESSAGE_FETCH_INTERVAL){ public async getMessages(numMessages?: number, fetchInterval = window.CONSTANTS.MESSAGE_FETCH_INTERVAL, loopback = false){
const { conversationKey, messageFetchTimestamp } = this.state; const { conversationKey, messageFetchTimestamp } = this.state;
const timestamp = this.getTimestamp(); const timestamp = this.getTimestamp();
// If we have pulled messages in the last interval, don't bother rescanning // If we have pulled messages in the last interval, don't bother rescanning
// This avoids getting messages on every re-render. // This avoids getting messages on every re-render.
if (timestamp - messageFetchTimestamp < fetchInterval) { const timeBuffer = timestamp - messageFetchTimestamp;
if (timeBuffer < fetchInterval) {
// Loopback gets messages after time has elapsed,
// rather than completely cancelling the fetch.
// if (loopback) {
// setTimeout(() => {
// this.getMessages(numMessages, fetchInterval, false);
// }, timeBuffer * 1000);
// }
return { newTopMessage: undefined, previousTopMessage: undefined }; return { newTopMessage: undefined, previousTopMessage: undefined };
} }
const msgCount = numMessages || window.CONSTANTS.DEFAULT_MESSAGE_FETCH_COUNT + this.state.unreadCount; let msgCount = numMessages || window.CONSTANTS.DEFAULT_MESSAGE_FETCH_COUNT + this.state.unreadCount;
msgCount = msgCount > window.CONSTANTS.MAX_MESSAGE_FETCH_COUNT
? window.CONSTANTS.MAX_MESSAGE_FETCH_COUNT
: msgCount;
const messageSet = await window.Signal.Data.getMessagesByConversation( const messageSet = await window.Signal.Data.getMessagesByConversation(
conversationKey, conversationKey,
{ limit: msgCount, MessageCollection: window.Whisper.MessageCollection }, { limit: msgCount, MessageCollection: window.Whisper.MessageCollection },
@ -336,7 +358,7 @@ export class SessionConversation extends React.Component<any, State> {
const previousTopMessage = this.state.messages[0]?.id; const previousTopMessage = this.state.messages[0]?.id;
const newTopMessage = messages[0]?.id; const newTopMessage = messages[0]?.id;
this.setState({ messages, messageFetchTimestamp }); await this.setState({ messages, messageFetchTimestamp: timestamp });
return { newTopMessage, previousTopMessage }; return { newTopMessage, previousTopMessage };
} }
@ -367,8 +389,8 @@ export class SessionConversation extends React.Component<any, State> {
const numMessages = this.state.messages.length + window.CONSTANTS.DEFAULT_MESSAGE_FETCH_COUNT; const numMessages = this.state.messages.length + window.CONSTANTS.DEFAULT_MESSAGE_FETCH_COUNT;
// Prevent grabbing messags with scroll more frequently than once per 5s. // Prevent grabbing messags with scroll more frequently than once per 5s.
const messageFetchInterval = 5; const messageFetchInterval = 2;
const previousTopMessage = (await this.getMessages(numMessages, messageFetchInterval))?.previousTopMessage; const previousTopMessage = (await this.getMessages(numMessages, messageFetchInterval, true))?.previousTopMessage;
previousTopMessage && this.scrollToMessage(previousTopMessage); previousTopMessage && this.scrollToMessage(previousTopMessage);
} }
} }
@ -394,5 +416,179 @@ export class SessionConversation extends React.Component<any, State> {
const messageContainer = document.getElementsByClassName('messages-container')[0]; const messageContainer = document.getElementsByClassName('messages-container')[0];
messageContainer.scrollTop = messageContainer.scrollHeight - messageContainer.clientHeight; messageContainer.scrollTop = messageContainer.scrollHeight - messageContainer.clientHeight;
} }
public getHeaderProps() {
const conversationKey = this.props.conversations.selectedConversation;
const conversation = window.getConversationByKey(conversationKey);
console.log(`[vince][info] Key:`, conversationKey);
console.log(`[vince][info] Conversation`, conversation);
console.log(`[vince] Manual: `, );
const expireTimer = conversation.get('expireTimer');
const expirationSettingName = expireTimer
? window.Whisper.ExpirationTimerOptions.getName(expireTimer || 0)
: null;
const members = conversation.get('members') || [];
return {
id: conversation.id,
name: conversation.getName(),
phoneNumber: conversation.getNumber(),
profileName: conversation.getProfileName(),
color: conversation.getColor(),
avatarPath: conversation.getAvatarPath(),
isVerified: conversation.isVerified(),
isFriendRequestPending: conversation.isPendingFriendRequest(),
isFriend: conversation.isFriend(),
isMe: conversation.isMe(),
isClosable: conversation.isClosable(),
isBlocked: conversation.isBlocked(),
isGroup: !conversation.isPrivate(),
isOnline: conversation.isOnline(),
isArchived: conversation.get('isArchived'),
isPublic: conversation.isPublic(),
isRss: conversation.isRss(),
amMod: conversation.isModerator(
window.storage.get('primaryDevicePubKey')
),
members,
subscriberCount: conversation.get('subscriberCount'),
selectedMessages: conversation.selectedMessages,
expirationSettingName,
showBackButton: Boolean(conversation.panels && conversation.panels.length),
timerOptions: window.Whisper.ExpirationTimerOptions.map((item: any) => ({
name: item.getName(),
value: item.get('seconds'),
})),
hasNickname: !!conversation.getNickname(),
onSetDisappearingMessages: (seconds: any) =>
conversation.setDisappearingMessages(seconds),
onDeleteMessages: () => conversation.destroyMessages(),
onDeleteSelectedMessages: () => conversation.deleteSelectedMessages(),
onCloseOverlay: () => conversation.resetMessageSelection(),
onDeleteContact: () => conversation.deleteContact(),
onResetSession: () => conversation.endSession(),
// These are view only and don't update the Conversation model, so they
// need a manual update call.
onShowSafetyNumber: () => {
conversation.showSafetyNumber();
},
onShowAllMedia: async () => {
conversation.updateHeader();
},
onShowGroupMembers: async () => {
await conversation.showMembers();
conversation.updateHeader();
},
onGoBack: () => {
conversation.resetPanel();
conversation.updateHeader();
},
onBlockUser: () => {
conversation.block();
},
onUnblockUser: () => {
conversation.unblock();
},
onChangeNickname: () => {
conversation.changeNickname();
},
onClearNickname: () => {
conversation.setNickname(null);
},
onCopyPublicKey: () => {
conversation.copyPublicKey();
},
onArchive: () => {
conversation.unload('archive');
conversation.setArchived(true);
},
onMoveToInbox: () => {
conversation.setArchived(false);
},
onLeaveGroup: () => {
window.Whisper.events.trigger('leaveGroup', conversation);
},
onInviteFriends: () => {
window.Whisper.events.trigger('inviteFriends', conversation);
},
onAddModerators: () => {
window.Whisper.events.trigger('addModerators', conversation);
},
onRemoveModerators: () => {
window.Whisper.events.trigger('removeModerators', conversation);
},
onAvatarClick: (pubkey: any) => {
if (conversation.isPrivate()) {
window.Whisper.events.trigger('onShowUserDetails', {
userPubKey: pubkey,
});
} else if (!conversation.isRss()) {
conversation.showGroupSettings();
}
},
};
};
public getGroupSettingsProps() {
const {conversationKey} = this.state;
const conversation = window.getConversationByKey[conversationKey];
const ourPK = window.textsecure.storage.user.getNumber();
const members = conversation.get('members') || [];
return {
id: conversation.id,
name: conversation.getName(),
phoneNumber: conversation.getNumber(),
profileName: conversation.getProfileName(),
color: conversation.getColor(),
avatarPath: conversation.getAvatarPath(),
isGroup: !conversation.isPrivate(),
isPublic: conversation.isPublic(),
isAdmin: conversation.get('groupAdmins').includes(ourPK),
isRss: conversation.isRss(),
memberCount: members.length,
timerOptions: window.Whisper.ExpirationTimerOptions.map((item: any) => ({
name: item.getName(),
value: item.get('seconds'),
})),
onSetDisappearingMessages: (seconds: any) =>
conversation.setDisappearingMessages(seconds),
onGoBack: () => {
conversation.hideConversationRight();
},
onUpdateGroupName: () => {
window.Whisper.events.trigger('updateGroupName', conversation);
},
onUpdateGroupMembers: () => {
window.Whisper.events.trigger('updateGroupMembers', conversation);
},
onLeaveGroup: () => {
window.Whisper.events.trigger('leaveGroup', conversation);
},
onInviteFriends: () => {
window.Whisper.events.trigger('inviteFriends', conversation);
},
onShowLightBox: (lightBoxOptions = {}) => {
conversation.showChannelLightbox(lightBoxOptions);
},
};
};
} }

@ -1,15 +1,13 @@
import React from 'react'; import React from 'react';
interface Props {} interface Props {}
interface State { interface State {
// FIXME Use Emoji-Mart categories // FIXME Use Emoji-Mart categories
category: null category: null;
} }
export class SessionEmojiPanel extends React.Component<Props, State> { export class SessionEmojiPanel extends React.Component<Props, State> {
constructor(props: any) { constructor(props: any) {
super(props); super(props);
@ -19,11 +17,6 @@ export class SessionEmojiPanel extends React.Component<Props, State> {
} }
render() { render() {
return <div className="session-emoji-panel">THIS IS EMOJI STUFF</div>;
return (
<div className='session-emoji-panel'>
THIS IS EMOJI STUFF
</div>
);
} }
} }

@ -1,6 +1,5 @@
import React from 'react'; import React from 'react';
interface Props { interface Props {
// Value ranges from 0 to 100 // Value ranges from 0 to 100
value: number; value: number;
@ -58,7 +57,9 @@ export class SessionProgress extends React.PureComponent<Props, State> {
const style = { const style = {
width: `${this.state.value}%`, width: `${this.state.value}%`,
opacity: `${Number(!startFade)}`, opacity: `${Number(!startFade)}`,
transition: `width ${shiftDuration.toFixed(2)}s cubic-bezier(0.25, 0.46, 0.45, 0.94)`, transition: `width ${shiftDuration.toFixed(
2
)}s cubic-bezier(0.25, 0.46, 0.45, 0.94)`,
}; };
if (value >= 100) { if (value >= 100) {
@ -66,14 +67,11 @@ export class SessionProgress extends React.PureComponent<Props, State> {
} }
return ( return (
<div className="session-progress"> <div className="session-progress">
<div <div className="session-progress__progress" style={style}>
className="session-progress__progress" &nbsp
style={style}
>
&nbsp
</div>
</div> </div>
</div>
); );
} }
@ -81,12 +79,11 @@ export class SessionProgress extends React.PureComponent<Props, State> {
const { fadeOnComplete } = this.props; const { fadeOnComplete } = this.props;
// Fade // Fade
if ( fadeOnComplete ) { if (fadeOnComplete) {
this.setState({ this.setState({
startFade: true, startFade: true,
}); });
} }
} }
private getShiftDuration(value: number, prevValue?: number) { private getShiftDuration(value: number, prevValue?: number) {

@ -14,8 +14,8 @@ export class SessionScrollButton extends React.PureComponent<Props> {
public render() { public render() {
return ( return (
<> <>
{ this.props.display && ( {this.props.display && (
<div className="session-scroll-button"> <div className="session-scroll-button">
<SessionIconButton <SessionIconButton
iconType={SessionIconType.Chevron} iconType={SessionIconType.Chevron}
@ -25,7 +25,7 @@ export class SessionScrollButton extends React.PureComponent<Props> {
/> />
</div> </div>
)} )}
</> </>
); );
} }
} }

@ -1,6 +1,4 @@
export const reducer = (state: any, action: any) => { export const reducer = (state: any, action: any) => {
console.log(`[vince][redux] Action: `, action); console.log(`[vince][redux] Action: `, action);
return state; return state;
} };

@ -157,7 +157,6 @@ const getMessageProps = (messages: Array<MessageType>) => {
}); });
}; };
async function doGetMessages( async function doGetMessages(
query: string, query: string,
options: SearchOptions options: SearchOptions
@ -188,10 +187,6 @@ async function doGetMessages(
}; };
} }
async function queryMessages(query: string) { async function queryMessages(query: string) {
try { try {
const normalized = cleanSearchTerm(query); const normalized = cleanSearchTerm(query);

@ -7,10 +7,8 @@ import {
} from './ducks/conversations'; } from './ducks/conversations';
import { reducer as user, UserStateType } from './ducks/user'; import { reducer as user, UserStateType } from './ducks/user';
import { reducer as messages } from './ducks/search'; import { reducer as messages } from './ducks/search';
export type StateType = { export type StateType = {
search: SearchStateType; search: SearchStateType;
messages: any; messages: any;

@ -22,7 +22,8 @@ export const getConversationLookup = createSelector(
} }
); );
export const getSelectedConversation = createSelector(getConversations, export const getSelectedConversation = createSelector(
getConversations,
(state: ConversationsStateType): string | undefined => { (state: ConversationsStateType): string | undefined => {
return state.selectedConversation; return state.selectedConversation;
} }
@ -178,11 +179,10 @@ export const _getSessionConversationInfo = (
for (let i = 0; i < max; i += 1) { for (let i = 0; i < max; i += 1) {
let conv = sorted[i]; let conv = sorted[i];
if (conv.id === selectedConversation){ if (conv.id === selectedConversation) {
conversation = conv; conversation = conv;
break; break;
} }
} }
return { return {
@ -202,7 +202,7 @@ export const getSessionConversationInfo = createSelector(
getConversationLookup, getConversationLookup,
getConversationComparator, getConversationComparator,
getSelectedConversation, getSelectedConversation,
_getSessionConversationInfo, _getSessionConversationInfo
); );
export const getMe = createSelector( export const getMe = createSelector(

@ -11,8 +11,6 @@ import {
getUserNumber, getUserNumber,
} from '../selectors/user'; } from '../selectors/user';
const mapStateToProps = (state: StateType) => { const mapStateToProps = (state: StateType) => {
//const conversationInfo = getSessionConversationInfo(state); //const conversationInfo = getSessionConversationInfo(state);
@ -24,7 +22,7 @@ const mapStateToProps = (state: StateType) => {
return { return {
conversations: state.conversations, conversations: state.conversations,
} };
}; };
const smart = connect(mapStateToProps, mapDispatchToProps); const smart = connect(mapStateToProps, mapDispatchToProps);

Loading…
Cancel
Save