mirror of https://github.com/tooot-app/app
Remove conversation levels for now as it doesn't work well yet
This commit is contained in:
parent
8b20e186de
commit
4725287554
|
@ -6,6 +6,5 @@ Enjoy toooting! This version includes following improvements and fixes:
|
||||||
- Allow hiding boosts and replies in home timeline
|
- Allow hiding boosts and replies in home timeline
|
||||||
- Support toot in RTL languages
|
- Support toot in RTL languages
|
||||||
- Added notification for admins
|
- Added notification for admins
|
||||||
- Pilot conversation hierarchy
|
|
||||||
- Fix whole word filter matching
|
- Fix whole word filter matching
|
||||||
- Fix tablet cannot delete toot drafts
|
- Fix tablet cannot delete toot drafts
|
||||||
|
|
|
@ -6,6 +6,5 @@ toooting愉快!此版本包括以下改进和修复:
|
||||||
- 关注列表可隐藏转嘟和回复
|
- 关注列表可隐藏转嘟和回复
|
||||||
- 新增管理员推送通知
|
- 新增管理员推送通知
|
||||||
- 支持嘟文右到左文字
|
- 支持嘟文右到左文字
|
||||||
- 测试显示对话层级
|
|
||||||
- 修复过滤整词功能
|
- 修复过滤整词功能
|
||||||
- 修复平板不能删除草稿
|
- 修复平板不能删除草稿
|
||||||
|
|
|
@ -5,10 +5,8 @@ import { TabSharedStackScreenProps } from '@utils/navigation/navigators'
|
||||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||||
import React, { useEffect, useRef, useState } from 'react'
|
import React, { useEffect, useRef, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { FlatList, View } from 'react-native'
|
import { FlatList } from 'react-native'
|
||||||
import { InfiniteQueryObserver, useQueryClient } from '@tanstack/react-query'
|
import { InfiniteQueryObserver, useQueryClient } from '@tanstack/react-query'
|
||||||
import { StyleConstants } from '@utils/styles/constants'
|
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
|
||||||
|
|
||||||
const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||||
navigation,
|
navigation,
|
||||||
|
@ -16,7 +14,6 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||||
params: { toot, rootQueryKey }
|
params: { toot, rootQueryKey }
|
||||||
}
|
}
|
||||||
}) => {
|
}) => {
|
||||||
const { colors } = useTheme()
|
|
||||||
const { t } = useTranslation('screenTabs')
|
const { t } = useTranslation('screenTabs')
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -101,84 +98,94 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||||
queryKey={queryKey}
|
queryKey={queryKey}
|
||||||
queryOptions={{ staleTime: 0, refetchOnMount: true }}
|
queryOptions={{ staleTime: 0, refetchOnMount: true }}
|
||||||
customProps={{
|
customProps={{
|
||||||
renderItem: ({ item, index }) => {
|
renderItem: ({ item }) => {
|
||||||
const levels = {
|
|
||||||
previous:
|
|
||||||
replyLevels.current.find(
|
|
||||||
reply => reply.id === data.current?.[index - 1]?.in_reply_to_id
|
|
||||||
)?.level || 0,
|
|
||||||
current:
|
|
||||||
replyLevels.current.find(reply => reply.id === item.in_reply_to_id)?.level || 0,
|
|
||||||
next:
|
|
||||||
replyLevels.current.find(
|
|
||||||
reply => reply.id === data.current?.[index + 1]?.in_reply_to_id
|
|
||||||
)?.level || 0
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<TimelineDefault
|
||||||
<TimelineDefault
|
item={item}
|
||||||
item={item}
|
queryKey={queryKey}
|
||||||
queryKey={queryKey}
|
rootQueryKey={rootQueryKey}
|
||||||
rootQueryKey={rootQueryKey}
|
highlighted={toot.id === item.id}
|
||||||
highlighted={toot.id === item.id}
|
/>
|
||||||
isConversation={toot.id !== item.id}
|
|
||||||
/>
|
|
||||||
{Array.from(Array(levels.current)).map((_, i) => {
|
|
||||||
if (index < highlightIndex.current) return null
|
|
||||||
if (
|
|
||||||
levels.previous + 1 === levels.current ||
|
|
||||||
(levels.previous && levels.current && levels.previous === levels.current)
|
|
||||||
) {
|
|
||||||
return (
|
|
||||||
<View
|
|
||||||
key={i}
|
|
||||||
style={{
|
|
||||||
position: 'absolute',
|
|
||||||
top: 0,
|
|
||||||
left: StyleConstants.Spacing.Global.PagePadding / 2 + 8 * i,
|
|
||||||
height:
|
|
||||||
levels.current === levels.next
|
|
||||||
? StyleConstants.Spacing.Global.PagePadding
|
|
||||||
: StyleConstants.Spacing.Global.PagePadding + StyleConstants.Avatar.XS,
|
|
||||||
borderLeftColor: colors.border,
|
|
||||||
borderLeftWidth: 1
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
})}
|
|
||||||
{Array.from(Array(levels.next)).map((_, i) => {
|
|
||||||
if (index < highlightIndex.current) return null
|
|
||||||
if (
|
|
||||||
levels.current + 1 === levels.next ||
|
|
||||||
(levels.current && levels.next && levels.current === levels.next)
|
|
||||||
) {
|
|
||||||
return (
|
|
||||||
<View
|
|
||||||
key={i}
|
|
||||||
style={{
|
|
||||||
position: 'absolute',
|
|
||||||
top:
|
|
||||||
levels.current + 1 === levels.next && levels.next > i + 1
|
|
||||||
? StyleConstants.Spacing.Global.PagePadding + StyleConstants.Avatar.XS
|
|
||||||
: StyleConstants.Spacing.Global.PagePadding,
|
|
||||||
left: StyleConstants.Spacing.Global.PagePadding / 2 + 8 * i,
|
|
||||||
height: 200,
|
|
||||||
borderLeftColor: colors.border,
|
|
||||||
borderLeftWidth: 1
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
})}
|
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
// renderItem: ({ item, index }) => {
|
||||||
|
// const levels = {
|
||||||
|
// previous:
|
||||||
|
// replyLevels.current.find(
|
||||||
|
// reply => reply.id === data.current?.[index - 1]?.in_reply_to_id
|
||||||
|
// )?.level || 0,
|
||||||
|
// current:
|
||||||
|
// replyLevels.current.find(reply => reply.id === item.in_reply_to_id)?.level || 0,
|
||||||
|
// next:
|
||||||
|
// replyLevels.current.find(
|
||||||
|
// reply => reply.id === data.current?.[index + 1]?.in_reply_to_id
|
||||||
|
// )?.level || 0
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return (
|
||||||
|
// <>
|
||||||
|
// <TimelineDefault
|
||||||
|
// item={item}
|
||||||
|
// queryKey={queryKey}
|
||||||
|
// rootQueryKey={rootQueryKey}
|
||||||
|
// highlighted={toot.id === item.id}
|
||||||
|
// isConversation={toot.id !== item.id}
|
||||||
|
// />
|
||||||
|
// {Array.from(Array(levels.current)).map((_, i) => {
|
||||||
|
// if (index < highlightIndex.current) return null
|
||||||
|
// if (
|
||||||
|
// levels.previous + 1 === levels.current ||
|
||||||
|
// (levels.previous && levels.current && levels.previous === levels.current)
|
||||||
|
// ) {
|
||||||
|
// return (
|
||||||
|
// <View
|
||||||
|
// key={i}
|
||||||
|
// style={{
|
||||||
|
// position: 'absolute',
|
||||||
|
// top: 0,
|
||||||
|
// left: StyleConstants.Spacing.Global.PagePadding / 2 + 8 * i,
|
||||||
|
// height:
|
||||||
|
// levels.current === levels.next
|
||||||
|
// ? StyleConstants.Spacing.Global.PagePadding
|
||||||
|
// : StyleConstants.Spacing.Global.PagePadding + StyleConstants.Avatar.XS,
|
||||||
|
// borderLeftColor: colors.border,
|
||||||
|
// borderLeftWidth: 1
|
||||||
|
// }}
|
||||||
|
// />
|
||||||
|
// )
|
||||||
|
// } else {
|
||||||
|
// return null
|
||||||
|
// }
|
||||||
|
// })}
|
||||||
|
// {Array.from(Array(levels.next)).map((_, i) => {
|
||||||
|
// if (index < highlightIndex.current) return null
|
||||||
|
// if (
|
||||||
|
// levels.current + 1 === levels.next ||
|
||||||
|
// (levels.current && levels.next && levels.current === levels.next)
|
||||||
|
// ) {
|
||||||
|
// return (
|
||||||
|
// <View
|
||||||
|
// key={i}
|
||||||
|
// style={{
|
||||||
|
// position: 'absolute',
|
||||||
|
// top:
|
||||||
|
// levels.current + 1 === levels.next && levels.next > i + 1
|
||||||
|
// ? StyleConstants.Spacing.Global.PagePadding + StyleConstants.Avatar.XS
|
||||||
|
// : StyleConstants.Spacing.Global.PagePadding,
|
||||||
|
// left: StyleConstants.Spacing.Global.PagePadding / 2 + 8 * i,
|
||||||
|
// height: 200,
|
||||||
|
// borderLeftColor: colors.border,
|
||||||
|
// borderLeftWidth: 1
|
||||||
|
// }}
|
||||||
|
// />
|
||||||
|
// )
|
||||||
|
// } else {
|
||||||
|
// return null
|
||||||
|
// }
|
||||||
|
// })}
|
||||||
|
// </>
|
||||||
|
// )
|
||||||
|
// },
|
||||||
onScrollToIndexFailed: error => {
|
onScrollToIndexFailed: error => {
|
||||||
const offset = error.averageItemLength * error.index
|
const offset = error.averageItemLength * error.index
|
||||||
flRef.current?.scrollToOffset({ offset })
|
flRef.current?.scrollToOffset({ offset })
|
||||||
|
|
Loading…
Reference in New Issue