This commit is contained in:
Zhiyuan Zheng 2021-03-14 01:35:38 +01:00
parent 5fe6cd59f9
commit b21f1b5a0e
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
5 changed files with 51 additions and 3 deletions

View File

@ -17,6 +17,7 @@ import { uniqBy } from 'lodash'
import React, { useCallback } from 'react' import React, { useCallback } from 'react'
import { Pressable, StyleSheet, View } from 'react-native' import { Pressable, StyleSheet, View } from 'react-native'
import { useSelector } from 'react-redux' import { useSelector } from 'react-redux'
import TimelineFullConversation from './Shared/FullConversation'
export interface Props { export interface Props {
item: Mastodon.Status & { _pinned?: boolean } // For account page, internal property item: Mastodon.Status & { _pinned?: boolean } // For account page, internal property
@ -124,6 +125,7 @@ const TimelineDefault: React.FC<Props> = ({
{!disableDetails && actualStatus.card && ( {!disableDetails && actualStatus.card && (
<TimelineCard card={actualStatus.card} /> <TimelineCard card={actualStatus.card} />
)} )}
<TimelineFullConversation status={actualStatus} />
</View> </View>
{queryKey && !disableDetails && ( {queryKey && !disableDetails && (

View File

@ -17,6 +17,7 @@ import { uniqBy } from 'lodash'
import React, { useCallback } from 'react' import React, { useCallback } from 'react'
import { Pressable, StyleSheet, View } from 'react-native' import { Pressable, StyleSheet, View } from 'react-native'
import { useSelector } from 'react-redux' import { useSelector } from 'react-redux'
import TimelineFullConversation from './Shared/FullConversation'
export interface Props { export interface Props {
notification: Mastodon.Notification notification: Mastodon.Notification
@ -52,7 +53,15 @@ const TimelineNotifications: React.FC<Props> = ({
return ( return (
<Pressable <Pressable
style={[styles.notificationView, { backgroundColor: theme.background }]} style={[
styles.notificationView,
{
backgroundColor: theme.background,
paddingBottom: notification.status
? 0
: StyleConstants.Spacing.Global.PagePadding
}
]}
onPress={onPress} onPress={onPress}
> >
{notification.type !== 'mention' ? ( {notification.type !== 'mention' ? (
@ -112,6 +121,7 @@ const TimelineNotifications: React.FC<Props> = ({
{notification.status.card && ( {notification.status.card && (
<TimelineCard card={notification.status.card} /> <TimelineCard card={notification.status.card} />
)} )}
<TimelineFullConversation status={notification.status} />
</View> </View>
) : null} ) : null}
</View> </View>
@ -144,8 +154,7 @@ const TimelineNotifications: React.FC<Props> = ({
const styles = StyleSheet.create({ const styles = StyleSheet.create({
notificationView: { notificationView: {
padding: StyleConstants.Spacing.Global.PagePadding, padding: StyleConstants.Spacing.Global.PagePadding
paddingBottom: 0
}, },
header: { header: {
flex: 1, flex: 1,

View File

@ -0,0 +1,35 @@
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { Text } from 'react-native'
export interface Props {
status: Mastodon.Status
}
const TimelineFullConversation = React.memo(
({ status }: Props) => {
const { t } = useTranslation('componentTimeline')
const { theme } = useTheme()
return status.in_reply_to_account_id &&
(status.mentions.length === 0 ||
status.mentions.filter(
mention => mention.id !== status.in_reply_to_account_id
).length) ? (
<Text
style={{
...StyleConstants.FontStyle.M,
color: theme.blue,
marginTop: StyleConstants.Font.Size.M / 2
}}
>
{t('shared.fullConversation')}
</Text>
) : null
},
() => true
)
export default TimelineFullConversation

View File

@ -51,6 +51,7 @@ export default {
content: { content: {
expandHint: 'hidden content' expandHint: 'hidden content'
}, },
fullConversation: 'Read conversations',
header: { header: {
shared: { shared: {
application: 'Tooted with {{application}}' application: 'Tooted with {{application}}'

View File

@ -51,6 +51,7 @@ export default {
content: { content: {
expandHint: '隐藏内容' expandHint: '隐藏内容'
}, },
fullConversation: '阅读全部对话',
header: { header: {
shared: { shared: {
application: '发自于 {{application}}' application: '发自于 {{application}}'