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
This commit is contained in:
parent
f5d014d4c7
commit
28fa5e4919
21 changed files with 883 additions and 148 deletions
|
@ -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',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue