move handle below display name
This commit is contained in:
@@ -603,6 +603,7 @@ const styles = StyleSheet.create({
|
|||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
flexWrap: 'wrap',
|
flexWrap: 'wrap',
|
||||||
|
paddingTop: 4,
|
||||||
paddingBottom: 2,
|
paddingBottom: 2,
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import {precacheProfile} from '#/state/queries/profile'
|
|||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
import {makeProfileLink} from 'lib/routes/links'
|
import {makeProfileLink} from 'lib/routes/links'
|
||||||
import {forceLTR} from 'lib/strings/bidi'
|
import {forceLTR} from 'lib/strings/bidi'
|
||||||
import {NON_BREAKING_SPACE} from 'lib/strings/constants'
|
|
||||||
import {sanitizeDisplayName} from 'lib/strings/display-names'
|
import {sanitizeDisplayName} from 'lib/strings/display-names'
|
||||||
import {sanitizeHandle} from 'lib/strings/handles'
|
import {sanitizeHandle} from 'lib/strings/handles'
|
||||||
import {niceDate} from 'lib/strings/time'
|
import {niceDate} from 'lib/strings/time'
|
||||||
import {TypographyVariant} from 'lib/ThemeContext'
|
import {TypographyVariant} from 'lib/ThemeContext'
|
||||||
import {isAndroid} from 'platform/detection'
|
import {isAndroid} from 'platform/detection'
|
||||||
|
import {atoms as a} from '#/alf'
|
||||||
import {ProfileHoverCard} from '#/components/ProfileHoverCard'
|
import {ProfileHoverCard} from '#/components/ProfileHoverCard'
|
||||||
import {TextLinkOnWebOnly} from './Link'
|
import {TextLinkOnWebOnly} from './Link'
|
||||||
import {Text} from './text/Text'
|
import {Text} from './text/Text'
|
||||||
@@ -39,8 +39,11 @@ let PostMeta = (opts: PostMetaOpts): React.ReactNode => {
|
|||||||
const {i18n} = useLingui()
|
const {i18n} = useLingui()
|
||||||
|
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const displayName = opts.author.displayName || opts.author.handle
|
const displayName = sanitizeDisplayName(
|
||||||
const handle = opts.author.handle
|
opts.author.displayName || opts.author.handle,
|
||||||
|
opts.moderation?.ui('displayName'),
|
||||||
|
)
|
||||||
|
const handle = sanitizeHandle(opts.author.handle, '@')
|
||||||
const profileLink = makeProfileLink(opts.author)
|
const profileLink = makeProfileLink(opts.author)
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const onOpenAuthor = opts.onOpenAuthor
|
const onOpenAuthor = opts.onOpenAuthor
|
||||||
@@ -53,7 +56,8 @@ let PostMeta = (opts: PostMetaOpts): React.ReactNode => {
|
|||||||
}, [queryClient, opts.author])
|
}, [queryClient, opts.author])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.container, opts.style]}>
|
<View style={[a.flex_1, a.flex_col, {gap: 1}]}>
|
||||||
|
<View style={[a.flex_row, a.align_end, a.gap_xs, opts.style]}>
|
||||||
{opts.showAvatar && (
|
{opts.showAvatar && (
|
||||||
<View style={styles.avatar}>
|
<View style={styles.avatar}>
|
||||||
<PreviewableUserAvatar
|
<PreviewableUserAvatar
|
||||||
@@ -82,15 +86,6 @@ let PostMeta = (opts: PostMetaOpts): React.ReactNode => {
|
|||||||
href={profileLink}
|
href={profileLink}
|
||||||
onBeforePress={onBeforePressAuthor}
|
onBeforePress={onBeforePressAuthor}
|
||||||
/>
|
/>
|
||||||
<TextLinkOnWebOnly
|
|
||||||
type="md"
|
|
||||||
disableMismatchWarning
|
|
||||||
style={[pal.textLight, {flexShrink: 4}]}
|
|
||||||
text={NON_BREAKING_SPACE + sanitizeHandle(handle, '@')}
|
|
||||||
href={profileLink}
|
|
||||||
onBeforePress={onBeforePressAuthor}
|
|
||||||
anchorNoUnderline
|
|
||||||
/>
|
|
||||||
</Text>
|
</Text>
|
||||||
</ProfileHoverCard>
|
</ProfileHoverCard>
|
||||||
{!isAndroid && (
|
{!isAndroid && (
|
||||||
@@ -113,20 +108,22 @@ let PostMeta = (opts: PostMetaOpts): React.ReactNode => {
|
|||||||
)}
|
)}
|
||||||
</TimeElapsed>
|
</TimeElapsed>
|
||||||
</View>
|
</View>
|
||||||
|
<TextLinkOnWebOnly
|
||||||
|
type="md"
|
||||||
|
disableMismatchWarning
|
||||||
|
style={[pal.textLight]}
|
||||||
|
text={handle}
|
||||||
|
href={profileLink}
|
||||||
|
onBeforePress={onBeforePressAuthor}
|
||||||
|
anchorNoUnderline
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
PostMeta = memo(PostMeta)
|
PostMeta = memo(PostMeta)
|
||||||
export {PostMeta}
|
export {PostMeta}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
|
||||||
flexDirection: 'row',
|
|
||||||
alignItems: 'flex-end',
|
|
||||||
paddingBottom: 2,
|
|
||||||
gap: 4,
|
|
||||||
zIndex: 1,
|
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
avatar: {
|
avatar: {
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user