Create post with outline tags
This commit is contained in:
@@ -111,6 +111,7 @@ export async function post(
|
||||
embed,
|
||||
langs,
|
||||
labels,
|
||||
tags: draft.tags,
|
||||
})
|
||||
} catch (e: any) {
|
||||
logger.error(`Failed to create post`, {
|
||||
|
||||
@@ -165,7 +165,13 @@ export const ComposePost = ({
|
||||
|
||||
const [draft, dispatch] = useReducer(
|
||||
composerReducer,
|
||||
{initImageUris, initQuoteUri: initQuote?.uri, initText, initMention},
|
||||
{
|
||||
initImageUris,
|
||||
initQuoteUri: initQuote?.uri,
|
||||
initText,
|
||||
initMention,
|
||||
initOutlineTags: [],
|
||||
},
|
||||
createComposerState,
|
||||
)
|
||||
const richtext = draft.richtext
|
||||
@@ -509,6 +515,13 @@ export const ComposePost = ({
|
||||
dispatch({type: 'embed_update_gif', alt: altText})
|
||||
}, [])
|
||||
|
||||
const onChangeOutlineTags = useCallback(
|
||||
(tags: string[]) => {
|
||||
dispatch({type: 'tags_update', tags})
|
||||
},
|
||||
[dispatch],
|
||||
)
|
||||
|
||||
const {
|
||||
scrollHandler,
|
||||
onScrollViewContentSizeChange,
|
||||
@@ -745,7 +758,7 @@ export const ComposePost = ({
|
||||
</Animated.ScrollView>
|
||||
<SuggestedLanguage text={richtext.text} />
|
||||
|
||||
<OutlineTags onChangeTags={() => {}} />
|
||||
<OutlineTags onChangeTags={onChangeOutlineTags} />
|
||||
|
||||
<Animated.View
|
||||
style={[a.flex_row, a.p_sm, t.atoms.bg, bottomBarAnimatedStyle]}>
|
||||
|
||||
@@ -53,6 +53,7 @@ export type ComposerDraft = {
|
||||
postgate: AppBskyFeedPostgate.Record
|
||||
threadgate: ThreadgateAllowUISetting[]
|
||||
embed: EmbedDraft
|
||||
tags: string[]
|
||||
}
|
||||
|
||||
export type ComposerAction =
|
||||
@@ -76,6 +77,7 @@ export type ComposerAction =
|
||||
| {type: 'embed_add_gif'; gif: Gif}
|
||||
| {type: 'embed_update_gif'; alt: string}
|
||||
| {type: 'embed_remove_gif'}
|
||||
| {type: 'tags_update'; tags: string[]}
|
||||
|
||||
export const MAX_IMAGES = 4
|
||||
|
||||
@@ -324,6 +326,12 @@ export function composerReducer(
|
||||
},
|
||||
}
|
||||
}
|
||||
case 'tags_update': {
|
||||
return {
|
||||
...state,
|
||||
tags: action.tags,
|
||||
}
|
||||
}
|
||||
default:
|
||||
return state
|
||||
}
|
||||
@@ -334,11 +342,13 @@ export function createComposerState({
|
||||
initMention,
|
||||
initImageUris,
|
||||
initQuoteUri,
|
||||
initOutlineTags,
|
||||
}: {
|
||||
initText: string | undefined
|
||||
initMention: string | undefined
|
||||
initImageUris: ComposerOpts['imageUris']
|
||||
initQuoteUri: string | undefined
|
||||
initOutlineTags: string[]
|
||||
}): ComposerDraft {
|
||||
let media: ImagesMedia | undefined
|
||||
if (initImageUris?.length) {
|
||||
@@ -379,5 +389,6 @@ export function createComposerState({
|
||||
media,
|
||||
link: undefined,
|
||||
},
|
||||
tags: initOutlineTags,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user