mirror of
https://github.com/urbit/shrub.git
synced 2024-12-26 05:23:35 +03:00
links: mention support
This commit is contained in:
parent
94f787d120
commit
7dce8a6d6b
@ -4,9 +4,10 @@ import { cite } from '~/logic/lib/util';
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { Box, Text, Row } from '@tlon/indigo-react';
|
import { Box, Text, Row } from '@tlon/indigo-react';
|
||||||
import RichText from '~/views/components/RichText';
|
import RichText from '~/views/components/RichText';
|
||||||
|
import { MentionText } from "~/views/components/MentionText";
|
||||||
|
|
||||||
export const CommentItem = (props) => {
|
export const CommentItem = (props) => {
|
||||||
const content = props.post.contents[0].text;
|
const content = props.post.contents;
|
||||||
const timeSent =
|
const timeSent =
|
||||||
moment.unix(props.post['time-sent'] / 1000).format('hh:mm a');
|
moment.unix(props.post['time-sent'] / 1000).format('hh:mm a');
|
||||||
|
|
||||||
@ -33,10 +34,12 @@ export const CommentItem = (props) => {
|
|||||||
</Row>
|
</Row>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Text display="block" py={3} fontSize={1}>
|
<Text py={3} fontSize={1}>
|
||||||
<RichText remoteContentPolicy={props.remoteContentPolicy}>
|
<MentionText
|
||||||
{content}
|
remoteContentPolicy={props.remoteContentPolicy}
|
||||||
</RichText>
|
contacts={props.contacts}
|
||||||
|
content={content}
|
||||||
|
/>
|
||||||
</Text>
|
</Text>
|
||||||
</Row>
|
</Row>
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -2,6 +2,7 @@ import React, { Component } from 'react';
|
|||||||
import { Spinner } from '~/views/components/Spinner';
|
import { Spinner } from '~/views/components/Spinner';
|
||||||
import { createPost } from '~/logic/api/graph';
|
import { createPost } from '~/logic/api/graph';
|
||||||
import { deSig } from "~/logic/lib/util";
|
import { deSig } from "~/logic/lib/util";
|
||||||
|
import { scanForMentions } from "~/logic/lib/graph";
|
||||||
|
|
||||||
|
|
||||||
export class CommentSubmit extends Component {
|
export class CommentSubmit extends Component {
|
||||||
@ -17,9 +18,8 @@ export class CommentSubmit extends Component {
|
|||||||
|
|
||||||
onClickPost() {
|
onClickPost() {
|
||||||
const parentIndex = this.props.parentIndex || '';
|
const parentIndex = this.props.parentIndex || '';
|
||||||
let post = createPost([
|
const content = scanForMentions(this.state.comment);
|
||||||
{ text: this.state.comment },
|
let post = createPost(content, parentIndex);
|
||||||
], parentIndex);
|
|
||||||
|
|
||||||
this.setState({ disabled: true }, () => {
|
this.setState({ disabled: true }, () => {
|
||||||
this.props.api.graph.addPost(
|
this.props.api.graph.addPost(
|
||||||
|
@ -23,6 +23,7 @@ export const Comments = (props) => {
|
|||||||
return (
|
return (
|
||||||
<CommentItem
|
<CommentItem
|
||||||
key={comment.post.index}
|
key={comment.post.index}
|
||||||
|
contacts={contacts}
|
||||||
post={comment.post}
|
post={comment.post}
|
||||||
nickname={nickname}
|
nickname={nickname}
|
||||||
hasNickname={Boolean(nickname)}
|
hasNickname={Boolean(nickname)}
|
||||||
|
Loading…
Reference in New Issue
Block a user