session-desktop/ts/components/ConversationListItem.md

494 lines
13 KiB
Markdown
Raw Normal View History

#### With name and profile
```jsx
<util.LeftPaneContext theme={util.theme}>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId1"
name="Someone 🔥 Somewhere"
conversationType={'direct'}
phoneNumber="(202) 555-0011"
avatarPath={util.gifObjectUrl}
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: "What's going on?",
status: 'sent',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
</util.LeftPaneContext>
```
#### Profile, with name, no avatar
```jsx
<util.LeftPaneContext theme={util.theme}>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId1"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
name="Mr. Fire🔥"
color="green"
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: 'Just a second',
status: 'read',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
</util.LeftPaneContext>
```
2019-01-31 02:45:58 +01:00
#### Conversation with yourself
```jsx
<util.LeftPaneContext theme={util.theme}>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId1"
2019-01-31 02:45:58 +01:00
isMe={true}
phoneNumber="(202) 555-0011"
conversationType={'direct'}
name="Mr. Fire🔥"
color="green"
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: 'Just a second',
status: 'read',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
2019-01-31 02:45:58 +01:00
i18n={util.i18n}
/>
</util.LeftPaneContext>
```
#### All types of status
```jsx
<util.LeftPaneContext theme={util.theme}>
<div>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId1"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
name="Mr. Fire🔥"
color="green"
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: 'Sending',
status: 'sending',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId2"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
name="Mr. Fire🔥"
color="green"
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: 'Sent',
status: 'sent',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId3"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
name="Mr. Fire🔥"
color="green"
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: 'Delivered',
status: 'delivered',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId4"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
name="Mr. Fire🔥"
color="green"
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: 'Read',
status: 'read',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId5"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
name="Mr. Fire🔥"
color="green"
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: 'Error',
status: 'error',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
</div>
</util.LeftPaneContext>
```
2018-11-14 20:10:32 +01:00
#### Is typing
```jsx
<util.LeftPaneContext theme={util.theme}>
<div>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId1"
2018-11-14 20:10:32 +01:00
phoneNumber="(202) 555-0011"
conversationType={'direct'}
unreadCount={4}
lastUpdated={Date.now() - 5 * 60 * 1000}
isTyping={true}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
2018-11-14 20:10:32 +01:00
i18n={util.i18n}
/>
</div>
<div>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId2"
2018-11-14 20:10:32 +01:00
phoneNumber="(202) 555-0011"
conversationType={'direct'}
unreadCount={4}
lastUpdated={Date.now() - 5 * 60 * 1000}
isTyping={true}
lastMessage={{
status: 'read',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
2018-11-14 20:10:32 +01:00
i18n={util.i18n}
/>
</div>
</util.LeftPaneContext>
```
#### Selected
#### With unread
```jsx
<util.LeftPaneContext theme={util.theme}>
<div>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId1"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
unreadCount={4}
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: 'Hey there!',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId2"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
unreadCount={10}
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: 'Hey there!',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId3"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
unreadCount={250}
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: 'Hey there!',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
</div>
</util.LeftPaneContext>
```
#### Selected
```jsx
<util.LeftPaneContext theme={util.theme}>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId1"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
isSelected={true}
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: 'Hey there!',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
</util.LeftPaneContext>
```
#### With emoji/links in message, no status
We don't want Jumbomoji or links.
```jsx
<util.LeftPaneContext theme={util.theme}>
<div>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId1"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
2020-01-29 11:54:22 +01:00
text: 'Download at http://getsession.org',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId2"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: '🔥',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
</div>
</util.LeftPaneContext>
```
#### Long content
We only show one line.
```jsx
<util.LeftPaneContext theme={util.theme}>
<div>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId1"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
name="Long contact name. Esquire. The third. And stuff. And more! And more!"
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: 'Normal message',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId2"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text:
"Long line. This is a really really really long line. Really really long. Because that's just how it is",
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId3"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text:
"Long line. This is a really really really long line. Really really long. Because that's just how it is",
status: 'read',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId4"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
lastUpdated={Date.now() - 5 * 60 * 1000}
unreadCount={8}
lastMessage={{
text:
"Long line. This is a really really really long line. Really really long. Because that's just how it is",
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId5"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text:
"Many lines. This is a many-line message.\nLine 2 is really exciting but it shouldn't be seen.\nLine three is even better.\nLine 4, well.",
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId6"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text:
"Many lines. This is a many-line message.\nLine 2 is really exciting but it shouldn't be seen.\nLine three is even better.\nLine 4, well.",
status: 'delivered',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
</div>
</util.LeftPaneContext>
```
#### More narrow
On platforms that show scrollbars all the time, this is true all the time.
```jsx
<util.LeftPaneContext theme={util.theme}>
<div style={{ width: '280px' }}>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId1"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
name="Long contact name. Esquire. The third. And stuff. And more! And more!"
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: 'Normal message',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId2"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text:
"Long line. This is a really really really long line. Really really long. Because that's just how it is",
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
</div>
</util.LeftPaneContext>
```
#### With various ages
```jsx
<util.LeftPaneContext theme={util.theme}>
<div>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId1"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
lastUpdated={Date.now() - 5 * 60 * 60 * 1000}
lastMessage={{
text: 'Five hours ago',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId2"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
lastUpdated={Date.now() - 24 * 60 * 60 * 1000}
lastMessage={{
text: 'One day ago',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId3"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
lastUpdated={Date.now() - 7 * 24 * 60 * 60 * 1000}
lastMessage={{
text: 'One week ago',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId4"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
lastUpdated={Date.now() - 365 * 24 * 60 * 60 * 1000}
lastMessage={{
text: 'One year ago',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
</div>
</util.LeftPaneContext>
```
#### Missing data
```jsx
<util.LeftPaneContext theme={util.theme}>
<div>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId1"
name="John"
conversationType={'direct'}
lastUpdated={null}
lastMessage={{
text: 'Missing last updated',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId2"
name="Missing message"
conversationType={'direct'}
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: null,
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
<ConversationListItem
2019-01-14 22:49:58 +01:00
id="conversationId3"
phoneNumber="(202) 555-0011"
conversationType={'direct'}
lastUpdated={Date.now() - 5 * 60 * 1000}
lastMessage={{
text: null,
status: 'sent',
}}
2019-01-14 22:49:58 +01:00
onClick={result => console.log('onClick', result)}
i18n={util.i18n}
/>
</div>
</util.LeftPaneContext>
```