Fixed notification

This commit is contained in:
Zhiyuan Zheng 2020-12-30 11:52:47 +01:00
parent c9726d904f
commit 3e3ae67155
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
4 changed files with 62 additions and 58 deletions

View File

@ -55,45 +55,54 @@ const TimelineNotifications: React.FC<Props> = ({
notification
/>
<View style={styles.header}>
<TimelineAvatar queryKey={queryKey} account={actualAccount} />
<TimelineHeaderNotification notification={notification} />
</View>
{notification.status ? (
<View
style={{
paddingTop: highlighted ? StyleConstants.Spacing.S : 0,
paddingLeft: highlighted
? 0
: StyleConstants.Avatar.M + StyleConstants.Spacing.S
}}
>
{notification.status.content.length > 0 && (
<TimelineContent
status={notification.status}
highlighted={highlighted}
/>
)}
{notification.status.poll && (
<TimelinePoll
queryKey={queryKey}
poll={notification.status.poll}
reblog={false}
sameAccount={notification.account.id === localAccountId}
/>
)}
{notification.status.media_attachments.length > 0 && (
<TimelineAttachment
status={notification.status}
contentWidth={contentWidth}
/>
)}
{notification.status.card && (
<TimelineCard card={notification.status.card} />
)}
<View
style={{
opacity:
notification.type === 'follow' || notification.type === 'mention'
? 1
: 0.5
}}
>
<View style={styles.header}>
<TimelineAvatar queryKey={queryKey} account={actualAccount} />
<TimelineHeaderNotification notification={notification} />
</View>
) : null}
{notification.status ? (
<View
style={{
paddingTop: highlighted ? StyleConstants.Spacing.S : 0,
paddingLeft: highlighted
? 0
: StyleConstants.Avatar.M + StyleConstants.Spacing.S
}}
>
{notification.status.content.length > 0 && (
<TimelineContent
status={notification.status}
highlighted={highlighted}
/>
)}
{notification.status.poll && (
<TimelinePoll
queryKey={queryKey}
poll={notification.status.poll}
reblog={false}
sameAccount={notification.account.id === localAccountId}
/>
)}
{notification.status.media_attachments.length > 0 && (
<TimelineAttachment
status={notification.status}
contentWidth={contentWidth}
/>
)}
{notification.status.card && (
<TimelineCard card={notification.status.card} />
)}
</View>
) : null}
</View>
{notification.status && (
<View

View File

@ -62,7 +62,7 @@ const TimelineActioned: React.FC<Props> = ({
<Feather
name='bar-chart-2'
size={StyleConstants.Font.Size.S}
color='black'
color={iconColor}
style={styles.icon}
/>
)
@ -87,11 +87,7 @@ const TimelineActioned: React.FC<Props> = ({
{content && (
<View style={styles.content}>
{account.emojis ? (
<Emojis
content={content}
emojis={account.emojis}
size='S'
/>
<Emojis content={content} emojis={account.emojis} size='S' />
) : (
<Text>{content}</Text>
)}

View File

@ -134,7 +134,8 @@ const styles = StyleSheet.create({
width: '80%'
},
name: {
flexDirection: 'row'
flexDirection: 'row',
alignItems: 'center'
},
account: {
flexShrink: 1,

View File

@ -17,10 +17,12 @@ export interface Props {
}
const TimelineHeaderNotification: React.FC<Props> = ({ notification }) => {
const name =
notification.account.display_name || notification.account.username
const emojis = notification.account.emojis
const account = notification.account.acct
const actualAccount = notification.status
? notification.status.account
: notification.account
const name = actualAccount.display_name || actualAccount.username
const emojis = actualAccount.emojis
const account = actualAccount.acct
const { theme } = useTheme()
const [since, setSince] = useState(relativeTime(notification.created_at))
@ -123,14 +125,9 @@ const TimelineHeaderNotification: React.FC<Props> = ({ notification }) => {
return (
<View style={styles.base}>
<View style={styles.nameAndMeta}>
<View style={styles.name}>
<View style={styles.nameAndAccount}>
{emojis?.length ? (
<Emojis
content={name}
emojis={emojis}
size='M'
fontBold={true}
/>
<Emojis content={name} emojis={emojis} size='M' fontBold={true} />
) : (
<Text
numberOfLines={1}
@ -190,8 +187,9 @@ const styles = StyleSheet.create({
nameAndMeta: {
width: '80%'
},
name: {
flexDirection: 'row'
nameAndAccount: {
flexDirection: 'row',
alignItems: 'center'
},
nameWithoutEmoji: {
...StyleConstants.FontStyle.M,