diff --git a/src/state/models/shell-ui.ts b/src/state/models/shell-ui.ts index 13d72073..fa8e3c18 100644 --- a/src/state/models/shell-ui.ts +++ b/src/state/models/shell-ui.ts @@ -1,6 +1,5 @@ import {makeAutoObservable} from 'mobx' import {ProfileViewModel} from './profile-view' -import * as Post from '../../third-party/api/src/client/types/app/bsky/feed/post' export class ConfirmModel { name = 'confirm' @@ -52,8 +51,17 @@ export class ServerInputModel { } } +export interface ComposerOptsPostRef { + uri: string + cid: string + text: string + author: { + handle: string + displayName?: string + } +} export interface ComposerOpts { - replyTo?: Post.PostRef + replyTo?: ComposerOptsPostRef onPost?: () => void } diff --git a/src/view/com/composer/ComposePost.tsx b/src/view/com/composer/ComposePost.tsx index 22659378..bb175f16 100644 --- a/src/view/com/composer/ComposePost.tsx +++ b/src/view/com/composer/ComposePost.tsx @@ -16,6 +16,7 @@ import {UserAutocompleteViewModel} from '../../../state/models/user-autocomplete import {Autocomplete} from './Autocomplete' import Toast from '../util/Toast' import ProgressCircle from '../util/ProgressCircle' +import {TextLink} from '../util/Link' import {useStores} from '../../../state' import * as apilib from '../../../state/lib/api' import {ComposerOpts} from '../../../state/models/shell-ui' @@ -163,6 +164,21 @@ export const ComposePost = observer(function ComposePost({ {error} )} + {replyTo ? ( + + + Replying to{' '} + + + + {replyTo.text} + + + ) : undefined} { store.shell.openComposer({ - replyTo: {uri: item.uri, cid: item.cid}, + replyTo: { + uri: item.uri, + cid: item.cid, + text: item.record.text as string, + author: { + handle: item.author.handle, + displayName: item.author.displayName, + }, + }, onPost: onPostReply, }) } diff --git a/src/view/com/post/Post.tsx b/src/view/com/post/Post.tsx index 10f8048f..d0df1b29 100644 --- a/src/view/com/post/Post.tsx +++ b/src/view/com/post/Post.tsx @@ -73,7 +73,17 @@ export const Post = observer(function Post({uri}: {uri: string}) { replyHref = `/profile/${urip.hostname}/post/${urip.rkey}` } const onPressReply = () => { - store.shell.openComposer({replyTo: {uri: item.uri, cid: item.cid}}) + store.shell.openComposer({ + replyTo: { + uri: item.uri, + cid: item.cid, + text: item.record.text as string, + author: { + handle: item.author.handle, + displayName: item.author.displayName, + }, + }, + }) } const onPressToggleRepost = () => { item diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx index 4d7b307b..7d28673b 100644 --- a/src/view/com/posts/FeedItem.tsx +++ b/src/view/com/posts/FeedItem.tsx @@ -43,7 +43,17 @@ export const FeedItem = observer(function FeedItem({ }, [record.reply]) const onPressReply = () => { - store.shell.openComposer({replyTo: {uri: item.uri, cid: item.cid}}) + store.shell.openComposer({ + replyTo: { + uri: item.uri, + cid: item.cid, + text: item.record.text as string, + author: { + handle: item.author.handle, + displayName: item.author.displayName, + }, + }, + }) } const onPressToggleRepost = () => { item