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

Believe #638 can be closed now!

This commit is contained in:
xmflsct
2023-01-04 22:39:29 +01:00
parent 62a6594f91
commit 06324ee51a
34 changed files with 278 additions and 346 deletions

View File

@ -1,10 +1,19 @@
import { BottomTabScreenProps } from '@react-navigation/bottom-tabs'
import { NavigatorScreenParams } from '@react-navigation/native'
import { NavigatorScreenParams, useNavigationState } from '@react-navigation/native'
import { NativeStackScreenProps } from '@react-navigation/native-stack'
import { StackNavigationProp } from '@react-navigation/stack'
import { ComposeState } from '@screens/Compose/utils/types'
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
export const useNavState = () =>
useNavigationState(state =>
state.routes.map(
route => (route.params as { queryKey?: QueryKeyTimeline } | undefined)?.queryKey
)
)
.filter(key => key?.[0] === 'Timeline')
.reverse()
export type RootStackParamList = {
'Screen-Tabs': NavigatorScreenParams<ScreenTabsStackParamList>
'Screen-Announcements': { showAll: boolean }
@ -13,20 +22,19 @@ export type RootStackParamList = {
type: 'edit'
incomingStatus: Mastodon.Status
replyToStatus?: Mastodon.Status
queryKey?: QueryKeyTimeline
rootQueryKey?: QueryKeyTimeline
navigationState: (QueryKeyTimeline | undefined)[]
}
| {
type: 'deleteEdit'
incomingStatus: Mastodon.Status
replyToStatus?: Mastodon.Status
queryKey?: QueryKeyTimeline
navigationState: (QueryKeyTimeline | undefined)[]
}
| {
type: 'reply'
incomingStatus: Mastodon.Status
accts: Mastodon.Account['acct'][]
queryKey?: QueryKeyTimeline
navigationState: (QueryKeyTimeline | undefined)[]
}
| {
type: 'conversation'
@ -85,27 +93,18 @@ export type ScreenTabsScreenProps<T extends keyof ScreenTabsStackParamList> = Bo
export type TabSharedStackParamList = {
'Tab-Shared-Account': {
account: Pick<Mastodon.Account, 'id' | 'username' | 'acct' | 'url' | '_remote'>
queryKey?: QueryKeyTimeline
}
'Tab-Shared-Account-In-Lists': {
account: Pick<Mastodon.Account, 'id' | 'username'>
}
'Tab-Shared-Attachments': { account: Mastodon.Account }
'Tab-Shared-Hashtag': {
hashtag: Mastodon.Tag['name']
}
'Tab-Shared-History': {
status: Mastodon.Status
detectedLanguage: string
}
'Tab-Shared-Account-In-Lists': { account: Pick<Mastodon.Account, 'id' | 'username'> }
'Tab-Shared-Attachments': { account: Mastodon.Account; queryKey?: QueryKeyTimeline }
'Tab-Shared-Hashtag': { hashtag: Mastodon.Tag['name']; queryKey?: QueryKeyTimeline }
'Tab-Shared-History': { status: Mastodon.Status; detectedLanguage: string }
'Tab-Shared-Report': {
account: Pick<Mastodon.Account, 'id' | 'acct' | 'username' | 'url'>
status?: Pick<Mastodon.Status, 'id' | '_remote' | 'uri'>
}
'Tab-Shared-Search': undefined
'Tab-Shared-Toot': {
toot: Mastodon.Status
rootQueryKey?: QueryKeyTimeline
}
'Tab-Shared-Toot': { toot: Mastodon.Status; queryKey?: QueryKeyTimeline }
'Tab-Shared-Users':
| {
reference: 'accounts'
@ -124,15 +123,15 @@ export type TabSharedStackScreenProps<T extends keyof TabSharedStackParamList> =
NativeStackScreenProps<TabSharedStackParamList, T>
export type TabLocalStackParamList = {
'Tab-Local-Root': undefined
'Tab-Local-Root': { queryKey?: QueryKeyTimeline }
} & TabSharedStackParamList
export type TabPublicStackParamList = {
'Tab-Public-Root': undefined
'Tab-Public-Root': { queryKey?: QueryKeyTimeline }
} & TabSharedStackParamList
export type TabNotificationsStackParamList = {
'Tab-Notifications-Root': undefined
'Tab-Notifications-Root': { queryKey?: QueryKeyTimeline }
'Tab-Notifications-Filters': undefined
} & TabSharedStackParamList
export type TabNotificationsStackScreenProps<T extends keyof TabNotificationsStackParamList> =
@ -140,11 +139,11 @@ export type TabNotificationsStackScreenProps<T extends keyof TabNotificationsSta
export type TabMeStackParamList = {
'Tab-Me-Root': undefined
'Tab-Me-Bookmarks': undefined
'Tab-Me-Conversations': undefined
'Tab-Me-Favourites': undefined
'Tab-Me-Bookmarks': { queryKey?: QueryKeyTimeline }
'Tab-Me-Conversations': { queryKey?: QueryKeyTimeline }
'Tab-Me-Favourites': { queryKey?: QueryKeyTimeline }
'Tab-Me-FollowedTags': undefined
'Tab-Me-List': Mastodon.List
'Tab-Me-List': { list: Mastodon.List; queryKey?: QueryKeyTimeline }
'Tab-Me-List-Accounts': Omit<Mastodon.List, 'replies_policy'>
'Tab-Me-List-Edit':
| {