diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-12-10 12:01:34 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-10 12:01:34 -0800 |
commit | 28fa5e4919ccf24073ccc92d88efb7e4b73b0b2b (patch) | |
tree | df35206692d0d1adce2a32a2ba8188fb4ac5ad26 /src/view/com/composer/Composer.tsx | |
parent | f5d014d4c7b42213e41f2cbc75d318e6462e6995 (diff) | |
download | voidsky-28fa5e4919ccf24073ccc92d88efb7e4b73b0b2b.tar.zst |
Add "Who can reply" controls [WIP] (#1954)
* Add threadgating * UI improvements * More ui work * Remove comment * Tweak colors * Add missing keys * Tweak sizing * Only show composer option on non-reply * Flex wrap fix * Move the threadgate control to the top of the composer
Diffstat (limited to 'src/view/com/composer/Composer.tsx')
-rw-r--r-- | src/view/com/composer/Composer.tsx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index d8af6d0ce..97d443451 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -35,6 +35,7 @@ import {shortenLinks} from 'lib/strings/rich-text-manip' import {toShortUrl} from 'lib/strings/url-helpers' import {SelectPhotoBtn} from './photos/SelectPhotoBtn' import {OpenCameraBtn} from './photos/OpenCameraBtn' +import {ThreadgateBtn} from './threadgate/ThreadgateBtn' import {usePalette} from 'lib/hooks/usePalette' import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' import {useExternalLinkFetch} from './useExternalLinkFetch' @@ -61,6 +62,7 @@ import {useProfileQuery} from '#/state/queries/profile' import {useComposerControls} from '#/state/shell/composer' import {until} from '#/lib/async/until' import {emitPostCreated} from '#/state/events' +import {ThreadgateSetting} from '#/state/queries/threadgate' type Props = ComposerOpts export const ComposePost = observer(function ComposePost({ @@ -105,6 +107,7 @@ export const ComposePost = observer(function ComposePost({ ) const {extLink, setExtLink} = useExternalLinkFetch({setQuote}) const [labels, setLabels] = useState<string[]>([]) + const [threadgate, setThreadgate] = useState<ThreadgateSetting[]>([]) const [suggestedLinks, setSuggestedLinks] = useState<Set<string>>(new Set()) const gallery = useMemo(() => new GalleryModel(), []) const onClose = useCallback(() => { @@ -220,6 +223,7 @@ export const ComposePost = observer(function ComposePost({ quote, extLink, labels, + threadgate, onStateChange: setProcessingState, langs: toPostLanguages(langPrefs.postLanguage), }) @@ -296,6 +300,12 @@ export const ComposePost = observer(function ComposePost({ onChange={setLabels} hasMedia={hasMedia} /> + {replyTo ? null : ( + <ThreadgateBtn + threadgate={threadgate} + onChange={setThreadgate} + /> + )} {canPost ? ( <TouchableOpacity testID="composerPublishBtn" @@ -458,9 +468,11 @@ const styles = StyleSheet.create({ topbar: { flexDirection: 'row', alignItems: 'center', + paddingTop: 6, paddingBottom: 4, paddingHorizontal: 20, height: 55, + gap: 4, }, topbarDesktop: { paddingTop: 10, @@ -470,6 +482,7 @@ const styles = StyleSheet.create({ borderRadius: 20, paddingHorizontal: 20, paddingVertical: 6, + marginLeft: 12, }, errorLine: { flexDirection: 'row', |