Skip to content

Commit

Permalink
fix: mf-5560 twitter toolbar DOM gets updated (#11050)
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleBill authored Oct 30, 2023
1 parent 827c09c commit 70dc506
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface PostDialogHintUIProps extends withClasses<'buttonTransform' | 'iconBut
const useStyles = makeStyles()((theme) => ({
button: {
// TODO: is it correct? (what about twitter?)
padding: isMobileFacebook ? 0 : '7px',
padding: isMobileFacebook ? 0 : '10px',
},
text: {
color: theme.palette.grey[300],
Expand All @@ -42,12 +42,12 @@ const ICON_MAP: Record<string, JSX.Element> = {
default: <Icons.SharpMask size={17} color={MaskColors.light.maskColor.publicTwitter} />,
}

const EntryIconButton = memo((props: PostDialogHintUIProps) => {
const EntryIconButton = memo(function EntryIconButton(props: PostDialogHintUIProps) {
const { t } = useMaskSharedTrans()
const { tooltip, disableGuideTip } = props
const { classes, cx } = useStyles(undefined, { props })

const getEntry = () => (
const Entry = (
<ShadowRootTooltip
title={t('mask_network')}
placement={tooltip?.placement}
Expand All @@ -66,10 +66,10 @@ const EntryIconButton = memo((props: PostDialogHintUIProps) => {
)

return disableGuideTip ? (
getEntry()
Entry
) : (
<GuideStep step={4} total={4} tip={t('user_guide_tip_4')} onComplete={props.onHintButtonClicked}>
{getEntry()}
{Entry}
</GuideStep>
)
})
Expand Down
6 changes: 4 additions & 2 deletions packages/mask/src/site-adaptors/twitter.com/utils/selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ export const postEditorContentInPopupSelector: () => LiveSelector<E, true> = ()
'[aria-labelledby="modal-header"] > div:first-child > div:first-child > div:first-child > div:nth-child(3)',
)
export const postEditorInPopupSelector: () => LiveSelector<E, true> = () =>
querySelector<E>('[aria-labelledby="modal-header"] div[data-testid="toolBar"] div[data-testid="geoButton"]')
querySelector<E>(
'[aria-labelledby="modal-header"] div[data-testid="toolBar"] [role="presentation"]:has(> div[data-testid="geoButton"])',
)
export const sideBarProfileSelector: () => LiveSelector<E, true> = () =>
querySelector<E>('[role="banner"] [role="navigation"] [data-testid="AppTabBar_Profile_Link"] > div')
export const postEditorInTimelineSelector: () => LiveSelector<E, true> = () =>
Expand Down Expand Up @@ -267,7 +269,7 @@ export const searchTwitterAvatarNFTLinkSelector = () => querySelector<E>('a[href

export const searchReplyToolbarSelector = () =>
querySelector<E>('div[data-testid="primaryColumn"] div[data-testid="toolBar"]').querySelector<E>(
'div[data-testid="geoButton"]',
'[role="presentation"]:has(> div[data-testid="geoButton"])',
)

// nameTag dom
Expand Down

0 comments on commit 70dc506

Please sign in to comment.