1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Continue to improve #535

This commit is contained in:
xmflsct
2022-12-12 23:57:07 +01:00
parent 17d4245cd9
commit 6e8515d820
6 changed files with 134 additions and 42 deletions

View File

@ -28,18 +28,18 @@ import TimelineHeaderAndroid from './Shared/HeaderAndroid'
export interface Props {
notification: Mastodon.Notification
queryKey: QueryKeyTimeline
highlighted?: boolean
}
const TimelineNotifications: React.FC<Props> = ({
notification,
queryKey,
highlighted = false
}) => {
const TimelineNotifications: React.FC<Props> = ({ notification, queryKey }) => {
const instanceAccount = useSelector(getInstanceAccount, () => true)
const status = notification.status?.reblog ? notification.status.reblog : notification.status
const account = notification.status ? notification.status.account : notification.account
const account =
notification.type === 'admin.report'
? notification.report.target_account
: notification.status
? notification.status.account
: notification.account
const ownAccount = notification.account?.id === instanceAccount?.id
const [spoilerExpanded, setSpoilerExpanded] = useState(
instanceAccount.preferences['reading:expand:spoilers'] || false
@ -91,7 +91,8 @@ const TimelineNotifications: React.FC<Props> = ({
notification.type === 'follow' ||
notification.type === 'follow_request' ||
notification.type === 'mention' ||
notification.type === 'status'
notification.type === 'status' ||
notification.type === 'admin.sign_up'
? 1
: 0.5
}}
@ -102,12 +103,7 @@ const TimelineNotifications: React.FC<Props> = ({
</View>
{notification.status ? (
<View
style={{
paddingTop: highlighted ? StyleConstants.Spacing.S : 0,
paddingLeft: highlighted ? 0 : StyleConstants.Avatar.M + StyleConstants.Spacing.S
}}
>
<View style={{ paddingLeft: StyleConstants.Avatar.M + StyleConstants.Spacing.S }}>
<TimelineContent
notificationOwnToot={['favourite', 'reblog'].includes(notification.type)}
setSpoilerExpanded={setSpoilerExpanded}
@ -141,8 +137,7 @@ const TimelineNotifications: React.FC<Props> = ({
status,
ownAccount,
spoilerHidden,
copiableContent,
highlighted
copiableContent
}}
>
<ContextMenu.Root>