Show parent post in composer when replying (close #3)
parent
0840c3f8f7
commit
fbcf0d79d1
|
@ -1,6 +1,5 @@
|
||||||
import {makeAutoObservable} from 'mobx'
|
import {makeAutoObservable} from 'mobx'
|
||||||
import {ProfileViewModel} from './profile-view'
|
import {ProfileViewModel} from './profile-view'
|
||||||
import * as Post from '../../third-party/api/src/client/types/app/bsky/feed/post'
|
|
||||||
|
|
||||||
export class ConfirmModel {
|
export class ConfirmModel {
|
||||||
name = 'confirm'
|
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 {
|
export interface ComposerOpts {
|
||||||
replyTo?: Post.PostRef
|
replyTo?: ComposerOptsPostRef
|
||||||
onPost?: () => void
|
onPost?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import {UserAutocompleteViewModel} from '../../../state/models/user-autocomplete
|
||||||
import {Autocomplete} from './Autocomplete'
|
import {Autocomplete} from './Autocomplete'
|
||||||
import Toast from '../util/Toast'
|
import Toast from '../util/Toast'
|
||||||
import ProgressCircle from '../util/ProgressCircle'
|
import ProgressCircle from '../util/ProgressCircle'
|
||||||
|
import {TextLink} from '../util/Link'
|
||||||
import {useStores} from '../../../state'
|
import {useStores} from '../../../state'
|
||||||
import * as apilib from '../../../state/lib/api'
|
import * as apilib from '../../../state/lib/api'
|
||||||
import {ComposerOpts} from '../../../state/models/shell-ui'
|
import {ComposerOpts} from '../../../state/models/shell-ui'
|
||||||
|
@ -163,6 +164,21 @@ export const ComposePost = observer(function ComposePost({
|
||||||
<Text style={s.red4}>{error}</Text>
|
<Text style={s.red4}>{error}</Text>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
{replyTo ? (
|
||||||
|
<View>
|
||||||
|
<Text style={s.gray4}>
|
||||||
|
Replying to{' '}
|
||||||
|
<TextLink
|
||||||
|
href={`/profile/${replyTo.author.handle}`}
|
||||||
|
text={'@' + replyTo.author.handle}
|
||||||
|
style={[s.bold, s.gray5]}
|
||||||
|
/>
|
||||||
|
</Text>
|
||||||
|
<View style={styles.replyToPost}>
|
||||||
|
<Text style={s.gray5}>{replyTo.text}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
) : undefined}
|
||||||
<TextInput
|
<TextInput
|
||||||
multiline
|
multiline
|
||||||
scrollEnabled
|
scrollEnabled
|
||||||
|
@ -250,4 +266,13 @@ const styles = StyleSheet.create({
|
||||||
padding: 5,
|
padding: 5,
|
||||||
fontSize: 21,
|
fontSize: 21,
|
||||||
},
|
},
|
||||||
|
replyToPost: {
|
||||||
|
paddingHorizontal: 8,
|
||||||
|
paddingVertical: 6,
|
||||||
|
borderWidth: 1,
|
||||||
|
borderColor: colors.gray2,
|
||||||
|
borderRadius: 6,
|
||||||
|
marginTop: 5,
|
||||||
|
marginBottom: 10,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -50,7 +50,15 @@ export const PostThreadItem = observer(function PostThreadItem({
|
||||||
|
|
||||||
const onPressReply = () => {
|
const onPressReply = () => {
|
||||||
store.shell.openComposer({
|
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,
|
onPost: onPostReply,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,17 @@ export const Post = observer(function Post({uri}: {uri: string}) {
|
||||||
replyHref = `/profile/${urip.hostname}/post/${urip.rkey}`
|
replyHref = `/profile/${urip.hostname}/post/${urip.rkey}`
|
||||||
}
|
}
|
||||||
const onPressReply = () => {
|
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 = () => {
|
const onPressToggleRepost = () => {
|
||||||
item
|
item
|
||||||
|
|
|
@ -43,7 +43,17 @@ export const FeedItem = observer(function FeedItem({
|
||||||
}, [record.reply])
|
}, [record.reply])
|
||||||
|
|
||||||
const onPressReply = () => {
|
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 = () => {
|
const onPressToggleRepost = () => {
|
||||||
item
|
item
|
||||||
|
|
Loading…
Reference in New Issue