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