reorg files again
This commit is contained in:
+11
-11
@@ -8,14 +8,14 @@ import {Button, type ButtonProps} from '#/components/Button'
|
||||
import {type Props as SVGIconProps} from '#/components/icons/common'
|
||||
import {Text, type TextProps} from '#/components/Typography'
|
||||
|
||||
const PostCtrlContext = React.createContext<{
|
||||
const PostControlContext = React.createContext<{
|
||||
big?: boolean
|
||||
active?: boolean
|
||||
color?: {color: string}
|
||||
}>({})
|
||||
|
||||
// Base button style, which the the other ones extend
|
||||
export const PostCtrlButton = React.forwardRef<
|
||||
export const PostControlButton = React.forwardRef<
|
||||
View,
|
||||
ButtonProps & {
|
||||
active?: boolean
|
||||
@@ -83,33 +83,33 @@ export const PostCtrlButton = React.forwardRef<
|
||||
{...props}>
|
||||
{typeof children === 'function' ? (
|
||||
args => (
|
||||
<PostCtrlContext.Provider value={ctx}>
|
||||
<PostControlContext.Provider value={ctx}>
|
||||
{children(args)}
|
||||
</PostCtrlContext.Provider>
|
||||
</PostControlContext.Provider>
|
||||
)
|
||||
) : (
|
||||
<PostCtrlContext.Provider value={ctx}>
|
||||
<PostControlContext.Provider value={ctx}>
|
||||
{children}
|
||||
</PostCtrlContext.Provider>
|
||||
</PostControlContext.Provider>
|
||||
)}
|
||||
</Button>
|
||||
)
|
||||
},
|
||||
)
|
||||
PostCtrlButton.displayName = 'PostCtrlButton'
|
||||
PostControlButton.displayName = 'PostControlButton'
|
||||
|
||||
export function PostCtrlButtonIcon({
|
||||
export function PostControlButtonIcon({
|
||||
icon: Comp,
|
||||
}: {
|
||||
icon: React.ComponentType<SVGIconProps>
|
||||
}) {
|
||||
const {big, color} = useContext(PostCtrlContext)
|
||||
const {big, color} = useContext(PostControlContext)
|
||||
|
||||
return <Comp style={[color, a.pointer_events_none]} width={big ? 22 : 18} />
|
||||
}
|
||||
|
||||
export function PostCtrlButtonText({style, ...props}: TextProps) {
|
||||
const {big, active, color} = useContext(PostCtrlContext)
|
||||
export function PostControlButtonText({style, ...props}: TextProps) {
|
||||
const {big, active, color} = useContext(PostControlContext)
|
||||
|
||||
return (
|
||||
<Text
|
||||
+4
-4
@@ -14,7 +14,7 @@ import {EventStopper} from '#/view/com/util/EventStopper'
|
||||
import {DotGrid_Stroke2_Corner0_Rounded as DotsHorizontal} from '#/components/icons/DotGrid'
|
||||
import {useMenuControl} from '#/components/Menu'
|
||||
import * as Menu from '#/components/Menu'
|
||||
import {PostCtrlButton, PostCtrlButtonIcon} from './PostCtrlButton'
|
||||
import {PostControlButton, PostControlButtonIcon} from '../PostControlButton'
|
||||
import {PostMenuItems} from './PostMenuItems'
|
||||
|
||||
let PostMenuButton = ({
|
||||
@@ -62,13 +62,13 @@ let PostMenuButton = ({
|
||||
<Menu.Trigger label={_(msg`Open post options menu`)}>
|
||||
{({props}) => {
|
||||
return (
|
||||
<PostCtrlButton
|
||||
<PostControlButton
|
||||
testID="postDropdownBtn"
|
||||
big={big}
|
||||
label={props.accessibilityLabel}
|
||||
{...props}>
|
||||
<PostCtrlButtonIcon icon={DotsHorizontal} />
|
||||
</PostCtrlButton>
|
||||
<PostControlButtonIcon icon={DotsHorizontal} />
|
||||
</PostControlButton>
|
||||
)
|
||||
}}
|
||||
</Menu.Trigger>
|
||||
+9
-9
@@ -13,10 +13,10 @@ import {CloseQuote_Stroke2_Corner1_Rounded as Quote} from '#/components/icons/Qu
|
||||
import {Repost_Stroke2_Corner2_Rounded as Repost} from '#/components/icons/Repost'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {
|
||||
PostCtrlButton,
|
||||
PostCtrlButtonIcon,
|
||||
PostCtrlButtonText,
|
||||
} from './PostCtrlButton'
|
||||
PostControlButton,
|
||||
PostControlButtonIcon,
|
||||
PostControlButtonText,
|
||||
} from './PostControlButton'
|
||||
|
||||
interface Props {
|
||||
isReposted: boolean
|
||||
@@ -42,7 +42,7 @@ let RepostButton = ({
|
||||
|
||||
return (
|
||||
<>
|
||||
<PostCtrlButton
|
||||
<PostControlButton
|
||||
testID="repostBtn"
|
||||
active={isReposted}
|
||||
activeColor={t.palette.positive_600}
|
||||
@@ -64,13 +64,13 @@ let RepostButton = ({
|
||||
})})`,
|
||||
)
|
||||
}>
|
||||
<PostCtrlButtonIcon icon={Repost} />
|
||||
<PostControlButtonIcon icon={Repost} />
|
||||
{typeof repostCount !== 'undefined' && repostCount > 0 && (
|
||||
<PostCtrlButtonText testID="repostCount">
|
||||
<PostControlButtonText testID="repostCount">
|
||||
{formatCount(i18n, repostCount)}
|
||||
</PostCtrlButtonText>
|
||||
</PostControlButtonText>
|
||||
)}
|
||||
</PostCtrlButton>
|
||||
</PostControlButton>
|
||||
<Dialog.Outer
|
||||
control={dialogControl}
|
||||
nativeOptions={{preventExpansion: true}}>
|
||||
+14
-14
@@ -10,10 +10,10 @@ import {CloseQuote_Stroke2_Corner1_Rounded as Quote} from '#/components/icons/Qu
|
||||
import {Repost_Stroke2_Corner2_Rounded as Repost} from '#/components/icons/Repost'
|
||||
import * as Menu from '#/components/Menu'
|
||||
import {
|
||||
PostCtrlButton,
|
||||
PostCtrlButtonIcon,
|
||||
PostCtrlButtonText,
|
||||
} from './PostCtrlButton'
|
||||
PostControlButton,
|
||||
PostControlButtonIcon,
|
||||
PostControlButtonText,
|
||||
} from './PostControlButton'
|
||||
|
||||
interface Props {
|
||||
isReposted: boolean
|
||||
@@ -43,20 +43,20 @@ export const RepostButton = ({
|
||||
<Menu.Trigger label={_(msg`Repost or quote post`)}>
|
||||
{({props}) => {
|
||||
return (
|
||||
<PostCtrlButton
|
||||
<PostControlButton
|
||||
testID="repostBtn"
|
||||
active={isReposted}
|
||||
activeColor={t.palette.positive_600}
|
||||
label={props.accessibilityLabel}
|
||||
big={big}
|
||||
{...props}>
|
||||
<PostCtrlButtonIcon icon={Repost} />
|
||||
<PostControlButtonIcon icon={Repost} />
|
||||
{typeof repostCount !== 'undefined' && repostCount > 0 && (
|
||||
<PostCtrlButtonText testID="repostCount">
|
||||
<PostControlButtonText testID="repostCount">
|
||||
{formatCount(i18n, repostCount)}
|
||||
</PostCtrlButtonText>
|
||||
</PostControlButtonText>
|
||||
)}
|
||||
</PostCtrlButton>
|
||||
</PostControlButton>
|
||||
)
|
||||
}}
|
||||
</Menu.Trigger>
|
||||
@@ -90,18 +90,18 @@ export const RepostButton = ({
|
||||
</Menu.Root>
|
||||
</EventStopper>
|
||||
) : (
|
||||
<PostCtrlButton
|
||||
<PostControlButton
|
||||
onPress={() => requireAuth(() => {})}
|
||||
active={isReposted}
|
||||
activeColor={t.palette.positive_600}
|
||||
label={_(msg`Repost or quote post`)}
|
||||
big={big}>
|
||||
<PostCtrlButtonIcon icon={Repost} />
|
||||
<PostControlButtonIcon icon={Repost} />
|
||||
{typeof repostCount !== 'undefined' && repostCount > 0 && (
|
||||
<PostCtrlButtonText testID="repostCount">
|
||||
<PostControlButtonText testID="repostCount">
|
||||
{formatCount(i18n, repostCount)}
|
||||
</PostCtrlButtonText>
|
||||
</PostControlButtonText>
|
||||
)}
|
||||
</PostCtrlButton>
|
||||
</PostControlButton>
|
||||
)
|
||||
}
|
||||
+4
-4
@@ -14,7 +14,7 @@ import {EventStopper} from '#/view/com/util/EventStopper'
|
||||
import {ArrowOutOfBox_Stroke2_Corner0_Rounded as ArrowOutOfBoxIcon} from '#/components/icons/ArrowOutOfBox'
|
||||
import {useMenuControl} from '#/components/Menu'
|
||||
import * as Menu from '#/components/Menu'
|
||||
import {PostCtrlButton, PostCtrlButtonIcon} from './PostCtrlButton'
|
||||
import {PostControlButton, PostControlButtonIcon} from '../PostControlButton'
|
||||
import {ShareMenuItems} from './ShareMenuItems'
|
||||
|
||||
let ShareMenuButton = ({
|
||||
@@ -58,13 +58,13 @@ let ShareMenuButton = ({
|
||||
<Menu.Trigger label={_(msg`Open share menu`)}>
|
||||
{({props}) => {
|
||||
return (
|
||||
<PostCtrlButton
|
||||
<PostControlButton
|
||||
testID="postShareBtn"
|
||||
big={big}
|
||||
label={props.accessibilityLabel}
|
||||
{...props}>
|
||||
<PostCtrlButtonIcon icon={ArrowOutOfBoxIcon} />
|
||||
</PostCtrlButton>
|
||||
<PostControlButtonIcon icon={ArrowOutOfBoxIcon} />
|
||||
</PostControlButton>
|
||||
)
|
||||
}}
|
||||
</Menu.Trigger>
|
||||
@@ -34,15 +34,15 @@ import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
|
||||
import {Bubble_Stroke2_Corner2_Rounded as Bubble} from '#/components/icons/Bubble'
|
||||
import {
|
||||
PostCtrlButton,
|
||||
PostCtrlButtonIcon,
|
||||
PostCtrlButtonText,
|
||||
} from './PostCtrlButton'
|
||||
import {PostMenuButton} from './PostMenuButton'
|
||||
PostControlButton,
|
||||
PostControlButtonIcon,
|
||||
PostControlButtonText,
|
||||
} from './PostControlButton'
|
||||
import {PostMenuButton} from './PostMenu'
|
||||
import {RepostButton} from './RepostButton'
|
||||
import {ShareMenuButton} from './ShareMenuButton'
|
||||
import {ShareMenuButton} from './ShareMenu'
|
||||
|
||||
let PostCtrls = ({
|
||||
let PostControls = ({
|
||||
big,
|
||||
post,
|
||||
record,
|
||||
@@ -194,7 +194,7 @@ let PostCtrls = ({
|
||||
big ? a.align_center : [a.flex_1, a.align_start, {marginLeft: -6}],
|
||||
replyDisabled ? {opacity: 0.5} : undefined,
|
||||
]}>
|
||||
<PostCtrlButton
|
||||
<PostControlButton
|
||||
testID="replyBtn"
|
||||
onPress={
|
||||
!replyDisabled ? () => requireAuth(() => onPressReply()) : undefined
|
||||
@@ -206,13 +206,13 @@ let PostCtrls = ({
|
||||
})})`,
|
||||
)}
|
||||
big={big}>
|
||||
<PostCtrlButtonIcon icon={Bubble} />
|
||||
<PostControlButtonIcon icon={Bubble} />
|
||||
{typeof post.replyCount !== 'undefined' && post.replyCount > 0 && (
|
||||
<PostCtrlButtonText>
|
||||
<PostControlButtonText>
|
||||
{formatCount(i18n, post.replyCount)}
|
||||
</PostCtrlButtonText>
|
||||
</PostControlButtonText>
|
||||
)}
|
||||
</PostCtrlButton>
|
||||
</PostControlButton>
|
||||
</View>
|
||||
<View style={big ? a.align_center : [a.flex_1, a.align_start]}>
|
||||
<RepostButton
|
||||
@@ -225,7 +225,7 @@ let PostCtrls = ({
|
||||
/>
|
||||
</View>
|
||||
<View style={big ? a.align_center : [a.flex_1, a.align_start]}>
|
||||
<PostCtrlButton
|
||||
<PostControlButton
|
||||
testID="likeBtn"
|
||||
big={big}
|
||||
onPress={() => requireAuth(() => onPressToggleLike())}
|
||||
@@ -255,7 +255,7 @@ let PostCtrls = ({
|
||||
isLiked={Boolean(post.viewer?.like)}
|
||||
hasBeenToggled={hasLikeIconBeenToggled}
|
||||
/>
|
||||
</PostCtrlButton>
|
||||
</PostControlButton>
|
||||
</View>
|
||||
<View
|
||||
style={
|
||||
@@ -314,5 +314,5 @@ let PostCtrls = ({
|
||||
</View>
|
||||
)
|
||||
}
|
||||
PostCtrls = memo(PostCtrls)
|
||||
export {PostCtrls}
|
||||
PostControls = memo(PostControls)
|
||||
export {PostControls}
|
||||
@@ -96,7 +96,7 @@ import * as Layout from '#/components/Layout'
|
||||
import {Link} from '#/components/Link'
|
||||
import {ListFooter} from '#/components/Lists'
|
||||
import * as Hider from '#/components/moderation/Hider'
|
||||
import {PostCtrls} from '#/components/post-ctrls/PostCtrls'
|
||||
import {PostControls} from '#/components/PostControls'
|
||||
import {RichText} from '#/components/RichText'
|
||||
import {Text} from '#/components/Typography'
|
||||
import * as bsky from '#/types/bsky'
|
||||
@@ -861,7 +861,7 @@ function Overlay({
|
||||
)}
|
||||
{record && (
|
||||
<View style={[{left: -5}]}>
|
||||
<PostCtrls
|
||||
<PostControls
|
||||
richText={richText}
|
||||
post={post}
|
||||
record={record}
|
||||
|
||||
@@ -59,7 +59,7 @@ import {LabelsOnMyPost} from '#/components/moderation/LabelsOnMe'
|
||||
import {PostAlerts} from '#/components/moderation/PostAlerts'
|
||||
import {PostHider} from '#/components/moderation/PostHider'
|
||||
import {type AppModerationCause} from '#/components/Pills'
|
||||
import {PostCtrls} from '#/components/post-ctrls/PostCtrls'
|
||||
import {PostControls} from '#/components/PostControls'
|
||||
import * as Prompt from '#/components/Prompt'
|
||||
import {RichText} from '#/components/RichText'
|
||||
import {SubtleWebHover} from '#/components/SubtleWebHover'
|
||||
@@ -494,7 +494,7 @@ let PostThreadItemLoaded = ({
|
||||
marginLeft: -5,
|
||||
},
|
||||
]}>
|
||||
<PostCtrls
|
||||
<PostControls
|
||||
big
|
||||
post={post}
|
||||
record={record}
|
||||
@@ -642,7 +642,7 @@ let PostThreadItemLoaded = ({
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
<PostCtrls
|
||||
<PostControls
|
||||
post={post}
|
||||
record={record}
|
||||
richText={richText}
|
||||
|
||||
@@ -37,7 +37,7 @@ import {atoms as a} from '#/alf'
|
||||
import {ContentHider} from '#/components/moderation/ContentHider'
|
||||
import {LabelsOnMyPost} from '#/components/moderation/LabelsOnMe'
|
||||
import {PostAlerts} from '#/components/moderation/PostAlerts'
|
||||
import {PostCtrls} from '#/components/post-ctrls/PostCtrls'
|
||||
import {PostControls} from '#/components/PostControls'
|
||||
import {ProfileHoverCard} from '#/components/ProfileHoverCard'
|
||||
import {RichText} from '#/components/RichText'
|
||||
import {SubtleWebHover} from '#/components/SubtleWebHover'
|
||||
@@ -255,7 +255,7 @@ function PostInner({
|
||||
/>
|
||||
) : null}
|
||||
</ContentHider>
|
||||
<PostCtrls
|
||||
<PostControls
|
||||
post={post}
|
||||
record={record}
|
||||
richText={richText}
|
||||
|
||||
@@ -48,7 +48,7 @@ import {ContentHider} from '#/components/moderation/ContentHider'
|
||||
import {LabelsOnMyPost} from '#/components/moderation/LabelsOnMe'
|
||||
import {PostAlerts} from '#/components/moderation/PostAlerts'
|
||||
import {type AppModerationCause} from '#/components/Pills'
|
||||
import {PostCtrls} from '#/components/post-ctrls/PostCtrls'
|
||||
import {PostControls} from '#/components/PostControls'
|
||||
import {ProfileHoverCard} from '#/components/ProfileHoverCard'
|
||||
import {RichText} from '#/components/RichText'
|
||||
import {SubtleWebHover} from '#/components/SubtleWebHover'
|
||||
@@ -439,7 +439,7 @@ let FeedItemInner = ({
|
||||
post={post}
|
||||
threadgateRecord={threadgateRecord}
|
||||
/>
|
||||
<PostCtrls
|
||||
<PostControls
|
||||
post={post}
|
||||
record={record}
|
||||
richText={richText}
|
||||
|
||||
Reference in New Issue
Block a user