2019-01-14 21:49:58 +00:00
|
|
|
#### With all result types
|
|
|
|
|
|
|
|
```jsx
|
2019-08-09 00:46:49 +00:00
|
|
|
const items = [
|
2019-01-14 21:49:58 +00:00
|
|
|
{
|
2019-08-09 00:46:49 +00:00
|
|
|
type: 'conversations-header',
|
|
|
|
data: undefined,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'conversation',
|
|
|
|
data: {
|
|
|
|
name: 'Everyone 🌆',
|
|
|
|
conversationType: 'group',
|
|
|
|
phoneNumber: '(202) 555-0011',
|
|
|
|
avatarPath: util.landscapeGreenObjectUrl,
|
|
|
|
lastUpdated: Date.now() - 5 * 60 * 1000,
|
|
|
|
lastMessage: {
|
|
|
|
text: 'The rabbit hopped silently in the night.',
|
|
|
|
status: 'sent',
|
|
|
|
},
|
2019-01-14 21:49:58 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2019-08-09 00:46:49 +00:00
|
|
|
type: 'conversation',
|
|
|
|
data: {
|
|
|
|
name: 'Everyone Else 🔥',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0012',
|
|
|
|
avatarPath: util.landscapePurpleObjectUrl,
|
|
|
|
lastUpdated: Date.now() - 5 * 60 * 1000,
|
|
|
|
lastMessage: {
|
|
|
|
text: "What's going on?",
|
|
|
|
status: 'sent',
|
|
|
|
},
|
2019-01-14 21:49:58 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2019-08-09 00:46:49 +00:00
|
|
|
type: 'contacts-header',
|
|
|
|
data: undefined,
|
2019-01-14 21:49:58 +00:00
|
|
|
},
|
|
|
|
{
|
2019-08-09 00:46:49 +00:00
|
|
|
type: 'contact',
|
|
|
|
data: {
|
|
|
|
name: 'The one Everyone',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0013',
|
|
|
|
avatarPath: util.gifObjectUrl,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'contact',
|
|
|
|
data: {
|
|
|
|
name: 'No likey everyone',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0014',
|
|
|
|
color: 'red',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'messages-header',
|
|
|
|
data: undefined,
|
2019-01-14 21:49:58 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2019-08-09 00:46:49 +00:00
|
|
|
const messages = [
|
2019-01-14 21:49:58 +00:00
|
|
|
{
|
|
|
|
from: {
|
|
|
|
isMe: true,
|
|
|
|
avatarPath: util.gifObjectUrl,
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
name: 'Mr. Fire 🔥',
|
|
|
|
phoneNumber: '(202) 555-0015',
|
|
|
|
},
|
|
|
|
id: '1-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: '(202) 555-0015',
|
|
|
|
receivedAt: Date.now() - 5 * 60 * 1000,
|
|
|
|
snippet: '<<left>>Everyone<<right>>! Get in!',
|
2019-08-09 00:46:49 +00:00
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
2019-01-14 21:49:58 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
name: 'Jon ❄️',
|
|
|
|
phoneNumber: '(202) 555-0016',
|
|
|
|
color: 'green',
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
isMe: true,
|
|
|
|
},
|
|
|
|
id: '2-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: '(202) 555-0016',
|
|
|
|
snippet: 'Why is <<left>>everyone<<right>> so frustrated?',
|
|
|
|
receivedAt: Date.now() - 20 * 60 * 1000,
|
2019-08-09 00:46:49 +00:00
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
2019-01-14 21:49:58 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
name: 'Someone',
|
|
|
|
phoneNumber: '(202) 555-0011',
|
|
|
|
color: 'green',
|
|
|
|
avatarPath: util.pngObjectUrl,
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
name: "Y'all 🌆",
|
|
|
|
},
|
|
|
|
id: '3-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: 'EveryoneGroupID',
|
|
|
|
snippet: 'Hello, <<left>>everyone<<right>>! Woohooo!',
|
|
|
|
receivedAt: Date.now() - 24 * 60 * 1000,
|
2019-08-09 00:46:49 +00:00
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
2019-01-14 21:49:58 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
isMe: true,
|
|
|
|
avatarPath: util.gifObjectUrl,
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
name: "Y'all 🌆",
|
|
|
|
},
|
|
|
|
id: '4-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: 'EveryoneGroupID',
|
|
|
|
snippet: 'Well, <<left>>everyone<<right>>, happy new year!',
|
|
|
|
receivedAt: Date.now() - 24 * 60 * 1000,
|
2019-08-09 00:46:49 +00:00
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
2019-01-14 21:49:58 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2019-08-09 00:46:49 +00:00
|
|
|
const messageLookup = util._.fromPairs(
|
|
|
|
util._.map(messages, message => [message.id, message])
|
|
|
|
);
|
|
|
|
messages.forEach(message => {
|
|
|
|
items.push({
|
|
|
|
type: 'message',
|
|
|
|
data: message.id,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
<util.LeftPaneContext
|
|
|
|
theme={util.theme}
|
|
|
|
gutterStyle={{ height: '500px', display: 'flex', flexDirection: 'row' }}
|
|
|
|
>
|
2019-01-14 21:49:58 +00:00
|
|
|
<SearchResults
|
2019-08-09 00:46:49 +00:00
|
|
|
items={items}
|
2019-01-14 21:49:58 +00:00
|
|
|
i18n={util.i18n}
|
2019-08-09 00:46:49 +00:00
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
startNewConversation={(...args) =>
|
|
|
|
console.log('startNewConversation', args)
|
2019-03-12 00:20:16 +00:00
|
|
|
}
|
2019-08-09 00:46:49 +00:00
|
|
|
onStartNewConversation={(...args) =>
|
|
|
|
console.log('onStartNewConversation', args)
|
|
|
|
}
|
|
|
|
renderMessageSearchResult={id => (
|
|
|
|
<MessageSearchResult
|
|
|
|
{...messageLookup[id]}
|
|
|
|
i18n={util.i18n}
|
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
2019-01-14 21:49:58 +00:00
|
|
|
/>
|
|
|
|
</util.LeftPaneContext>;
|
|
|
|
```
|
|
|
|
|
|
|
|
#### With 'start new conversation'
|
|
|
|
|
|
|
|
```jsx
|
2019-08-09 00:46:49 +00:00
|
|
|
const items = [
|
|
|
|
{
|
|
|
|
type: 'start-new-conversation',
|
|
|
|
data: undefined,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'conversations-header',
|
|
|
|
data: undefined,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'conversation',
|
|
|
|
data: {
|
|
|
|
name: 'Everyone 🌆',
|
|
|
|
conversationType: 'group',
|
|
|
|
phoneNumber: '(202) 555-0011',
|
|
|
|
avatarPath: util.landscapeGreenObjectUrl,
|
|
|
|
lastUpdated: Date.now() - 5 * 60 * 1000,
|
|
|
|
lastMessage: {
|
|
|
|
text: 'The rabbit hopped silently in the night.',
|
|
|
|
status: 'sent',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'conversation',
|
|
|
|
data: {
|
|
|
|
name: 'Everyone Else 🔥',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0012',
|
|
|
|
avatarPath: util.landscapePurpleObjectUrl,
|
|
|
|
lastUpdated: Date.now() - 5 * 60 * 1000,
|
|
|
|
lastMessage: {
|
|
|
|
text: "What's going on?",
|
|
|
|
status: 'sent',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'contacts-header',
|
|
|
|
data: undefined,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'contact',
|
|
|
|
data: {
|
|
|
|
name: 'The one Everyone',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0013',
|
|
|
|
avatarPath: util.gifObjectUrl,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'contact',
|
|
|
|
data: {
|
|
|
|
name: 'No likey everyone',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0014',
|
|
|
|
color: 'red',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'messages-header',
|
|
|
|
data: undefined,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const messages = [
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
isMe: true,
|
|
|
|
avatarPath: util.gifObjectUrl,
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
name: 'Mr. Fire 🔥',
|
|
|
|
phoneNumber: '(202) 555-0015',
|
|
|
|
},
|
|
|
|
id: '1-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: '(202) 555-0015',
|
|
|
|
receivedAt: Date.now() - 5 * 60 * 1000,
|
|
|
|
snippet: '<<left>>Everyone<<right>>! Get in!',
|
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
name: 'Jon ❄️',
|
|
|
|
phoneNumber: '(202) 555-0016',
|
|
|
|
color: 'green',
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
isMe: true,
|
|
|
|
},
|
|
|
|
id: '2-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: '(202) 555-0016',
|
|
|
|
snippet: 'Why is <<left>>everyone<<right>> so frustrated?',
|
|
|
|
receivedAt: Date.now() - 20 * 60 * 1000,
|
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
name: 'Someone',
|
|
|
|
phoneNumber: '(202) 555-0011',
|
|
|
|
color: 'green',
|
|
|
|
avatarPath: util.pngObjectUrl,
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
name: "Y'all 🌆",
|
|
|
|
},
|
|
|
|
id: '3-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: 'EveryoneGroupID',
|
|
|
|
snippet: 'Hello, <<left>>everyone<<right>>! Woohooo!',
|
|
|
|
receivedAt: Date.now() - 24 * 60 * 1000,
|
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
isMe: true,
|
|
|
|
avatarPath: util.gifObjectUrl,
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
name: "Y'all 🌆",
|
|
|
|
},
|
|
|
|
id: '4-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: 'EveryoneGroupID',
|
|
|
|
snippet: 'Well, <<left>>everyone<<right>>, happy new year!',
|
|
|
|
receivedAt: Date.now() - 24 * 60 * 1000,
|
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const messageLookup = util._.fromPairs(
|
|
|
|
util._.map(messages, message => [message.id, message])
|
|
|
|
);
|
|
|
|
messages.forEach(message => {
|
|
|
|
items.push({
|
|
|
|
type: 'message',
|
|
|
|
data: message.id,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
<util.LeftPaneContext
|
|
|
|
theme={util.theme}
|
|
|
|
gutterStyle={{ height: '500px', display: 'flex', flexDirection: 'row' }}
|
|
|
|
>
|
2019-01-14 21:49:58 +00:00
|
|
|
<SearchResults
|
2019-08-09 00:46:49 +00:00
|
|
|
items={items}
|
2019-01-14 21:49:58 +00:00
|
|
|
i18n={util.i18n}
|
2019-08-09 00:46:49 +00:00
|
|
|
searchTerm="(202) 555-0015"
|
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
2019-03-12 00:20:16 +00:00
|
|
|
}
|
2019-08-09 00:46:49 +00:00
|
|
|
startNewConversation={(...args) =>
|
|
|
|
console.log('startNewConversation', args)
|
|
|
|
}
|
|
|
|
onStartNewConversation={(...args) =>
|
|
|
|
console.log('onStartNewConversation', args)
|
|
|
|
}
|
|
|
|
renderMessageSearchResult={id => (
|
|
|
|
<MessageSearchResult
|
|
|
|
{...messageLookup[id]}
|
|
|
|
i18n={util.i18n}
|
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
2019-01-14 21:49:58 +00:00
|
|
|
/>
|
2019-08-09 00:46:49 +00:00
|
|
|
</util.LeftPaneContext>;
|
2019-01-14 21:49:58 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### With no conversations
|
|
|
|
|
|
|
|
```jsx
|
2019-08-09 00:46:49 +00:00
|
|
|
const items = [
|
|
|
|
{
|
|
|
|
type: 'contacts-header',
|
|
|
|
data: undefined,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'contact',
|
|
|
|
data: {
|
|
|
|
name: 'The one Everyone',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0013',
|
|
|
|
avatarPath: util.gifObjectUrl,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'contact',
|
|
|
|
data: {
|
|
|
|
name: 'No likey everyone',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0014',
|
|
|
|
color: 'red',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'messages-header',
|
|
|
|
data: undefined,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const messages = [
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
isMe: true,
|
|
|
|
avatarPath: util.gifObjectUrl,
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
name: 'Mr. Fire 🔥',
|
|
|
|
phoneNumber: '(202) 555-0015',
|
|
|
|
},
|
|
|
|
id: '1-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: '(202) 555-0015',
|
|
|
|
receivedAt: Date.now() - 5 * 60 * 1000,
|
|
|
|
snippet: '<<left>>Everyone<<right>>! Get in!',
|
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
name: 'Jon ❄️',
|
|
|
|
phoneNumber: '(202) 555-0016',
|
|
|
|
color: 'green',
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
isMe: true,
|
|
|
|
},
|
|
|
|
id: '2-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: '(202) 555-0016',
|
|
|
|
snippet: 'Why is <<left>>everyone<<right>> so frustrated?',
|
|
|
|
receivedAt: Date.now() - 20 * 60 * 1000,
|
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
name: 'Someone',
|
|
|
|
phoneNumber: '(202) 555-0011',
|
|
|
|
color: 'green',
|
|
|
|
avatarPath: util.pngObjectUrl,
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
name: "Y'all 🌆",
|
|
|
|
},
|
|
|
|
id: '3-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: 'EveryoneGroupID',
|
|
|
|
snippet: 'Hello, <<left>>everyone<<right>>! Woohooo!',
|
|
|
|
receivedAt: Date.now() - 24 * 60 * 1000,
|
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
isMe: true,
|
|
|
|
avatarPath: util.gifObjectUrl,
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
name: "Y'all 🌆",
|
|
|
|
},
|
|
|
|
id: '4-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: 'EveryoneGroupID',
|
|
|
|
snippet: 'Well, <<left>>everyone<<right>>, happy new year!',
|
|
|
|
receivedAt: Date.now() - 24 * 60 * 1000,
|
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const messageLookup = util._.fromPairs(
|
|
|
|
util._.map(messages, message => [message.id, message])
|
|
|
|
);
|
|
|
|
messages.forEach(message => {
|
|
|
|
items.push({
|
|
|
|
type: 'message',
|
|
|
|
data: message.id,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
<util.LeftPaneContext
|
|
|
|
theme={util.theme}
|
|
|
|
gutterStyle={{ height: '500px', display: 'flex', flexDirection: 'row' }}
|
|
|
|
>
|
2019-01-14 21:49:58 +00:00
|
|
|
<SearchResults
|
2019-08-09 00:46:49 +00:00
|
|
|
items={items}
|
2019-01-14 21:49:58 +00:00
|
|
|
i18n={util.i18n}
|
2019-08-09 00:46:49 +00:00
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
startNewConversation={(...args) =>
|
|
|
|
console.log('startNewConversation', args)
|
|
|
|
}
|
|
|
|
onStartNewConversation={(...args) =>
|
|
|
|
console.log('onStartNewConversation', args)
|
2019-03-12 00:20:16 +00:00
|
|
|
}
|
2019-08-09 00:46:49 +00:00
|
|
|
renderMessageSearchResult={id => (
|
|
|
|
<MessageSearchResult
|
|
|
|
{...messageLookup[id]}
|
|
|
|
i18n={util.i18n}
|
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
2019-01-14 21:49:58 +00:00
|
|
|
/>
|
2019-08-09 00:46:49 +00:00
|
|
|
</util.LeftPaneContext>;
|
2019-01-14 21:49:58 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### With no contacts
|
|
|
|
|
|
|
|
```jsx
|
2019-08-09 00:46:49 +00:00
|
|
|
const items = [
|
|
|
|
{
|
|
|
|
type: 'conversations-header',
|
|
|
|
data: undefined,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'conversation',
|
|
|
|
data: {
|
|
|
|
name: 'Everyone 🌆',
|
|
|
|
conversationType: 'group',
|
|
|
|
phoneNumber: '(202) 555-0011',
|
|
|
|
avatarPath: util.landscapeGreenObjectUrl,
|
|
|
|
lastUpdated: Date.now() - 5 * 60 * 1000,
|
|
|
|
lastMessage: {
|
|
|
|
text: 'The rabbit hopped silently in the night.',
|
|
|
|
status: 'sent',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'conversation',
|
|
|
|
data: {
|
|
|
|
name: 'Everyone Else 🔥',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0012',
|
|
|
|
avatarPath: util.landscapePurpleObjectUrl,
|
|
|
|
lastUpdated: Date.now() - 5 * 60 * 1000,
|
|
|
|
lastMessage: {
|
|
|
|
text: "What's going on?",
|
|
|
|
status: 'sent',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'messages-header',
|
|
|
|
data: undefined,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const messages = [
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
isMe: true,
|
|
|
|
avatarPath: util.gifObjectUrl,
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
name: 'Mr. Fire 🔥',
|
|
|
|
phoneNumber: '(202) 555-0015',
|
|
|
|
},
|
|
|
|
id: '1-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: '(202) 555-0015',
|
|
|
|
receivedAt: Date.now() - 5 * 60 * 1000,
|
|
|
|
snippet: '<<left>>Everyone<<right>>! Get in!',
|
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
name: 'Jon ❄️',
|
|
|
|
phoneNumber: '(202) 555-0016',
|
|
|
|
color: 'green',
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
isMe: true,
|
|
|
|
},
|
|
|
|
id: '2-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: '(202) 555-0016',
|
|
|
|
snippet: 'Why is <<left>>everyone<<right>> so frustrated?',
|
|
|
|
receivedAt: Date.now() - 20 * 60 * 1000,
|
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
name: 'Someone',
|
|
|
|
phoneNumber: '(202) 555-0011',
|
|
|
|
color: 'green',
|
|
|
|
avatarPath: util.pngObjectUrl,
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
name: "Y'all 🌆",
|
|
|
|
},
|
|
|
|
id: '3-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: 'EveryoneGroupID',
|
|
|
|
snippet: 'Hello, <<left>>everyone<<right>>! Woohooo!',
|
|
|
|
receivedAt: Date.now() - 24 * 60 * 1000,
|
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: {
|
|
|
|
isMe: true,
|
|
|
|
avatarPath: util.gifObjectUrl,
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
name: "Y'all 🌆",
|
|
|
|
},
|
|
|
|
id: '4-guid-guid-guid-guid-guid',
|
|
|
|
conversationId: 'EveryoneGroupID',
|
|
|
|
snippet: 'Well, <<left>>everyone<<right>>, happy new year!',
|
|
|
|
receivedAt: Date.now() - 24 * 60 * 1000,
|
|
|
|
conversationOpenInternal: () => console.log('onClick'),
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const messageLookup = util._.fromPairs(
|
|
|
|
util._.map(messages, message => [message.id, message])
|
|
|
|
);
|
|
|
|
messages.forEach(message => {
|
|
|
|
items.push({
|
|
|
|
type: 'message',
|
|
|
|
data: message.id,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
<util.LeftPaneContext
|
|
|
|
theme={util.theme}
|
|
|
|
gutterStyle={{ height: '500px', display: 'flex', flexDirection: 'row' }}
|
|
|
|
>
|
2019-01-14 21:49:58 +00:00
|
|
|
<SearchResults
|
2019-08-09 00:46:49 +00:00
|
|
|
items={items}
|
2019-01-14 21:49:58 +00:00
|
|
|
i18n={util.i18n}
|
2019-08-09 00:46:49 +00:00
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
startNewConversation={(...args) =>
|
|
|
|
console.log('startNewConversation', args)
|
|
|
|
}
|
|
|
|
onStartNewConversation={(...args) =>
|
|
|
|
console.log('onStartNewConversation', args)
|
2019-03-12 00:20:16 +00:00
|
|
|
}
|
2019-08-09 00:46:49 +00:00
|
|
|
renderMessageSearchResult={id => (
|
|
|
|
<MessageSearchResult
|
|
|
|
{...messageLookup[id]}
|
|
|
|
i18n={util.i18n}
|
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
2019-01-14 21:49:58 +00:00
|
|
|
/>
|
2019-08-09 00:46:49 +00:00
|
|
|
</util.LeftPaneContext>;
|
2019-01-14 21:49:58 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### With no messages
|
|
|
|
|
|
|
|
```jsx
|
2019-08-09 00:46:49 +00:00
|
|
|
const items = [
|
|
|
|
{
|
|
|
|
type: 'conversations-header',
|
|
|
|
data: undefined,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'conversation',
|
|
|
|
data: {
|
|
|
|
name: 'Everyone 🌆',
|
|
|
|
conversationType: 'group',
|
|
|
|
phoneNumber: '(202) 555-0011',
|
|
|
|
avatarPath: util.landscapeGreenObjectUrl,
|
|
|
|
lastUpdated: Date.now() - 5 * 60 * 1000,
|
|
|
|
lastMessage: {
|
|
|
|
text: 'The rabbit hopped silently in the night.',
|
|
|
|
status: 'sent',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'conversation',
|
|
|
|
data: {
|
|
|
|
name: 'Everyone Else 🔥',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0012',
|
|
|
|
avatarPath: util.landscapePurpleObjectUrl,
|
|
|
|
lastUpdated: Date.now() - 5 * 60 * 1000,
|
|
|
|
lastMessage: {
|
|
|
|
text: "What's going on?",
|
|
|
|
status: 'sent',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'contacts-header',
|
|
|
|
data: undefined,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'contact',
|
|
|
|
data: {
|
|
|
|
name: 'The one Everyone',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0013',
|
|
|
|
avatarPath: util.gifObjectUrl,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'contact',
|
|
|
|
data: {
|
|
|
|
name: 'No likey everyone',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0014',
|
|
|
|
color: 'red',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
<util.LeftPaneContext
|
|
|
|
theme={util.theme}
|
|
|
|
gutterStyle={{ height: '500px', display: 'flex', flexDirection: 'row' }}
|
|
|
|
>
|
2019-01-14 21:49:58 +00:00
|
|
|
<SearchResults
|
2019-08-09 00:46:49 +00:00
|
|
|
items={items}
|
2019-01-14 21:49:58 +00:00
|
|
|
i18n={util.i18n}
|
2019-08-09 00:46:49 +00:00
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
startNewConversation={(...args) =>
|
|
|
|
console.log('startNewConversation', args)
|
|
|
|
}
|
|
|
|
onStartNewConversation={(...args) =>
|
|
|
|
console.log('onStartNewConversation', args)
|
|
|
|
}
|
2019-01-14 21:49:58 +00:00
|
|
|
/>
|
2019-08-09 00:46:49 +00:00
|
|
|
</util.LeftPaneContext>;
|
2019-01-14 21:49:58 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### With no results at all
|
|
|
|
|
|
|
|
```jsx
|
2019-08-09 00:46:49 +00:00
|
|
|
<util.LeftPaneContext
|
|
|
|
theme={util.theme}
|
|
|
|
gutterStyle={{ height: '500px', display: 'flex', flexDirection: 'row' }}
|
|
|
|
>
|
2019-01-14 21:49:58 +00:00
|
|
|
<SearchResults
|
2019-08-09 00:46:49 +00:00
|
|
|
items={[]}
|
|
|
|
noResults={true}
|
|
|
|
searchTerm="something"
|
2019-01-14 21:49:58 +00:00
|
|
|
i18n={util.i18n}
|
2019-08-09 00:46:49 +00:00
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
startNewConversation={(...args) =>
|
|
|
|
console.log('startNewConversation', args)
|
|
|
|
}
|
|
|
|
onStartNewConversation={(...args) =>
|
|
|
|
console.log('onStartNewConversation', args)
|
|
|
|
}
|
|
|
|
renderMessageSearchResult={id => (
|
|
|
|
<MessageSearchResult
|
|
|
|
{...messageLookup[id]}
|
|
|
|
i18n={util.i18n}
|
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
2019-01-14 21:49:58 +00:00
|
|
|
/>
|
|
|
|
</util.LeftPaneContext>
|
|
|
|
```
|
|
|
|
|
2019-08-09 23:12:29 +00:00
|
|
|
#### With no results at all, searching in conversation
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
<util.LeftPaneContext
|
|
|
|
theme={util.theme}
|
|
|
|
gutterStyle={{ height: '500px', display: 'flex', flexDirection: 'row' }}
|
|
|
|
>
|
|
|
|
<SearchResults
|
|
|
|
items={[]}
|
|
|
|
noResults={true}
|
|
|
|
searchTerm="something"
|
|
|
|
searchInConversationName="Everyone 🔥"
|
|
|
|
i18n={util.i18n}
|
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
startNewConversation={(...args) =>
|
|
|
|
console.log('startNewConversation', args)
|
|
|
|
}
|
|
|
|
onStartNewConversation={(...args) =>
|
|
|
|
console.log('onStartNewConversation', args)
|
|
|
|
}
|
|
|
|
renderMessageSearchResult={id => (
|
|
|
|
<MessageSearchResult
|
|
|
|
{...messageLookup[id]}
|
|
|
|
i18n={util.i18n}
|
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</util.LeftPaneContext>
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Searching in conversation but no search term
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
<util.LeftPaneContext
|
|
|
|
theme={util.theme}
|
|
|
|
gutterStyle={{ height: '500px', display: 'flex', flexDirection: 'row' }}
|
|
|
|
>
|
|
|
|
<SearchResults
|
|
|
|
items={[]}
|
|
|
|
noResults={true}
|
|
|
|
searchTerm=""
|
|
|
|
searchInConversationName="Everyone 🔥"
|
|
|
|
i18n={util.i18n}
|
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
startNewConversation={(...args) =>
|
|
|
|
console.log('startNewConversation', args)
|
|
|
|
}
|
|
|
|
onStartNewConversation={(...args) =>
|
|
|
|
console.log('onStartNewConversation', args)
|
|
|
|
}
|
|
|
|
renderMessageSearchResult={id => (
|
|
|
|
<MessageSearchResult
|
|
|
|
{...messageLookup[id]}
|
|
|
|
i18n={util.i18n}
|
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</util.LeftPaneContext>
|
|
|
|
```
|
|
|
|
|
2019-01-14 21:49:58 +00:00
|
|
|
#### With a lot of results
|
|
|
|
|
|
|
|
```jsx
|
2019-08-09 00:46:49 +00:00
|
|
|
const items = [
|
|
|
|
{
|
|
|
|
type: 'conversations-header',
|
|
|
|
data: undefined,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'conversation',
|
|
|
|
data: {
|
|
|
|
name: 'Everyone 🌆',
|
|
|
|
conversationType: 'group',
|
|
|
|
phoneNumber: '(202) 555-0011',
|
|
|
|
avatarPath: util.landscapeGreenObjectUrl,
|
|
|
|
lastUpdated: Date.now() - 5 * 60 * 1000,
|
|
|
|
lastMessage: {
|
|
|
|
text: 'The rabbit hopped silently in the night.',
|
|
|
|
status: 'sent',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'conversation',
|
|
|
|
data: {
|
|
|
|
name: 'Everyone Else 🔥',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0012',
|
|
|
|
avatarPath: util.landscapePurpleObjectUrl,
|
|
|
|
lastUpdated: Date.now() - 5 * 60 * 1000,
|
|
|
|
lastMessage: {
|
|
|
|
text: "What's going on?",
|
|
|
|
status: 'sent',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'contacts-header',
|
|
|
|
data: undefined,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'contact',
|
|
|
|
data: {
|
|
|
|
name: 'The one Everyone',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0013',
|
|
|
|
avatarPath: util.gifObjectUrl,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'contact',
|
|
|
|
data: {
|
|
|
|
name: 'No likey everyone',
|
|
|
|
conversationType: 'direct',
|
|
|
|
phoneNumber: '(202) 555-0014',
|
|
|
|
color: 'red',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'messages-header',
|
|
|
|
data: undefined,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2019-01-14 21:49:58 +00:00
|
|
|
const messages = [];
|
|
|
|
for (let i = 0; i < 100; i += 1) {
|
|
|
|
messages.push({
|
|
|
|
from: {
|
|
|
|
name: 'Mr. Fire 🔥',
|
|
|
|
phoneNumber: '(202) 555-0015',
|
|
|
|
avatarPath: util.landscapeGreenObjectUrl,
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
isMe: true,
|
|
|
|
},
|
|
|
|
id: `${i}-guid-guid-guid-guid-guid`,
|
|
|
|
conversationId: '(202) 555-0015',
|
|
|
|
receivedAt: Date.now() - 5 * 60 * 1000,
|
|
|
|
snippet: `${i} <<left>>Everyone<<right>>! Get in!`,
|
2019-08-09 00:46:49 +00:00
|
|
|
conversationOpenInternal: data => console.log('onClick', data),
|
2019-01-14 21:49:58 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-08-09 00:46:49 +00:00
|
|
|
const messageLookup = util._.fromPairs(
|
|
|
|
util._.map(messages, message => [message.id, message])
|
|
|
|
);
|
|
|
|
messages.forEach(message => {
|
|
|
|
items.push({
|
|
|
|
type: 'message',
|
|
|
|
data: message.id,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
<util.LeftPaneContext
|
|
|
|
gutterStyle={{ height: '500px', display: 'flex', flexDirection: 'row' }}
|
|
|
|
theme={util.theme}
|
|
|
|
>
|
2019-01-14 21:49:58 +00:00
|
|
|
<SearchResults
|
2019-08-09 00:46:49 +00:00
|
|
|
items={items}
|
2019-01-14 21:49:58 +00:00
|
|
|
i18n={util.i18n}
|
2019-08-09 00:46:49 +00:00
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
startNewConversation={(...args) =>
|
|
|
|
console.log('startNewConversation', args)
|
|
|
|
}
|
|
|
|
onStartNewConversation={(...args) =>
|
|
|
|
console.log('onStartNewConversation', args)
|
|
|
|
}
|
|
|
|
renderMessageSearchResult={id => (
|
|
|
|
<MessageSearchResult
|
|
|
|
{...messageLookup[id]}
|
|
|
|
i18n={util.i18n}
|
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
2019-01-14 21:49:58 +00:00
|
|
|
/>
|
|
|
|
</util.LeftPaneContext>;
|
|
|
|
```
|
|
|
|
|
|
|
|
#### With just messages and no header
|
|
|
|
|
|
|
|
```jsx
|
2019-08-09 00:46:49 +00:00
|
|
|
const items = [];
|
|
|
|
|
2019-01-14 21:49:58 +00:00
|
|
|
const messages = [];
|
|
|
|
for (let i = 0; i < 10; i += 1) {
|
|
|
|
messages.push({
|
|
|
|
from: {
|
|
|
|
name: 'Mr. Fire 🔥',
|
|
|
|
phoneNumber: '(202) 555-0015',
|
|
|
|
avatarPath: util.landscapeGreenObjectUrl,
|
|
|
|
},
|
|
|
|
to: {
|
|
|
|
isMe: true,
|
|
|
|
},
|
|
|
|
id: `${i}-guid-guid-guid-guid-guid`,
|
|
|
|
conversationId: '(202) 555-0015',
|
|
|
|
receivedAt: Date.now() - 5 * 60 * 1000,
|
|
|
|
snippet: `${i} <<left>>Everyone<<right>>! Get in!`,
|
2019-08-09 00:46:49 +00:00
|
|
|
conversationOpenInternal: data => console.log('onClick', data),
|
2019-01-14 21:49:58 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-08-09 00:46:49 +00:00
|
|
|
const messageLookup = util._.fromPairs(
|
|
|
|
util._.map(messages, message => [message.id, message])
|
|
|
|
);
|
|
|
|
messages.forEach(message => {
|
|
|
|
items.push({
|
|
|
|
type: 'message',
|
|
|
|
data: message.id,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
<util.LeftPaneContext
|
|
|
|
gutterStyle={{ height: '500px', display: 'flex', flexDirection: 'row' }}
|
|
|
|
theme={util.theme}
|
|
|
|
>
|
2019-01-14 21:49:58 +00:00
|
|
|
<SearchResults
|
2019-08-09 00:46:49 +00:00
|
|
|
items={items}
|
2019-01-14 21:49:58 +00:00
|
|
|
i18n={util.i18n}
|
2019-08-09 00:46:49 +00:00
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
startNewConversation={(...args) =>
|
|
|
|
console.log('startNewConversation', args)
|
|
|
|
}
|
|
|
|
onStartNewConversation={(...args) =>
|
|
|
|
console.log('onStartNewConversation', args)
|
|
|
|
}
|
|
|
|
renderMessageSearchResult={id => (
|
|
|
|
<MessageSearchResult
|
|
|
|
{...messageLookup[id]}
|
|
|
|
i18n={util.i18n}
|
|
|
|
openConversationInternal={(...args) =>
|
|
|
|
console.log('openConversationInternal', args)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
2019-01-14 21:49:58 +00:00
|
|
|
/>
|
|
|
|
</util.LeftPaneContext>;
|
|
|
|
```
|