Compare commits

...

9 Commits

Author SHA1 Message Date
Eric Bailey 7ed5d7547b Pluralize 2024-10-17 11:33:38 -05:00
Eric Bailey 4fb85d7399 Tweak it moar 2024-10-17 11:28:47 -05:00
Samuel Newman f6170079a4 change button label and change opacity when no media (#5794) 2024-10-17 11:22:51 -05:00
Hailey 3848184c3d tweaks 2024-10-17 12:14:32 +03:00
Hailey 7fea87dabe update icon 2024-10-17 12:13:55 +03:00
Hailey 27b548178a tweak wording 2024-10-17 12:13:55 +03:00
Hailey 6080a17193 make sure its usable on large font sizes 2024-10-17 12:13:55 +03:00
Hailey abf1a8d0a7 rm 2024-10-17 12:13:45 +03:00
Hailey eff4b02176 move self label button? 2024-10-17 12:13:45 +03:00
3 changed files with 106 additions and 95 deletions
+56 -58
View File
@@ -13,6 +13,7 @@ import {
Keyboard,
KeyboardAvoidingView,
LayoutChangeEvent,
ScrollView,
StyleProp,
StyleSheet,
View,
@@ -559,45 +560,30 @@ export const ComposePost = ({
<ActivityIndicator />
</View>
</>
) : canPost ? (
<Button
testID="composerPublishBtn"
label={replyTo ? _(msg`Publish reply`) : _(msg`Publish post`)}
variant="solid"
color="primary"
shape="default"
size="small"
style={[a.rounded_full, a.py_sm]}
onPress={() => onPressPublish()}
disabled={videoState.status !== 'idle' && publishOnUpload}>
<ButtonText style={[a.text_md]}>
{replyTo ? (
<Trans context="action">Reply</Trans>
) : (
<Trans context="action">Post</Trans>
)}
</ButtonText>
</Button>
) : (
<View style={[styles.postBtnWrapper]}>
<LabelsBtn
labels={draft.labels}
onChange={nextLabels => {
dispatch({type: 'update_labels', labels: nextLabels})
}}
hasMedia={hasMedia || Boolean(extLink)}
/>
{canPost ? (
<Button
testID="composerPublishBtn"
label={
replyTo ? _(msg`Publish reply`) : _(msg`Publish post`)
}
variant="solid"
color="primary"
shape="default"
size="small"
style={[a.rounded_full, a.py_sm]}
onPress={() => onPressPublish()}
disabled={
videoState.status !== 'idle' && publishOnUpload
}>
<ButtonText style={[a.text_md]}>
{replyTo ? (
<Trans context="action">Reply</Trans>
) : (
<Trans context="action">Post</Trans>
)}
</ButtonText>
</Button>
) : (
<View style={[styles.postBtn, pal.btn]}>
<Text style={[pal.textLight, s.f16, s.bold]}>
<Trans context="action">Post</Trans>
</Text>
</View>
)}
<View style={[styles.postBtn, pal.btn]}>
<Text style={[pal.textLight, s.f16, s.bold]}>
<Trans context="action">Post</Trans>
</Text>
</View>
)}
</View>
@@ -758,22 +744,38 @@ export const ComposePost = ({
</Animated.ScrollView>
<SuggestedLanguage text={richtext.text} />
{replyTo ? null : (
<ThreadgateBtn
postgate={draft.postgate}
onChangePostgate={nextPostgate => {
dispatch({type: 'update_postgate', postgate: nextPostgate})
}}
threadgateAllowUISettings={draft.threadgate}
onChangeThreadgateAllowUISettings={nextThreadgate => {
dispatch({
type: 'update_threadgate',
threadgate: nextThreadgate,
})
}}
style={bottomBarAnimatedStyle}
/>
)}
<Animated.View
style={[a.flex_row, a.p_sm, t.atoms.bg, bottomBarAnimatedStyle]}>
<ScrollView
contentContainerStyle={[a.gap_sm]}
horizontal={true}
bounces={false}
showsHorizontalScrollIndicator={false}>
{replyTo ? null : (
<ThreadgateBtn
postgate={draft.postgate}
onChangePostgate={nextPostgate => {
dispatch({type: 'update_postgate', postgate: nextPostgate})
}}
threadgateAllowUISettings={draft.threadgate}
onChangeThreadgateAllowUISettings={nextThreadgate => {
dispatch({
type: 'update_threadgate',
threadgate: nextThreadgate,
})
}}
style={bottomBarAnimatedStyle}
/>
)}
<LabelsBtn
labels={draft.labels}
onChange={nextLabels => {
dispatch({type: 'update_labels', labels: nextLabels})
}}
hasMedia={hasMedia || Boolean(extLink)}
/>
</ScrollView>
</Animated.View>
<View
style={[
a.flex_row,
@@ -988,10 +990,6 @@ const styles = StyleSheet.create({
paddingVertical: 6,
marginLeft: 12,
},
postBtnWrapper: {
flexDirection: 'row',
gap: 14,
},
errorLine: {
flexDirection: 'row',
alignItems: 'center',
+29 -15
View File
@@ -3,7 +3,6 @@ import {Keyboard, View} from 'react-native'
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {ShieldExclamation} from '#/lib/icons'
import {
ADULT_CONTENT_LABELS,
AdultSelfLabel,
@@ -12,12 +11,14 @@ import {
SelfLabel,
} from '#/lib/moderation'
import {isWeb} from '#/platform/detection'
import {atoms as a, useTheme} from '#/alf'
import {Button, ButtonText} from '#/components/Button'
import {atoms as a, native, useTheme, web} from '#/alf'
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog'
import * as Toggle from '#/components/forms/Toggle'
import {Check_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check'
import {Shield_Stroke2_Corner0_Rounded} from '#/components/icons/Shield'
import {Text} from '#/components/Typography'
export function LabelsBtn({
labels,
hasMedia,
@@ -28,7 +29,6 @@ export function LabelsBtn({
onChange: (v: SelfLabel[]) => void
}) {
const control = Dialog.useDialogControl()
const t = useTheme()
const {_} = useLingui()
const hasLabel = labels.length > 0
@@ -52,20 +52,33 @@ export function LabelsBtn({
return (
<>
<Button
variant="solid"
color="secondary"
size="small"
testID="labelsBtn"
style={!hasMedia && {opacity: 0.4}}
onPress={() => {
Keyboard.dismiss()
control.open()
}}
label={_(msg`Content warnings`)}
accessibilityHint={_(
msg`Opens a dialog to add a content warning to your post`,
)}
onPress={() => {
Keyboard.dismiss()
control.open()
}}>
<ShieldExclamation style={{color: t.palette.primary_500}} size={24} />
{labels.length > 0 ? (
<Check size="sm" fill={t.palette.primary_500} />
) : null}
style={[
!hasMedia && {opacity: 0.5},
native({
paddingHorizontal: 8,
paddingVertical: 6,
}),
]}>
<ButtonIcon icon={hasLabel ? Check : Shield_Stroke2_Corner0_Rounded} />
<ButtonText numberOfLines={1}>
{labels.length > 0 ? (
<Trans>Labels added</Trans>
) : (
<Trans>Add labels</Trans>
)}
</ButtonText>
</Button>
<Dialog.Outer control={control} nativeOptions={{preventExpansion: true}}>
@@ -114,7 +127,8 @@ function DialogInner({
</Trans>
) : (
<Trans>
There are no self-labels that can be applied to this post.
No self-labels can be applied to this post because it contains
no media.
</Trans>
)}
</Text>
@@ -235,7 +249,7 @@ function DialogInner({
</View>
</View>
<View style={[a.mt_sm]}>
<View style={[a.mt_sm, web([a.flex_row, a.ml_auto])]}>
<Button
label={_(msg`Done`)}
onPress={() => control.close()}
@@ -1,13 +1,13 @@
import React from 'react'
import {Keyboard, StyleProp, ViewStyle} from 'react-native'
import Animated, {AnimatedStyle} from 'react-native-reanimated'
import {AnimatedStyle} from 'react-native-reanimated'
import {AppBskyFeedPostgate} from '@atproto/api'
import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {isNative} from '#/platform/detection'
import {ThreadgateAllowUISetting} from '#/state/queries/threadgate'
import {atoms as a, useTheme} from '#/alf'
import {native} from '#/alf'
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog'
import {PostInteractionSettingsControlledDialog} from '#/components/dialogs/PostInteractionSettingsDialog'
@@ -19,7 +19,6 @@ export function ThreadgateBtn({
onChangePostgate,
threadgateAllowUISettings,
onChangeThreadgateAllowUISettings,
style,
}: {
postgate: AppBskyFeedPostgate.Record
onChangePostgate: (v: AppBskyFeedPostgate.Record) => void
@@ -30,7 +29,6 @@ export function ThreadgateBtn({
style?: StyleProp<AnimatedStyle<ViewStyle>>
}) {
const {_} = useLingui()
const t = useTheme()
const control = Dialog.useDialogControl()
const onPress = () => {
@@ -53,24 +51,25 @@ export function ThreadgateBtn({
return (
<>
<Animated.View style={[a.flex_row, a.p_sm, t.atoms.bg, style]}>
<Button
variant="solid"
color="secondary"
size="small"
testID="openReplyGateButton"
onPress={onPress}
label={label}
accessibilityHint={_(
msg`Opens a dialog to choose who can reply to this thread`,
)}
style={
!isNative ? {paddingVertical: 6, paddingHorizontal: 8} : undefined
}>
<ButtonIcon icon={anyoneCanInteract ? Earth : Group} />
<ButtonText numberOfLines={1}>{label}</ButtonText>
</Button>
</Animated.View>
<Button
variant="solid"
color="secondary"
size="small"
testID="openReplyGateButton"
onPress={onPress}
label={label}
accessibilityHint={_(
msg`Opens a dialog to choose who can reply to this thread`,
)}
style={[
native({
paddingHorizontal: 8,
paddingVertical: 6,
}),
]}>
<ButtonIcon icon={anyoneCanInteract ? Earth : Group} />
<ButtonText numberOfLines={1}>{label}</ButtonText>
</Button>
<PostInteractionSettingsControlledDialog
control={control}
onSave={() => {