reorg files again

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