-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:anyproto/anytype-ts into refactorin…
…g/toggle-class
- Loading branch information
Showing
9 changed files
with
115 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import * as React from 'react'; | ||
import { observer } from 'mobx-react'; | ||
import { IconObject, Icon, ObjectName } from 'Component'; | ||
import { I, S, U } from 'Lib'; | ||
|
||
const ChatMessageReply = observer(class ChatMessageReply extends React.Component<I.ChatMessageComponent> { | ||
|
||
render () { | ||
const { space } = S.Common; | ||
const { rootId, id, getReplyContent, onReplyClick } = this.props; | ||
const message = S.Chat.getReply(rootId, id); | ||
const cn = [ 'reply' ]; | ||
|
||
if (!message) { | ||
return null; | ||
}; | ||
|
||
const { text, attachment, isMultiple } = getReplyContent(message); | ||
const author = U.Space.getParticipant(U.Space.getParticipantId(space, message.creator)); | ||
const iconLayouts = U.Object.getFileLayouts().concat(U.Object.getHumanLayouts()); | ||
|
||
let icon: any = null; | ||
|
||
if (attachment) { | ||
const iconSize = iconLayouts.includes(attachment.layout) ? 32 : null; | ||
icon = <IconObject className={iconSize ? 'noBg' : ''} object={attachment} size={32} iconSize={iconSize} />; | ||
} else | ||
if (isMultiple) { | ||
icon = <Icon className="isMultiple" />; | ||
}; | ||
|
||
if (U.Common.checkRtl(text)) { | ||
cn.push('isRtl'); | ||
}; | ||
|
||
return ( | ||
<div className={cn.join(' ')} onClick={onReplyClick}> | ||
{icon} | ||
<div className="textWrapper"> | ||
<ObjectName object={author} /> | ||
<div className="text" dangerouslySetInnerHTML={{ __html: U.Common.sanitize(text) }} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
}); | ||
|
||
export default ChatMessageReply; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters