inherit outline tags of parent post
This commit is contained in:
@@ -251,6 +251,7 @@ export interface ComposerOpts {
|
|||||||
onPost?: () => void
|
onPost?: () => void
|
||||||
quote?: ComposerOptsQuote
|
quote?: ComposerOptsQuote
|
||||||
mention?: string // handle of user to mention
|
mention?: string // handle of user to mention
|
||||||
|
outlineTags?: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ShellUiModel {
|
export class ShellUiModel {
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export const ComposePost = observer(function ComposePost({
|
|||||||
onPost,
|
onPost,
|
||||||
quote: initQuote,
|
quote: initQuote,
|
||||||
mention: initMention,
|
mention: initMention,
|
||||||
|
outlineTags,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const {track} = useAnalytics()
|
const {track} = useAnalytics()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
@@ -89,7 +90,7 @@ export const ComposePost = observer(function ComposePost({
|
|||||||
const [labels, setLabels] = useState<string[]>([])
|
const [labels, setLabels] = useState<string[]>([])
|
||||||
const [suggestedLinks, setSuggestedLinks] = useState<Set<string>>(new Set())
|
const [suggestedLinks, setSuggestedLinks] = useState<Set<string>>(new Set())
|
||||||
const gallery = useMemo(() => new GalleryModel(store), [store])
|
const gallery = useMemo(() => new GalleryModel(store), [store])
|
||||||
const [tags, setTags] = useState<string[]>([])
|
const [tags, setTags] = useState<string[]>(outlineTags || [])
|
||||||
const onClose = useCallback(() => {
|
const onClose = useCallback(() => {
|
||||||
store.shell.closeComposer()
|
store.shell.closeComposer()
|
||||||
}, [store])
|
}, [store])
|
||||||
@@ -455,7 +456,7 @@ export const ComposePost = observer(function ComposePost({
|
|||||||
paddingHorizontal: 15,
|
paddingHorizontal: 15,
|
||||||
},
|
},
|
||||||
]}>
|
]}>
|
||||||
<TagInput onChangeTags={onChangeTags} />
|
<TagInput initialTags={tags} onChangeTags={onChangeTags} />
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={[pal.border, styles.bottomBar]}>
|
<View style={[pal.border, styles.bottomBar]}>
|
||||||
|
|||||||
@@ -27,9 +27,11 @@ import {uniq} from 'lib/strings/helpers'
|
|||||||
|
|
||||||
export function TagInput({
|
export function TagInput({
|
||||||
max = 8,
|
max = 8,
|
||||||
|
initialTags = [],
|
||||||
onChangeTags,
|
onChangeTags,
|
||||||
}: {
|
}: {
|
||||||
max?: number
|
max?: number
|
||||||
|
initialTags?: string[]
|
||||||
onChangeTags: (tags: string[]) => void
|
onChangeTags: (tags: string[]) => void
|
||||||
}) {
|
}) {
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
@@ -38,7 +40,7 @@ export function TagInput({
|
|||||||
const input = React.useRef<TextInput>(null)
|
const input = React.useRef<TextInput>(null)
|
||||||
|
|
||||||
const [value, setValue] = React.useState('')
|
const [value, setValue] = React.useState('')
|
||||||
const [tags, setTags] = React.useState<string[]>([])
|
const [tags, setTags] = React.useState<string[]>(initialTags)
|
||||||
const [suggestions, setSuggestions] = React.useState<string[]>([])
|
const [suggestions, setSuggestions] = React.useState<string[]>([])
|
||||||
const [isInitialLoad, setIsInitialLoad] = React.useState(true)
|
const [isInitialLoad, setIsInitialLoad] = React.useState(true)
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,11 @@ import {uniq} from 'lib/strings/helpers'
|
|||||||
|
|
||||||
export function TagInput({
|
export function TagInput({
|
||||||
max = 8,
|
max = 8,
|
||||||
|
initialTags = [],
|
||||||
onChangeTags,
|
onChangeTags,
|
||||||
}: {
|
}: {
|
||||||
max?: number
|
max?: number
|
||||||
|
initialTags?: string[]
|
||||||
onChangeTags: (tags: string[]) => void
|
onChangeTags: (tags: string[]) => void
|
||||||
}) {
|
}) {
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
@@ -43,7 +45,7 @@ export function TagInput({
|
|||||||
const containerRef = React.useRef<HTMLDivElement>(null)
|
const containerRef = React.useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
const [value, setValue] = React.useState('')
|
const [value, setValue] = React.useState('')
|
||||||
const [tags, setTags] = React.useState<string[]>([])
|
const [tags, setTags] = React.useState<string[]>(initialTags)
|
||||||
const [dropdownIsOpen, setDropdownIsOpen] = React.useState(false)
|
const [dropdownIsOpen, setDropdownIsOpen] = React.useState(false)
|
||||||
const [dropdownItems, setDropdownItems] = React.useState<
|
const [dropdownItems, setDropdownItems] = React.useState<
|
||||||
{value: string; label: string}[]
|
{value: string; label: string}[]
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ export const PostThreadItem = observer(function PostThreadItem({
|
|||||||
|
|
||||||
const itemUri = item.post.uri
|
const itemUri = item.post.uri
|
||||||
const itemCid = item.post.cid
|
const itemCid = item.post.cid
|
||||||
|
const outlineTags = item.postRecord?.tags
|
||||||
const itemHref = React.useMemo(() => {
|
const itemHref = React.useMemo(() => {
|
||||||
const urip = new AtUri(item.post.uri)
|
const urip = new AtUri(item.post.uri)
|
||||||
return makeProfileLink(item.post.author, 'post', urip.rkey)
|
return makeProfileLink(item.post.author, 'post', urip.rkey)
|
||||||
@@ -91,6 +92,7 @@ export const PostThreadItem = observer(function PostThreadItem({
|
|||||||
|
|
||||||
const onPressReply = React.useCallback(() => {
|
const onPressReply = React.useCallback(() => {
|
||||||
store.shell.openComposer({
|
store.shell.openComposer({
|
||||||
|
outlineTags,
|
||||||
replyTo: {
|
replyTo: {
|
||||||
uri: item.post.uri,
|
uri: item.post.uri,
|
||||||
cid: item.post.cid,
|
cid: item.post.cid,
|
||||||
@@ -103,7 +105,7 @@ export const PostThreadItem = observer(function PostThreadItem({
|
|||||||
},
|
},
|
||||||
onPost: onPostReply,
|
onPost: onPostReply,
|
||||||
})
|
})
|
||||||
}, [store, item, record, onPostReply])
|
}, [store, item, record, onPostReply, outlineTags])
|
||||||
|
|
||||||
const onPressToggleRepost = React.useCallback(() => {
|
const onPressToggleRepost = React.useCallback(() => {
|
||||||
return item
|
return item
|
||||||
@@ -399,6 +401,7 @@ export const PostThreadItem = observer(function PostThreadItem({
|
|||||||
itemCid={itemCid}
|
itemCid={itemCid}
|
||||||
itemHref={itemHref}
|
itemHref={itemHref}
|
||||||
itemTitle={itemTitle}
|
itemTitle={itemTitle}
|
||||||
|
itemOutlineTags={outlineTags}
|
||||||
author={item.post.author}
|
author={item.post.author}
|
||||||
text={item.richText?.text || record.text}
|
text={item.richText?.text || record.text}
|
||||||
indexedAt={item.post.indexedAt}
|
indexedAt={item.post.indexedAt}
|
||||||
@@ -530,6 +533,7 @@ export const PostThreadItem = observer(function PostThreadItem({
|
|||||||
itemCid={itemCid}
|
itemCid={itemCid}
|
||||||
itemHref={itemHref}
|
itemHref={itemHref}
|
||||||
itemTitle={itemTitle}
|
itemTitle={itemTitle}
|
||||||
|
itemOutlineTags={outlineTags}
|
||||||
author={item.post.author}
|
author={item.post.author}
|
||||||
text={item.richText?.text || record.text}
|
text={item.richText?.text || record.text}
|
||||||
indexedAt={item.post.indexedAt}
|
indexedAt={item.post.indexedAt}
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ const PostLoaded = observer(function PostLoadedImpl({
|
|||||||
|
|
||||||
const itemUri = item.post.uri
|
const itemUri = item.post.uri
|
||||||
const itemCid = item.post.cid
|
const itemCid = item.post.cid
|
||||||
|
const outlineTags = item.postRecord?.tags
|
||||||
const itemUrip = new AtUri(item.post.uri)
|
const itemUrip = new AtUri(item.post.uri)
|
||||||
const itemHref = makeProfileLink(item.post.author, 'post', itemUrip.rkey)
|
const itemHref = makeProfileLink(item.post.author, 'post', itemUrip.rkey)
|
||||||
const itemTitle = `Post by ${item.post.author.handle}`
|
const itemTitle = `Post by ${item.post.author.handle}`
|
||||||
@@ -122,6 +123,7 @@ const PostLoaded = observer(function PostLoadedImpl({
|
|||||||
|
|
||||||
const onPressReply = React.useCallback(() => {
|
const onPressReply = React.useCallback(() => {
|
||||||
store.shell.openComposer({
|
store.shell.openComposer({
|
||||||
|
outlineTags,
|
||||||
replyTo: {
|
replyTo: {
|
||||||
uri: item.post.uri,
|
uri: item.post.uri,
|
||||||
cid: item.post.cid,
|
cid: item.post.cid,
|
||||||
@@ -133,7 +135,7 @@ const PostLoaded = observer(function PostLoadedImpl({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}, [store, item, record])
|
}, [store, item, record, outlineTags])
|
||||||
|
|
||||||
const onPressToggleRepost = React.useCallback(() => {
|
const onPressToggleRepost = React.useCallback(() => {
|
||||||
return item
|
return item
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ export const FeedItem = observer(function FeedItemImpl({
|
|||||||
const record = item.postRecord
|
const record = item.postRecord
|
||||||
const itemUri = item.post.uri
|
const itemUri = item.post.uri
|
||||||
const itemCid = item.post.cid
|
const itemCid = item.post.cid
|
||||||
|
const outlineTags = item.postRecord?.tags
|
||||||
const itemHref = useMemo(() => {
|
const itemHref = useMemo(() => {
|
||||||
const urip = new AtUri(item.post.uri)
|
const urip = new AtUri(item.post.uri)
|
||||||
return makeProfileLink(item.post.author, 'post', urip.rkey)
|
return makeProfileLink(item.post.author, 'post', urip.rkey)
|
||||||
@@ -72,6 +73,7 @@ export const FeedItem = observer(function FeedItemImpl({
|
|||||||
const onPressReply = React.useCallback(() => {
|
const onPressReply = React.useCallback(() => {
|
||||||
track('FeedItem:PostReply')
|
track('FeedItem:PostReply')
|
||||||
store.shell.openComposer({
|
store.shell.openComposer({
|
||||||
|
outlineTags,
|
||||||
replyTo: {
|
replyTo: {
|
||||||
uri: item.post.uri,
|
uri: item.post.uri,
|
||||||
cid: item.post.cid,
|
cid: item.post.cid,
|
||||||
@@ -83,7 +85,7 @@ export const FeedItem = observer(function FeedItemImpl({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}, [item, track, record, store])
|
}, [item, track, record, store, outlineTags])
|
||||||
|
|
||||||
const onPressToggleRepost = React.useCallback(() => {
|
const onPressToggleRepost = React.useCallback(() => {
|
||||||
track('FeedItem:PostRepost')
|
track('FeedItem:PostRepost')
|
||||||
@@ -332,6 +334,7 @@ export const FeedItem = observer(function FeedItemImpl({
|
|||||||
itemCid={itemCid}
|
itemCid={itemCid}
|
||||||
itemHref={itemHref}
|
itemHref={itemHref}
|
||||||
itemTitle={itemTitle}
|
itemTitle={itemTitle}
|
||||||
|
itemOutlineTags={outlineTags}
|
||||||
author={item.post.author}
|
author={item.post.author}
|
||||||
text={item.richText?.text || record.text}
|
text={item.richText?.text || record.text}
|
||||||
indexedAt={item.post.indexedAt}
|
indexedAt={item.post.indexedAt}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ interface PostCtrlsOpts {
|
|||||||
itemCid: string
|
itemCid: string
|
||||||
itemHref: string
|
itemHref: string
|
||||||
itemTitle: string
|
itemTitle: string
|
||||||
|
itemOutlineTags?: string[]
|
||||||
isAuthor: boolean
|
isAuthor: boolean
|
||||||
author: {
|
author: {
|
||||||
did: string
|
did: string
|
||||||
@@ -70,6 +71,7 @@ export function PostCtrls(opts: PostCtrlsOpts) {
|
|||||||
const onQuote = useCallback(() => {
|
const onQuote = useCallback(() => {
|
||||||
store.shell.closeModal()
|
store.shell.closeModal()
|
||||||
store.shell.openComposer({
|
store.shell.openComposer({
|
||||||
|
outlineTags: opts.itemOutlineTags,
|
||||||
quote: {
|
quote: {
|
||||||
uri: opts.itemUri,
|
uri: opts.itemUri,
|
||||||
cid: opts.itemCid,
|
cid: opts.itemCid,
|
||||||
@@ -86,6 +88,7 @@ export function PostCtrls(opts: PostCtrlsOpts) {
|
|||||||
opts.itemUri,
|
opts.itemUri,
|
||||||
opts.text,
|
opts.text,
|
||||||
store.shell,
|
store.shell,
|
||||||
|
opts.itemOutlineTags,
|
||||||
])
|
])
|
||||||
|
|
||||||
const onPressToggleLikeWrapper = async () => {
|
const onPressToggleLikeWrapper = async () => {
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ export const PostThreadScreen = withAuthRequired(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
store.shell.openComposer({
|
store.shell.openComposer({
|
||||||
|
outlineTags: view.thread.postRecord?.tags,
|
||||||
replyTo: {
|
replyTo: {
|
||||||
uri: view.thread.post.uri,
|
uri: view.thread.post.uri,
|
||||||
cid: view.thread.post.cid,
|
cid: view.thread.post.cid,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export const Composer = observer(function ComposerImpl({
|
|||||||
onPost,
|
onPost,
|
||||||
quote,
|
quote,
|
||||||
mention,
|
mention,
|
||||||
|
outlineTags,
|
||||||
}: {
|
}: {
|
||||||
active: boolean
|
active: boolean
|
||||||
winHeight: number
|
winHeight: number
|
||||||
@@ -20,6 +21,7 @@ export const Composer = observer(function ComposerImpl({
|
|||||||
onPost?: ComposerOpts['onPost']
|
onPost?: ComposerOpts['onPost']
|
||||||
quote?: ComposerOpts['quote']
|
quote?: ComposerOpts['quote']
|
||||||
mention?: ComposerOpts['mention']
|
mention?: ComposerOpts['mention']
|
||||||
|
outlineTags?: ComposerOpts['outlineTags']
|
||||||
}) {
|
}) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const initInterp = useAnimatedValue(0)
|
const initInterp = useAnimatedValue(0)
|
||||||
@@ -64,6 +66,7 @@ export const Composer = observer(function ComposerImpl({
|
|||||||
onPost={onPost}
|
onPost={onPost}
|
||||||
quote={quote}
|
quote={quote}
|
||||||
mention={mention}
|
mention={mention}
|
||||||
|
outlineTags={outlineTags}
|
||||||
/>
|
/>
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export const Composer = observer(function ComposerImpl({
|
|||||||
quote,
|
quote,
|
||||||
onPost,
|
onPost,
|
||||||
mention,
|
mention,
|
||||||
|
outlineTags,
|
||||||
}: {
|
}: {
|
||||||
active: boolean
|
active: boolean
|
||||||
winHeight: number
|
winHeight: number
|
||||||
@@ -21,6 +22,7 @@ export const Composer = observer(function ComposerImpl({
|
|||||||
quote: ComposerOpts['quote']
|
quote: ComposerOpts['quote']
|
||||||
onPost?: ComposerOpts['onPost']
|
onPost?: ComposerOpts['onPost']
|
||||||
mention?: ComposerOpts['mention']
|
mention?: ComposerOpts['mention']
|
||||||
|
outlineTags?: ComposerOpts['outlineTags']
|
||||||
}) {
|
}) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const {isMobile} = useWebMediaQueries()
|
const {isMobile} = useWebMediaQueries()
|
||||||
@@ -46,6 +48,7 @@ export const Composer = observer(function ComposerImpl({
|
|||||||
quote={quote}
|
quote={quote}
|
||||||
onPost={onPost}
|
onPost={onPost}
|
||||||
mention={mention}
|
mention={mention}
|
||||||
|
outlineTags={outlineTags}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ const ShellInner = observer(function ShellInnerImpl() {
|
|||||||
onPost={store.shell.composerOpts?.onPost}
|
onPost={store.shell.composerOpts?.onPost}
|
||||||
quote={store.shell.composerOpts?.quote}
|
quote={store.shell.composerOpts?.quote}
|
||||||
mention={store.shell.composerOpts?.mention}
|
mention={store.shell.composerOpts?.mention}
|
||||||
|
outlineTags={store.shell.composerOpts?.outlineTags}
|
||||||
/>
|
/>
|
||||||
<ModalsContainer />
|
<ModalsContainer />
|
||||||
<Lightbox />
|
<Lightbox />
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ const ShellInner = observer(function ShellInnerImpl() {
|
|||||||
quote={store.shell.composerOpts?.quote}
|
quote={store.shell.composerOpts?.quote}
|
||||||
onPost={store.shell.composerOpts?.onPost}
|
onPost={store.shell.composerOpts?.onPost}
|
||||||
mention={store.shell.composerOpts?.mention}
|
mention={store.shell.composerOpts?.mention}
|
||||||
|
outlineTags={store.shell.composerOpts?.outlineTags}
|
||||||
/>
|
/>
|
||||||
{showBottomBar && <BottomBarWeb />}
|
{showBottomBar && <BottomBarWeb />}
|
||||||
<ModalsContainer />
|
<ModalsContainer />
|
||||||
|
|||||||
Reference in New Issue
Block a user