diff --git a/plans/todo.md b/plans/todo.md index b8c8c3d5f802..96832182f925 100644 --- a/plans/todo.md +++ b/plans/todo.md @@ -1,4 +1,6 @@ -look for opportunities to use gap in all boxes +look for platform splits that can go away +jump in inbox below tab +go screen by screen and find cleanup any leftover zustand store ios push to convo broken ts split maybe diff --git a/shared/.gitignore b/shared/.gitignore index 114613c2f058..adca0cbc20bb 100644 --- a/shared/.gitignore +++ b/shared/.gitignore @@ -56,3 +56,4 @@ main.jsbundle coverage-ts temp.log .watchman-cookie-* +.tsOuts/ diff --git a/shared/chat/audio/audio-video.desktop.tsx b/shared/chat/audio/audio-video.desktop.tsx index bd6ed755d34b..d6b08a693cb0 100644 --- a/shared/chat/audio/audio-video.desktop.tsx +++ b/shared/chat/audio/audio-video.desktop.tsx @@ -1,5 +1,5 @@ import * as React from 'react' -import type {Props} from './audio-video' +import type {Props} from './audio-video.shared' const AudioVideo = (props: Props) => { const {url, paused, onPositionUpdated, onEnded} = props diff --git a/shared/chat/audio/audio-video.native.tsx b/shared/chat/audio/audio-video.native.tsx index 778b9d53ac28..c4e77882c30e 100644 --- a/shared/chat/audio/audio-video.native.tsx +++ b/shared/chat/audio/audio-video.native.tsx @@ -1,7 +1,7 @@ import * as React from 'react' import {useAudioPlayer} from 'expo-audio' import {useEventListener} from 'expo' -import type {Props} from './audio-video' +import type {Props} from './audio-video.shared' const AudioVideo = (props: Props) => { const {url, paused, onPositionUpdated, onEnded} = props diff --git a/shared/chat/audio/audio-video.d.ts b/shared/chat/audio/audio-video.shared.tsx similarity index 50% rename from shared/chat/audio/audio-video.d.ts rename to shared/chat/audio/audio-video.shared.tsx index 96f14fa2e438..e1ad2c0648c5 100644 --- a/shared/chat/audio/audio-video.d.ts +++ b/shared/chat/audio/audio-video.shared.tsx @@ -1,11 +1,6 @@ -import type * as React from 'react' - export type Props = { url: string paused: boolean onPositionUpdated: (ratio: number) => void onEnded: () => void } - -declare const AudioVideo: (p: Props) => React.ReactNode -export default AudioVideo diff --git a/shared/chat/conversation/attachment-fullscreen/index.desktop.tsx b/shared/chat/conversation/attachment-fullscreen/index.desktop.tsx index 53aaa5330b5e..5d4353a21d05 100644 --- a/shared/chat/conversation/attachment-fullscreen/index.desktop.tsx +++ b/shared/chat/conversation/attachment-fullscreen/index.desktop.tsx @@ -1,7 +1,7 @@ import * as React from 'react' import * as Kb from '@/common-adapters' import {useMessagePopup} from '../messages/message-popup' -import type {Props} from '.' +import type {Props} from './index.shared' import {useData, usePreviewFallback} from './hooks' import type {StyleOverride} from '@/common-adapters/markdown' diff --git a/shared/chat/conversation/attachment-fullscreen/index.native.tsx b/shared/chat/conversation/attachment-fullscreen/index.native.tsx index 8b3477258e59..abe627bc5142 100644 --- a/shared/chat/conversation/attachment-fullscreen/index.native.tsx +++ b/shared/chat/conversation/attachment-fullscreen/index.native.tsx @@ -4,7 +4,7 @@ import {useMessagePopup} from '../messages/message-popup' import {useVideoPlayer, VideoView} from 'expo-video' import logger from '@/logger' import {ShowToastAfterSaving} from '../messages/attachment/shared' -import type {Props} from '.' +import type {Props} from './index.shared' import {useData, usePreviewFallback} from './hooks' import {type GestureResponderEvent, Animated, View} from 'react-native' import {useSafeAreaFrame} from 'react-native-safe-area-context' diff --git a/shared/chat/conversation/attachment-fullscreen/index.d.ts b/shared/chat/conversation/attachment-fullscreen/index.shared.tsx similarity index 100% rename from shared/chat/conversation/attachment-fullscreen/index.d.ts rename to shared/chat/conversation/attachment-fullscreen/index.shared.tsx diff --git a/shared/chat/conversation/giphy/index.d.ts b/shared/chat/conversation/giphy/index.d.ts deleted file mode 100644 index 59d9869ce8e6..000000000000 --- a/shared/chat/conversation/giphy/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type * as React from 'react' -declare const GiphySearch: () => React.ReactNode -export default GiphySearch diff --git a/shared/chat/conversation/header-area/index.d.ts b/shared/chat/conversation/header-area/index.d.ts deleted file mode 100644 index c8820f5b72e6..000000000000 --- a/shared/chat/conversation/header-area/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {GetOptionsRet} from '@/constants/types/router' -import type * as T from '@/constants/types' - -declare function headerNavigationOptions(route: { - params?: {conversationIDKey?: T.Chat.ConversationIDKey} -}): Partial -export {headerNavigationOptions} diff --git a/shared/chat/conversation/header-area/index.desktop.tsx b/shared/chat/conversation/header-area/index.desktop.tsx index b52fbe24b277..ef58c37e4933 100644 --- a/shared/chat/conversation/header-area/index.desktop.tsx +++ b/shared/chat/conversation/header-area/index.desktop.tsx @@ -1 +1 @@ -export const headerNavigationOptions = (/*route*/) => ({}) +export const headerNavigationOptions = (_route: unknown) => ({}) diff --git a/shared/chat/conversation/input-area/filepicker-popup/index.native.tsx b/shared/chat/conversation/input-area/filepicker-popup/index.native.tsx index 291f84d15580..2580773c07e5 100644 --- a/shared/chat/conversation/input-area/filepicker-popup/index.native.tsx +++ b/shared/chat/conversation/input-area/filepicker-popup/index.native.tsx @@ -1,5 +1,5 @@ import * as Kb from '@/common-adapters' -import type {Props} from '.' +import type {Props} from './index.shared' const Prompt = () => ( diff --git a/shared/chat/conversation/input-area/filepicker-popup/index.d.ts b/shared/chat/conversation/input-area/filepicker-popup/index.shared.tsx similarity index 75% rename from shared/chat/conversation/input-area/filepicker-popup/index.d.ts rename to shared/chat/conversation/input-area/filepicker-popup/index.shared.tsx index 7b42f954414c..54ae4507612f 100644 --- a/shared/chat/conversation/input-area/filepicker-popup/index.d.ts +++ b/shared/chat/conversation/input-area/filepicker-popup/index.shared.tsx @@ -7,6 +7,3 @@ export type Props = { onHidden: () => void onSelect: (mediaType: 'photo' | 'video' | 'mixed' | 'file', location: 'camera' | 'library' | 'file') => void } - -export declare const FilePickerPopup: (p: Props) => React.ReactNode -export default FilePickerPopup diff --git a/shared/chat/conversation/input-area/location-popup.d.ts b/shared/chat/conversation/input-area/location-popup.d.ts deleted file mode 100644 index 251868e41272..000000000000 --- a/shared/chat/conversation/input-area/location-popup.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type * as React from 'react' -declare const LocationPopup: () => React.ReactNode -export default LocationPopup diff --git a/shared/chat/conversation/input-area/normal/index.tsx b/shared/chat/conversation/input-area/normal/index.tsx index 54dc042f0f5a..3756b7121bc3 100644 --- a/shared/chat/conversation/input-area/normal/index.tsx +++ b/shared/chat/conversation/input-area/normal/index.tsx @@ -13,7 +13,7 @@ import {indefiniteArticle} from '@/util/string' import {infoPanelWidthTablet} from '../../info-panel/common' import {assertionToDisplay} from '@/common-adapters/usernames' import {FocusContext, ScrollContext} from '@/chat/conversation/normal/context' -import type {RefType as InputRef} from './input' +import type {RefType as InputRef} from './input.shared' import {useConversationCenter} from '../../center-context' import { useConversationThreadID, diff --git a/shared/chat/conversation/input-area/normal/input.desktop.tsx b/shared/chat/conversation/input-area/normal/input.desktop.tsx index 356b1c68faa1..60b6fe6569b2 100644 --- a/shared/chat/conversation/input-area/normal/input.desktop.tsx +++ b/shared/chat/conversation/input-area/normal/input.desktop.tsx @@ -5,8 +5,9 @@ import * as React from 'react' import * as InputState from '../input-state' import SetExplodingMessagePopup from './set-explode-popup' import Typing from './typing' -import type {Props as InputLowLevelProps, TextInfo, RefType} from './input' -import type {PlatformInputProps as Props} from './input' +import type {Props as InputLowLevelProps, TextInfo, RefType} from './input.shared' +import type {PlatformInputProps as Props} from './input.shared' +export type {Selection, RefType, TextInfo, PlatformInputProps} from './input.shared' import {EmojiPickerDesktop} from '@/chat/emoji-picker/container' import {KeyEventHandler} from '@/common-adapters/key-event-handler.desktop' import {formatDurationShort} from '@/util/timestamp' diff --git a/shared/chat/conversation/input-area/normal/input.native.tsx b/shared/chat/conversation/input-area/normal/input.native.tsx index 14adeccf503e..1b52ca088c31 100644 --- a/shared/chat/conversation/input-area/normal/input.native.tsx +++ b/shared/chat/conversation/input-area/normal/input.native.tsx @@ -9,7 +9,7 @@ import Typing from './typing' import logger from '@/logger' import type * as ImagePicker from 'expo-image-picker' import type {LayoutEvent} from '@/common-adapters/box' -import type {Props as InputLowLevelProps, PlatformInputProps as Props, TextInfo, RefType} from './input' +import type {Props as InputLowLevelProps, PlatformInputProps as Props, TextInfo, RefType} from './input.shared' import {AudioSendWrapper} from '@/chat/audio/audio-send.native' import {Keyboard, TextInput, type NativeSyntheticEvent, type TextInputSelectionChangeEventData, useColorScheme} from 'react-native' import {MaxInputAreaContext} from './max-input-area-context' diff --git a/shared/chat/conversation/input-area/normal/input.d.ts b/shared/chat/conversation/input-area/normal/input.shared.tsx similarity index 88% rename from shared/chat/conversation/input-area/normal/input.d.ts rename to shared/chat/conversation/input-area/normal/input.shared.tsx index c922050bb01b..ce4775a6efdd 100644 --- a/shared/chat/conversation/input-area/normal/input.d.ts +++ b/shared/chat/conversation/input-area/normal/input.shared.tsx @@ -4,6 +4,11 @@ import type * as Styles from '@/styles' import type {TextType} from '@/common-adapters/text.shared' import type {TextInputProps} from 'react-native' +export type Selection = { + start: number + end?: number +} + export type RefType = { blur: () => void clear: () => void @@ -26,14 +31,11 @@ export type RefType = { } } -export type Selection = { - start: number - end?: number -} export type TextInfo = { text: string selection?: Selection } + export type Props = { allowKeyboardEvents?: boolean disabled?: boolean @@ -52,11 +54,11 @@ export type Props = { textType?: TextType style?: Styles.StylesCrossPlatform onChangeText?: (value: string) => void - onPasteImage?: (uris: Array) => void // mobile only + onPasteImage?: (uris: Array) => void multiline?: boolean rowsMin?: number rowsMax?: number - padding?: keyof typeof Styles.globalMargins | 0 // globalMargins does not have an option for 0 + padding?: keyof typeof Styles.globalMargins | 0 } export type PlatformInputProps = { @@ -74,6 +76,3 @@ export type PlatformInputProps = { showReplyPreview: boolean suggestionOverlayStyle: Styles.StylesCrossPlatform } - -declare const PlatformInput: (p: PlatformInputProps) => React.ReactNode -export default PlatformInput diff --git a/shared/chat/conversation/input-area/normal/set-explode-popup/hooks.tsx b/shared/chat/conversation/input-area/normal/set-explode-popup/hooks.tsx index 8c2bacdb913e..c8ea1b1e788a 100644 --- a/shared/chat/conversation/input-area/normal/set-explode-popup/hooks.tsx +++ b/shared/chat/conversation/input-area/normal/set-explode-popup/hooks.tsx @@ -1,6 +1,6 @@ import * as Chat from '@/constants/chat' import type * as T from '@/constants/types' -import type {Props} from '.' +import type {Props} from './index.shared' import {useConversationThreadSelector} from '../../../thread-context' export type MessageExplodeDescription = { diff --git a/shared/chat/conversation/input-area/normal/set-explode-popup/index.desktop.tsx b/shared/chat/conversation/input-area/normal/set-explode-popup/index.desktop.tsx index 255ad7b0c55e..bd575535b2c3 100644 --- a/shared/chat/conversation/input-area/normal/set-explode-popup/index.desktop.tsx +++ b/shared/chat/conversation/input-area/normal/set-explode-popup/index.desktop.tsx @@ -1,5 +1,5 @@ import * as Kb from '@/common-adapters' -import type {Props} from '.' +import type {Props} from './index.shared' import useHooks from './hooks' import type {MessageExplodeDescription} from './hooks' diff --git a/shared/chat/conversation/input-area/normal/set-explode-popup/index.native.tsx b/shared/chat/conversation/input-area/normal/set-explode-popup/index.native.tsx index 813c0c9483c9..e1d50248f819 100644 --- a/shared/chat/conversation/input-area/normal/set-explode-popup/index.native.tsx +++ b/shared/chat/conversation/input-area/normal/set-explode-popup/index.native.tsx @@ -1,5 +1,5 @@ import * as Kb from '@/common-adapters' -import type {Props} from '.' +import type {Props} from './index.shared' import useHooks from './hooks' const Prompt = () => ( diff --git a/shared/chat/conversation/input-area/normal/set-explode-popup/index.d.ts b/shared/chat/conversation/input-area/normal/set-explode-popup/index.shared.tsx similarity index 100% rename from shared/chat/conversation/input-area/normal/set-explode-popup/index.d.ts rename to shared/chat/conversation/input-area/normal/set-explode-popup/index.shared.tsx diff --git a/shared/chat/conversation/input-area/suggestors/commands.tsx b/shared/chat/conversation/input-area/suggestors/commands.tsx index 0dc92f2ed65a..812a4fb8d7ff 100644 --- a/shared/chat/conversation/input-area/suggestors/commands.tsx +++ b/shared/chat/conversation/input-area/suggestors/commands.tsx @@ -4,7 +4,7 @@ import * as Common from './common' import * as Kb from '@/common-adapters' import {useEngineActionListener} from '@/engine/action-listener' import {useConfigState} from '@/stores/config' -import type {Selection as InputSelection} from '../normal/input' +import type {Selection as InputSelection} from '../normal/input.shared' import {useConversationMeta} from '../../data-hooks' const getCommandPrefix = (command: T.RPCChat.ConversationCommand) => { diff --git a/shared/chat/conversation/input-area/suggestors/index.tsx b/shared/chat/conversation/input-area/suggestors/index.tsx index 8aa5683bc34e..1d1783527edc 100644 --- a/shared/chat/conversation/input-area/suggestors/index.tsx +++ b/shared/chat/conversation/input-area/suggestors/index.tsx @@ -6,7 +6,7 @@ import * as React from 'react' import * as Users from './users' import * as InputState from '../input-state' import type * as Common from './common' -import type {PlatformInputProps as Props, RefType as InputRef} from '../normal/input' +import type {PlatformInputProps as Props, RefType as InputRef} from '../normal/input.shared' import {useConversationThreadID} from '../../thread-context' const positionFallbacks = ['bottom center'] as const @@ -128,7 +128,7 @@ const useSyncInput = (p: UseSyncInputProps) => { return null } - const triggerIDRef = React.useRef(undefined) + const triggerIDRef = React.useRef>(undefined) const checkTrigger = () => { if (triggerIDRef.current) { clearTimeout(triggerIDRef.current) diff --git a/shared/chat/conversation/input-area/suggestors/suggestion-list.desktop.tsx b/shared/chat/conversation/input-area/suggestors/suggestion-list.desktop.tsx index 773958f38928..40c1752c0bb1 100644 --- a/shared/chat/conversation/input-area/suggestors/suggestion-list.desktop.tsx +++ b/shared/chat/conversation/input-area/suggestors/suggestion-list.desktop.tsx @@ -1,7 +1,7 @@ import * as React from 'react' import * as Kb from '@/common-adapters' import * as T from '@/constants/types' -import type {Props} from './suggestion-list' +import type {Props} from './suggestion-list.shared' import {BotCommandUpdateStatus} from './shared' import type {LegendListRef} from '@/common-adapters' diff --git a/shared/chat/conversation/input-area/suggestors/suggestion-list.native.tsx b/shared/chat/conversation/input-area/suggestors/suggestion-list.native.tsx index 1b87bd7e7d38..128e3999053b 100644 --- a/shared/chat/conversation/input-area/suggestors/suggestion-list.native.tsx +++ b/shared/chat/conversation/input-area/suggestors/suggestion-list.native.tsx @@ -1,7 +1,7 @@ import * as Kb from '@/common-adapters' import * as T from '@/constants/types' import noop from 'lodash/noop' -import type {Props} from './suggestion-list' +import type {Props} from './suggestion-list.shared' import {BotCommandUpdateStatus} from './shared' import {FlatList} from 'react-native' diff --git a/shared/chat/conversation/input-area/suggestors/suggestion-list.d.ts b/shared/chat/conversation/input-area/suggestors/suggestion-list.shared.tsx similarity index 73% rename from shared/chat/conversation/input-area/suggestors/suggestion-list.d.ts rename to shared/chat/conversation/input-area/suggestors/suggestion-list.shared.tsx index 7a228f8ed5e9..482da65a17dc 100644 --- a/shared/chat/conversation/input-area/suggestors/suggestion-list.d.ts +++ b/shared/chat/conversation/input-area/suggestors/suggestion-list.shared.tsx @@ -3,15 +3,10 @@ import type * as Styles from '@/styles' import type * as T from '@/constants/types' export type Props = { - // TODO fix this type items: Array keyExtractor?: (item: I, idx: number) => string renderItem: (index: number, item: I) => React.ReactElement selectedIndex: number style?: Styles.StylesCrossPlatform - // likely doesn't belong here suggestBotCommandsUpdateStatus?: T.RPCChat.UIBotCommandsUpdateStatusTyp } - -declare function SuggestionList(p: Props): React.ReactNode -export default SuggestionList diff --git a/shared/chat/conversation/list-area/index.d.ts b/shared/chat/conversation/list-area/index.d.ts deleted file mode 100644 index 331afdd4a4ac..000000000000 --- a/shared/chat/conversation/list-area/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type * as React from 'react' -import type * as T from '@/constants/types' - -export type ItemType = T.Chat.Ordinal -declare const ConversationList: () => React.ReactNode -export default ConversationList diff --git a/shared/chat/conversation/list-area/index.native.tsx b/shared/chat/conversation/list-area/index.native.tsx index e47df471047e..51ea828f0392 100644 --- a/shared/chat/conversation/list-area/index.native.tsx +++ b/shared/chat/conversation/list-area/index.native.tsx @@ -6,7 +6,7 @@ import * as React from 'react' import Separator from '../messages/separator' import SpecialBottomMessage from '../messages/special-bottom-message' import SpecialTopMessage from '../messages/special-top-message' -import type {ItemType} from '.' +import type {ItemType} from './index.shared' import {FlatList} from 'react-native' // import {FlashList, type ListRenderItemInfo} from '@shopify/flash-list' import {MessageRow} from '../messages/wrapper' diff --git a/shared/chat/conversation/list-area/index.shared.tsx b/shared/chat/conversation/list-area/index.shared.tsx new file mode 100644 index 000000000000..e1cfac5b230b --- /dev/null +++ b/shared/chat/conversation/list-area/index.shared.tsx @@ -0,0 +1,3 @@ +import type * as T from '@/constants/types' + +export type ItemType = T.Chat.Ordinal diff --git a/shared/chat/conversation/messages/attachment/image/imageimpl.d.ts b/shared/chat/conversation/messages/attachment/image/imageimpl.d.ts deleted file mode 100644 index 1f586de3e41f..000000000000 --- a/shared/chat/conversation/messages/attachment/image/imageimpl.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type * as React from 'react' -import type * as T from '@/constants/types' -declare const ImageImpl: (p: {message: T.Chat.MessageAttachment}) => React.ReactNode -export default ImageImpl diff --git a/shared/chat/conversation/messages/attachment/video/videoimpl.desktop.tsx b/shared/chat/conversation/messages/attachment/video/videoimpl.desktop.tsx index 0d35558a8f00..ea46dce0ea59 100644 --- a/shared/chat/conversation/messages/attachment/video/videoimpl.desktop.tsx +++ b/shared/chat/conversation/messages/attachment/video/videoimpl.desktop.tsx @@ -1,6 +1,6 @@ import * as Kb from '@/common-adapters' import * as React from 'react' -import type {Props} from './videoimpl' +import type {Props} from './videoimpl.shared' import {getAttachmentPreviewSize, maxWidth, maxHeight} from '../shared' // its important we use explicit height/width so we never CLS while loading diff --git a/shared/chat/conversation/messages/attachment/video/videoimpl.native.tsx b/shared/chat/conversation/messages/attachment/video/videoimpl.native.tsx index aa2107c32175..29c47a0d0be3 100644 --- a/shared/chat/conversation/messages/attachment/video/videoimpl.native.tsx +++ b/shared/chat/conversation/messages/attachment/video/videoimpl.native.tsx @@ -4,7 +4,7 @@ import {ShowToastAfterSaving} from '../shared' import {useVideoPlayer, VideoView} from 'expo-video' import {useEventListener} from 'expo' import {Pressable} from 'react-native' -import type {Props} from './videoimpl' +import type {Props} from './videoimpl.shared' import {getAttachmentPreviewSize} from '../shared' const VideoImpl = (p: Props) => { diff --git a/shared/chat/conversation/messages/attachment/video/videoimpl.d.ts b/shared/chat/conversation/messages/attachment/video/videoimpl.shared.tsx similarity index 60% rename from shared/chat/conversation/messages/attachment/video/videoimpl.d.ts rename to shared/chat/conversation/messages/attachment/video/videoimpl.shared.tsx index ad172665d5fc..20e58705321e 100644 --- a/shared/chat/conversation/messages/attachment/video/videoimpl.d.ts +++ b/shared/chat/conversation/messages/attachment/video/videoimpl.shared.tsx @@ -1,10 +1,8 @@ -import type * as React from 'react' import type * as T from '@/constants/types' + export type Props = { openFullscreen?: () => void showPopup?: () => void allowPlay: boolean message: T.Chat.MessageAttachment } -declare const VideoImpl: (p: Props) => React.ReactNode -export default VideoImpl diff --git a/shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.desktop.tsx b/shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.desktop.tsx index 72c5cc45635f..3c0f18f40a7d 100644 --- a/shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.desktop.tsx +++ b/shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.desktop.tsx @@ -1,6 +1,6 @@ import * as React from 'react' import * as Kb from '@/common-adapters/index' -import type {Props} from './video' +import type {Props} from './video.shared' export const Video = (p: Props) => { const {autoPlay, onClick, height, width, style, url} = p diff --git a/shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.native.tsx b/shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.native.tsx index 0ccedc80d913..6e29df22dec3 100644 --- a/shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.native.tsx +++ b/shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.native.tsx @@ -2,7 +2,7 @@ import * as React from 'react' import * as Kb from '@/common-adapters/index' import logger from '@/logger' import {useVideoPlayer, VideoView} from 'expo-video' -import type {Props} from './video' +import type {Props} from './video.shared' export const Video = (props: Props) => { const {autoPlay, onClick, url, style, width, height} = props diff --git a/shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.d.ts b/shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.shared.tsx similarity index 58% rename from shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.d.ts rename to shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.shared.tsx index 2f50512c9794..3917b659dd22 100644 --- a/shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.d.ts +++ b/shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.shared.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' export type Props = { autoPlay: boolean height: number @@ -7,4 +6,3 @@ export type Props = { url: string width: number } -export declare const Video: (p: Props) => React.ReactNode diff --git a/shared/chat/conversation/messages/wrapper/exploding-height-retainer/index.desktop.tsx b/shared/chat/conversation/messages/wrapper/exploding-height-retainer/index.desktop.tsx index 577a42d94fa4..4a5c5616de83 100644 --- a/shared/chat/conversation/messages/wrapper/exploding-height-retainer/index.desktop.tsx +++ b/shared/chat/conversation/messages/wrapper/exploding-height-retainer/index.desktop.tsx @@ -1,6 +1,6 @@ import * as React from 'react' import * as Kb from '@/common-adapters' -import type {Props} from '.' +import type {Props} from './index.shared' import {useColorScheme} from 'react-native' export const animationDuration = 2000 diff --git a/shared/chat/conversation/messages/wrapper/exploding-height-retainer/index.native.tsx b/shared/chat/conversation/messages/wrapper/exploding-height-retainer/index.native.tsx index c0773cd4bf59..84677ee57f53 100644 --- a/shared/chat/conversation/messages/wrapper/exploding-height-retainer/index.native.tsx +++ b/shared/chat/conversation/messages/wrapper/exploding-height-retainer/index.native.tsx @@ -4,7 +4,7 @@ import * as C from '@/constants' import {Animated as NativeAnimated, Easing as NativeEasing} from 'react-native' // ios must animated plain colors not the dynamic ones import colors, {darkColors} from '@/styles/colors' -import type {Props} from '.' +import type {Props} from './index.shared' import {useColorScheme} from 'react-native' // If this image changes, some hard coded dimensions diff --git a/shared/chat/conversation/messages/wrapper/exploding-height-retainer/index.d.ts b/shared/chat/conversation/messages/wrapper/exploding-height-retainer/index.shared.tsx similarity index 100% rename from shared/chat/conversation/messages/wrapper/exploding-height-retainer/index.d.ts rename to shared/chat/conversation/messages/wrapper/exploding-height-retainer/index.shared.tsx diff --git a/shared/chat/conversation/messages/wrapper/long-pressable/index.desktop.tsx b/shared/chat/conversation/messages/wrapper/long-pressable/index.desktop.tsx index 3a03695c19e2..059374b8994d 100644 --- a/shared/chat/conversation/messages/wrapper/long-pressable/index.desktop.tsx +++ b/shared/chat/conversation/messages/wrapper/long-pressable/index.desktop.tsx @@ -1,6 +1,6 @@ import type * as React from 'react' import * as Kb from '@/common-adapters' -import type {Props} from '.' +import type {Props} from './index.shared' function LongPressable(props: Props & {ref?: React.Ref}) { return diff --git a/shared/chat/conversation/messages/wrapper/long-pressable/index.native.tsx b/shared/chat/conversation/messages/wrapper/long-pressable/index.native.tsx index 587311f1ae83..358c04a84cc4 100644 --- a/shared/chat/conversation/messages/wrapper/long-pressable/index.native.tsx +++ b/shared/chat/conversation/messages/wrapper/long-pressable/index.native.tsx @@ -1,7 +1,7 @@ import * as Kb from '@/common-adapters' import * as React from 'react' import * as InputState from '../../../input-area/input-state' -import type {Props} from '.' +import type {Props} from './index.shared' import {useOrdinal} from '../../ids-context' import {useConversationThreadToggleSearch} from '../../../thread-context' import Swipeable, {type SwipeableMethods} from '@/common-adapters/swipeable-row.native' diff --git a/shared/chat/conversation/messages/wrapper/long-pressable/index.d.ts b/shared/chat/conversation/messages/wrapper/long-pressable/index.shared.tsx similarity index 100% rename from shared/chat/conversation/messages/wrapper/long-pressable/index.d.ts rename to shared/chat/conversation/messages/wrapper/long-pressable/index.shared.tsx diff --git a/shared/chat/conversation/normal/index.d.ts b/shared/chat/conversation/normal/index.shared.tsx similarity index 100% rename from shared/chat/conversation/normal/index.d.ts rename to shared/chat/conversation/normal/index.shared.tsx diff --git a/shared/chat/conversation/rekey/participant-rekey.d.ts b/shared/chat/conversation/rekey/participant-rekey.d.ts deleted file mode 100644 index bcebcfb2be06..000000000000 --- a/shared/chat/conversation/rekey/participant-rekey.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type * as React from 'react' -import type {Props} from './participant-rekey.types' -declare const ParticipantRekey: (p: Props) => React.ReactNode -export default ParticipantRekey diff --git a/shared/chat/conversation/rekey/participant-rekey.types.d.ts b/shared/chat/conversation/rekey/participant-rekey.types.ts similarity index 100% rename from shared/chat/conversation/rekey/participant-rekey.types.d.ts rename to shared/chat/conversation/rekey/participant-rekey.types.ts diff --git a/shared/chat/conversation/rekey/you-rekey.d.ts b/shared/chat/conversation/rekey/you-rekey.d.ts deleted file mode 100644 index a0524ad922a3..000000000000 --- a/shared/chat/conversation/rekey/you-rekey.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type * as React from 'react' -export type Props = { - onEnterPaperkey: () => void - onBack: () => void - onRekey: () => void -} -declare const YouRekey: (p: Props) => React.ReactNode -export default YouRekey diff --git a/shared/chat/conversation/rekey/you-rekey.desktop.tsx b/shared/chat/conversation/rekey/you-rekey.desktop.tsx index a94d727c5281..d4db5ba7beaf 100644 --- a/shared/chat/conversation/rekey/you-rekey.desktop.tsx +++ b/shared/chat/conversation/rekey/you-rekey.desktop.tsx @@ -1,5 +1,5 @@ import * as Kb from '@/common-adapters' -import type {Props} from './you-rekey' +import type {Props} from './you-rekey.shared' const YouRekey = ({onRekey}: Props) => { return ( diff --git a/shared/chat/conversation/rekey/you-rekey.native.tsx b/shared/chat/conversation/rekey/you-rekey.native.tsx index 6bfc0fb4b874..8bb0260369c6 100644 --- a/shared/chat/conversation/rekey/you-rekey.native.tsx +++ b/shared/chat/conversation/rekey/you-rekey.native.tsx @@ -1,5 +1,5 @@ import * as Kb from '@/common-adapters' -import type {Props} from './you-rekey' +import type {Props} from './you-rekey.shared' const YouRekey = ({onEnterPaperkey}: Props) => ( diff --git a/shared/chat/conversation/rekey/you-rekey.shared.tsx b/shared/chat/conversation/rekey/you-rekey.shared.tsx new file mode 100644 index 000000000000..06cd5c511b2e --- /dev/null +++ b/shared/chat/conversation/rekey/you-rekey.shared.tsx @@ -0,0 +1,5 @@ +export type Props = { + onEnterPaperkey: () => void + onBack: () => void + onRekey: () => void +} diff --git a/shared/chat/create-channel/hooks.tsx b/shared/chat/create-channel/hooks.tsx index 7a346f0095ed..06562100fadb 100644 --- a/shared/chat/create-channel/hooks.tsx +++ b/shared/chat/create-channel/hooks.tsx @@ -3,7 +3,7 @@ import * as React from 'react' import * as T from '@/constants/types' import {RPCError} from '@/util/errors' import upperFirst from 'lodash/upperFirst' -import type {Props} from '.' +import type {Props} from './index.shared' import {useChatTeam} from '../conversation/team-hooks' export default (p: Props) => { diff --git a/shared/chat/create-channel/index.desktop.tsx b/shared/chat/create-channel/index.desktop.tsx index 90dc97cb5476..afe7bc4d9429 100644 --- a/shared/chat/create-channel/index.desktop.tsx +++ b/shared/chat/create-channel/index.desktop.tsx @@ -1,6 +1,6 @@ import * as Kb from '@/common-adapters' import * as C from '@/constants' -import type {Props} from './index' +import type {Props} from './index.shared' import useHook from './hooks' const CreateChannel = (p: Props) => { diff --git a/shared/chat/create-channel/index.native.tsx b/shared/chat/create-channel/index.native.tsx index 66f6167fb2d3..261672e09d15 100644 --- a/shared/chat/create-channel/index.native.tsx +++ b/shared/chat/create-channel/index.native.tsx @@ -1,6 +1,6 @@ import * as Kb from '@/common-adapters' import * as C from '@/constants' -import type {Props} from './index' +import type {Props} from './index.shared' import useHook from './hooks' const CreateChannel = (p: Props) => { diff --git a/shared/chat/create-channel/index.d.ts b/shared/chat/create-channel/index.shared.tsx similarity index 50% rename from shared/chat/create-channel/index.d.ts rename to shared/chat/create-channel/index.shared.tsx index 393df8320e08..9d6f3787922c 100644 --- a/shared/chat/create-channel/index.d.ts +++ b/shared/chat/create-channel/index.shared.tsx @@ -1,10 +1,6 @@ -import type * as React from 'react' import type * as T from '@/constants/types' export type Props = { navToChatOnSuccess?: boolean teamID: T.Teams.TeamID } - -declare const CreateChannel: (p: Props) => React.ReactNode -export default CreateChannel diff --git a/shared/chat/inbox-and-conversation-get-options.tsx b/shared/chat/inbox-and-conversation-get-options.tsx index b882a3a46ada..302e028c84a8 100644 --- a/shared/chat/inbox-and-conversation-get-options.tsx +++ b/shared/chat/inbox-and-conversation-get-options.tsx @@ -1,5 +1,5 @@ import * as Kb from '@/common-adapters' -import InboxAndConvoHeader from './inbox-and-conversation-header' +import InboxAndConvoHeader from '@/chat/inbox-and-conversation-header' import {useSafeAreaFrame} from 'react-native-safe-area-context' function TabletHeader() { diff --git a/shared/chat/inbox-and-conversation-header.tsx b/shared/chat/inbox-and-conversation-header.tsx index d47fb36e0df2..70a4d8c801c7 100644 --- a/shared/chat/inbox-and-conversation-header.tsx +++ b/shared/chat/inbox-and-conversation-header.tsx @@ -4,18 +4,18 @@ import * as Config from '@/constants/config' import * as Kb from '@/common-adapters' import * as T from '@/constants/types' import type {StyleOverride} from '@/common-adapters/markdown' -import NewChatButton from './inbox/new-chat-button' -import {setInboxHeaderPortalNode, useInboxHeaderPortalContent} from './inbox/header-portal-state' -import type {ChatRootRouteParams} from './inbox-and-conversation' -import {useChatTeam} from './conversation/team-hooks' +import NewChatButton from '@/chat/inbox/new-chat-button' +import {setInboxHeaderPortalNode, useInboxHeaderPortalContent} from '@/chat/inbox/header-portal-state' +import type {ChatRootRouteParams} from '@/chat/inbox-and-conversation' +import {useChatTeam} from '@/chat/conversation/team-hooks' import {useRoute, type RouteProp} from '@react-navigation/native' -import {useInboxMetadataState} from './inbox/metadata' +import {useInboxMetadataState} from '@/chat/inbox/metadata' import {useInboxRowsState} from '@/stores/inbox-rows' import {useUsersState} from '@/stores/users' import {useCurrentUserState} from '@/stores/current-user' import {navToPath} from '@/constants/fs' -import {showConversationInfoPanel, toggleConversationThreadSearch} from './conversation/thread-context' -import {muteConversation} from './conversation/status-actions' +import {showConversationInfoPanel, toggleConversationThreadSearch} from '@/chat/conversation/thread-context' +import {muteConversation} from '@/chat/conversation/status-actions' type ChatRootRoute = RouteProp<{chatRoot: ChatRootRouteParams}, 'chatRoot'> diff --git a/shared/chat/inbox-and-conversation-shared.tsx b/shared/chat/inbox-and-conversation-shared.tsx index dd6aee85767c..1eb15071637c 100644 --- a/shared/chat/inbox-and-conversation-shared.tsx +++ b/shared/chat/inbox-and-conversation-shared.tsx @@ -4,10 +4,10 @@ import * as Chat from '@/constants/chat' import * as Kb from '@/common-adapters' import * as React from 'react' import type * as T from '@/constants/types' -import Conversation from './conversation/container' -import InfoPanel, {type Panel} from './conversation/info-panel' -import type {ThreadSearchRouteProps} from './conversation/thread-search-route' -import {useInboxLayoutState} from './inbox/layout-state' +import Conversation from '@/chat/conversation/container' +import InfoPanel, {type Panel} from '@/chat/conversation/info-panel' +import type {ThreadSearchRouteProps} from '@/chat/conversation/thread-search-route' +import {useInboxLayoutState} from '@/chat/inbox/layout-state' import type {NavState} from '@/constants/router' import logger from '@/logger' diff --git a/shared/chat/inbox-and-conversation.desktop.tsx b/shared/chat/inbox-and-conversation.desktop.tsx index ee182300e376..27ea4bc224bd 100644 --- a/shared/chat/inbox-and-conversation.desktop.tsx +++ b/shared/chat/inbox-and-conversation.desktop.tsx @@ -1,9 +1,9 @@ import * as Kb from '@/common-adapters' -import Inbox from './inbox' -import {InboxAndConversationShell, type InboxAndConversationProps} from './inbox-and-conversation-shared' -import {inboxWidth} from './inbox/row/sizes' -import useInboxHeaderPortal from './inbox/use-header-portal' -import {useInboxSearch} from './inbox/use-inbox-search' +import Inbox from '@/chat/inbox' +import {InboxAndConversationShell, type InboxAndConversationProps} from '@/chat/inbox-and-conversation-shared' +import {inboxWidth} from '@/chat/inbox/row/sizes' +import useInboxHeaderPortal from '@/chat/inbox/use-header-portal' +import {useInboxSearch} from '@/chat/inbox/use-inbox-search' export default function InboxAndConversationDesktop(props: InboxAndConversationProps) { const search = useInboxSearch() @@ -32,3 +32,5 @@ const styles = Kb.Styles.styleSheetCreate( }, }) as const ) + +export type {ChatRootRouteParams} from '@/chat/inbox-and-conversation-shared' diff --git a/shared/chat/inbox-and-conversation.native.tsx b/shared/chat/inbox-and-conversation.native.tsx index 9d091e887f14..1c188f61681a 100644 --- a/shared/chat/inbox-and-conversation.native.tsx +++ b/shared/chat/inbox-and-conversation.native.tsx @@ -1,7 +1,7 @@ -import Inbox from './inbox' -import {InboxAndConversationShell, type InboxAndConversationProps} from './inbox-and-conversation-shared' -import useInboxHeaderPortal from './inbox/use-header-portal' -import {useInboxSearch} from './inbox/use-inbox-search' +import Inbox from '@/chat/inbox' +import {InboxAndConversationShell, type InboxAndConversationProps} from '@/chat/inbox-and-conversation-shared' +import useInboxHeaderPortal from '@/chat/inbox/use-header-portal' +import {useInboxSearch} from '@/chat/inbox/use-inbox-search' export default function InboxAndConversationNative(props: InboxAndConversationProps) { const search = useInboxSearch() @@ -19,3 +19,5 @@ export default function InboxAndConversationNative(props: InboxAndConversationPr ) } + +export type {ChatRootRouteParams} from '@/chat/inbox-and-conversation-shared' diff --git a/shared/chat/inbox-and-conversation.tsx b/shared/chat/inbox-and-conversation.tsx index e18500a7c574..1fb986a7c22f 100644 --- a/shared/chat/inbox-and-conversation.tsx +++ b/shared/chat/inbox-and-conversation.tsx @@ -1,11 +1,11 @@ import * as C from '@/constants' -import Desktop from './inbox-and-conversation.desktop' -import Native from './inbox-and-conversation.native' -import type {InboxAndConversationProps} from './inbox-and-conversation-shared' +import Desktop from '@/chat/inbox-and-conversation.desktop' +import Native from '@/chat/inbox-and-conversation.native' +import type {InboxAndConversationProps} from '@/chat/inbox-and-conversation-shared' function InboxAndConversation(props: InboxAndConversationProps) { return C.isMobile ? : } export default InboxAndConversation -export type {ChatRootRouteParams, InboxAndConversationProps} from './inbox-and-conversation-shared' +export type {ChatRootRouteParams, InboxAndConversationProps} from '@/chat/inbox-and-conversation-shared' diff --git a/shared/chat/inbox-search/background.d.ts b/shared/chat/inbox-search/background.d.ts deleted file mode 100644 index 5a40c413050a..000000000000 --- a/shared/chat/inbox-search/background.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type * as React from 'react' -declare const Background: () => React.ReactNode -export default Background diff --git a/shared/chat/inbox/index.d.ts b/shared/chat/inbox/index.d.ts deleted file mode 100644 index 760c639820a8..000000000000 --- a/shared/chat/inbox/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type * as React from 'react' -import type {ChatRootInboxRefresh, ConversationIDKey} from '@/constants/types/chat' -import type {InboxSearchController} from './use-inbox-search' - -type Props = { - conversationIDKey?: ConversationIDKey - refreshInbox?: ChatRootInboxRefresh - search?: InboxSearchController -} - -declare const Inbox: (p: Props) => React.ReactNode -export default Inbox diff --git a/shared/chat/inbox/row/small-team/swipe-conv-actions/index.desktop.tsx b/shared/chat/inbox/row/small-team/swipe-conv-actions/index.desktop.tsx index 82e4a7b67753..63ef5ea17d50 100644 --- a/shared/chat/inbox/row/small-team/swipe-conv-actions/index.desktop.tsx +++ b/shared/chat/inbox/row/small-team/swipe-conv-actions/index.desktop.tsx @@ -1,6 +1,6 @@ import * as RowSizes from '../../sizes' import * as Kb from '@/common-adapters' -import type {Props} from '.' +import type {Props} from './index.shared' const SwipeConvActions = (props: Props) => { return
{props.children}
diff --git a/shared/chat/inbox/row/small-team/swipe-conv-actions/index.native.tsx b/shared/chat/inbox/row/small-team/swipe-conv-actions/index.native.tsx index 4b317be31950..a7cfe6fecaaf 100644 --- a/shared/chat/inbox/row/small-team/swipe-conv-actions/index.native.tsx +++ b/shared/chat/inbox/row/small-team/swipe-conv-actions/index.native.tsx @@ -3,7 +3,7 @@ import * as Kb from '@/common-adapters' import * as React from 'react' import * as Reanimated from 'react-native-reanimated' import * as RowSizes from '../../sizes' -import type {Props} from '.' +import type {Props} from './index.shared' import {Pressable, View} from 'react-native' import Swipeable, {type SwipeableMethods} from '@/common-adapters/swipeable-row.native' import {useOpenedRowState} from '../../opened-row-state' diff --git a/shared/chat/inbox/row/small-team/swipe-conv-actions/index.d.ts b/shared/chat/inbox/row/small-team/swipe-conv-actions/index.shared.tsx similarity index 100% rename from shared/chat/inbox/row/small-team/swipe-conv-actions/index.d.ts rename to shared/chat/inbox/row/small-team/swipe-conv-actions/index.shared.tsx diff --git a/shared/chat/inbox/use-header-portal.d.ts b/shared/chat/inbox/use-header-portal.d.ts deleted file mode 100644 index 7c368a6e0392..000000000000 --- a/shared/chat/inbox/use-header-portal.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type * as React from 'react' -import type {InboxSearchController} from './use-inbox-search' - -declare const useInboxHeaderPortal: (search: InboxSearchController) => React.ReactNode -export default useInboxHeaderPortal diff --git a/shared/chat/location-map.d.ts b/shared/chat/location-map.d.ts deleted file mode 100644 index 80826dcc1fd2..000000000000 --- a/shared/chat/location-map.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type * as React from 'react' -type Props = { - height: number - mapSrc: string - onLoad?: () => void - width: number -} -declare const LocationMap: (p: Props) => React.ReactNode -export default LocationMap diff --git a/shared/chat/location-map.desktop.tsx b/shared/chat/location-map.desktop.tsx index 4017add5f1e6..8ff53c4186da 100644 --- a/shared/chat/location-map.desktop.tsx +++ b/shared/chat/location-map.desktop.tsx @@ -28,7 +28,7 @@ const LocationMap = (props: Props) => { bannerColor="white" content={[ 'Your location is protected. ', - {onClick: () => openURL('https://book.keybase.io/docs/chat/location'), text: 'Learn more'}, + {onClick: () => { void openURL('https://book.keybase.io/docs/chat/location') }, text: 'Learn more'}, ]} /> diff --git a/shared/chat/pdf/index.desktop.tsx b/shared/chat/pdf/index.desktop.tsx index d60667214d51..1b19c57de018 100644 --- a/shared/chat/pdf/index.desktop.tsx +++ b/shared/chat/pdf/index.desktop.tsx @@ -2,7 +2,7 @@ import * as C from '@/constants' import * as Kb from '@/common-adapters' import * as React from 'react' import {useNavigation} from '@react-navigation/native' -import type {Props} from '.' +import type {Props} from './index.shared' import * as T from '@/constants/types' import {openLocalPathInSystemFileManagerDesktop} from '@/util/fs-storeless-actions' import {attachmentDownloadMessage, takePDFMessage} from '../conversation/attachment-actions' diff --git a/shared/chat/pdf/index.native.tsx b/shared/chat/pdf/index.native.tsx index 9efc20f6e060..74f17ac9b227 100644 --- a/shared/chat/pdf/index.native.tsx +++ b/shared/chat/pdf/index.native.tsx @@ -1,6 +1,6 @@ import * as React from 'react' import * as Kb from '@/common-adapters' -import type {Props} from '.' +import type {Props} from './index.shared' const ChatPDF = (props: Props) => { const {url} = props diff --git a/shared/chat/pdf/index.d.ts b/shared/chat/pdf/index.shared.tsx similarity index 100% rename from shared/chat/pdf/index.d.ts rename to shared/chat/pdf/index.shared.tsx diff --git a/shared/common-adapters/animation.desktop.tsx b/shared/common-adapters/animation.desktop.tsx index b3017ace0a34..d01196d9c37c 100644 --- a/shared/common-adapters/animation.desktop.tsx +++ b/shared/common-adapters/animation.desktop.tsx @@ -1,7 +1,8 @@ import * as React from 'react' import {Box2} from './box' import lottie from 'lottie-web' -import type {Props, AnimationType} from './animation' +import type {Props, AnimationType} from './animation.shared' +export type {AnimationType} from './animation.shared' const defaultDimension = 16 diff --git a/shared/common-adapters/animation.native.tsx b/shared/common-adapters/animation.native.tsx index a5f1151bbedf..d70ecddc860a 100644 --- a/shared/common-adapters/animation.native.tsx +++ b/shared/common-adapters/animation.native.tsx @@ -1,7 +1,7 @@ import * as React from 'react' import {Box2} from './box' import LottieView from 'lottie-react-native' -import type {Props, AnimationType} from './animation' +import type {Props, AnimationType} from './animation.shared' // prettier-ignore type AnimationObject = { v: string; fr: number; ip: number; op: number; w: number; h: number; diff --git a/shared/common-adapters/animation.d.ts b/shared/common-adapters/animation.shared.tsx similarity index 86% rename from shared/common-adapters/animation.d.ts rename to shared/common-adapters/animation.shared.tsx index ee35e14884e5..cef87713f557 100644 --- a/shared/common-adapters/animation.d.ts +++ b/shared/common-adapters/animation.shared.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import type * as Styles from '@/styles' export type AnimationType = @@ -30,6 +29,3 @@ export type Props = { style?: Styles.StylesCrossPlatform width?: number } - -declare const Animation: (p: Props) => React.ReactNode -export default Animation diff --git a/shared/common-adapters/avatar/index.d.ts b/shared/common-adapters/avatar/index.d.ts deleted file mode 100644 index 31e4ea71bb51..000000000000 --- a/shared/common-adapters/avatar/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type * as React from 'react' -import type * as Styles from '@/styles' -import type * as T from '@/constants/types' - -type Props = { - children?: React.ReactNode - crop?: T.Teams.AvatarCrop - imageOverrideUrl?: string - isTeam?: boolean - onClick?: ((e?: React.BaseSyntheticEvent) => void) | 'profile' - size: 128 | 96 | 64 | 48 | 32 | 24 | 16 - style?: Styles.CustomStyles<'borderStyle'> - teamname?: string - username?: string -} - -declare const Avatar: (p: Props) => React.ReactNode -export default Avatar diff --git a/shared/common-adapters/back-button.desktop.tsx b/shared/common-adapters/back-button.desktop.tsx index 59fffa854fa9..78f3ae7a035c 100644 --- a/shared/common-adapters/back-button.desktop.tsx +++ b/shared/common-adapters/back-button.desktop.tsx @@ -3,7 +3,7 @@ import type * as React from 'react' import * as Styles from '@/styles' import Icon from './icon' import Text from './text' -import type {Props} from './back-button' +import type {Props} from './back-button.shared' const Kb = { Icon, diff --git a/shared/common-adapters/back-button.native.tsx b/shared/common-adapters/back-button.native.tsx index 4c0ac9d804bf..ee330bd4ad6b 100644 --- a/shared/common-adapters/back-button.native.tsx +++ b/shared/common-adapters/back-button.native.tsx @@ -4,7 +4,7 @@ import Badge from './badge' import {Box2} from './box' import Icon from './icon' import * as Styles from '@/styles' -import type {Props} from './back-button' +import type {Props} from './back-button.shared' import noop from 'lodash/noop' const Kb = { diff --git a/shared/common-adapters/back-button.d.ts b/shared/common-adapters/back-button.shared.tsx similarity index 59% rename from shared/common-adapters/back-button.d.ts rename to shared/common-adapters/back-button.shared.tsx index 0a937a328fc2..6177a8a5ea8d 100644 --- a/shared/common-adapters/back-button.d.ts +++ b/shared/common-adapters/back-button.shared.tsx @@ -1,10 +1,9 @@ -import type * as React from 'react' import type {Color, StylesCrossPlatform} from '@/styles' export type Props = { badgeNumber?: number hideBackLabel?: boolean - onClick?: () => void // if undefined will give you a navigate up + onClick?: () => void disabled?: boolean onPress?: never iconColor?: Color @@ -12,6 +11,3 @@ export type Props = { style?: StylesCrossPlatform title?: string } - -declare const BackButton: (p: Props) => React.ReactNode -export default BackButton diff --git a/shared/common-adapters/bottom-accessory.d.ts b/shared/common-adapters/bottom-accessory.d.ts deleted file mode 100644 index ced298e315a9..000000000000 --- a/shared/common-adapters/bottom-accessory.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type * as React from 'react' - -export declare const BottomAccessory: (p: {children: React.ReactNode}) => React.ReactNode diff --git a/shared/common-adapters/box.d.ts b/shared/common-adapters/box.d.ts deleted file mode 100644 index 9f437f627c27..000000000000 --- a/shared/common-adapters/box.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import type * as React from 'react' -import type {StylesCrossPlatform, globalMargins} from '@/styles' -import type {NativeSyntheticEvent} from 'react-native' -import type {MeasureRef} from './measure-ref' - -export type LayoutEvent = NativeSyntheticEvent<{ - layout: { - x: number - y: number - width: number - height: number - } -}> - -export type Box2Props = { - alignItems?: 'center' | 'flex-start' | 'flex-end' | 'stretch' - alignSelf?: 'center' | 'flex-start' | 'flex-end' | 'stretch' - children?: React.ReactNode - centerChildren?: boolean - className?: string - collapsable?: boolean - direction: 'horizontal' | 'vertical' | 'horizontalReverse' | 'verticalReverse' - flex?: number - fullHeight?: boolean - fullWidth?: boolean - justifyContent?: 'center' | 'flex-start' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly' - noShrink?: boolean - overflow?: 'hidden' | 'scroll' | 'visible' | 'auto' - onDragLeave?: (syntheticDragEvent: React.DragEvent) => void // desktop only - onDragOver?: (syntheticDragEvent: React.DragEvent) => void // desktop only - onDrop?: (syntheticDragEvent: React.DragEvent) => void // desktop only - onLayout?: (evt: LayoutEvent) => void // mobile only - onMouseDown?: (syntheticEvent: React.MouseEvent) => void // desktop only - onMouseMove?: (syntheticEvent: React.MouseEvent) => void // desktop only - onMouseLeave?: (syntheticEvent: React.MouseEvent) => void // desktop only - onMouseUp?: (syntheticEvent: React.MouseEvent) => void // desktop only - onMouseOver?: (syntheticEvent: React.MouseEvent) => void // desktop only - onCopyCapture?: (syntheticEvent: React.SyntheticEvent) => void // desktop only - onContextMenu?: () => void // desktop only - padding?: keyof typeof globalMargins - pointerEvents?: 'none' | 'box-none' - relative?: boolean - style?: StylesCrossPlatform - gap?: keyof typeof globalMargins - gapStart?: boolean - gapEnd?: boolean - title?: string - tooltip?: string -} - -export declare function Box2(p: Box2Props & {ref?: React.Ref}): React.ReactNode -// wrapped by reanimated -export declare function Box2Animated(p: Box2Props & {ref?: React.Ref}): React.ReactNode diff --git a/shared/common-adapters/box.desktop.tsx b/shared/common-adapters/box.desktop.tsx index 340484d75c1f..ec252a3dcc2f 100644 --- a/shared/common-adapters/box.desktop.tsx +++ b/shared/common-adapters/box.desktop.tsx @@ -1,9 +1,10 @@ import type * as React from 'react' import * as Styles from '@/styles' -import type {Box2Props} from './box' +import type {Box2Props, MeasureRef} from './box.shared' +export type {LayoutEvent} from './box.shared' import './box.css' -export const Box2 = (p: Box2Props & {ref?: React.Ref}) => { +export const Box2 = (p: Box2Props & {ref?: React.Ref}) => { const {direction, fullHeight, fullWidth, centerChildren, alignSelf, alignItems, noShrink, ref} = p const {flex, justifyContent, overflow, padding, relative} = p const {onMouseMove, onMouseDown, onMouseLeave, onMouseUp, onMouseOver, onCopyCapture, children} = p @@ -45,7 +46,7 @@ export const Box2 = (p: Box2Props & {ref?: React.Ref}) => { return (
} className={className} data-tooltip={tooltip} onContextMenu={onContextMenu} diff --git a/shared/common-adapters/box.native.tsx b/shared/common-adapters/box.native.tsx index 1710054ce49e..b05214eae4e7 100644 --- a/shared/common-adapters/box.native.tsx +++ b/shared/common-adapters/box.native.tsx @@ -1,8 +1,10 @@ import type * as React from 'react' import * as Styles from '@/styles' import {View} from 'react-native' -import type {Box2Props} from './box' import Reanimated from 'react-native-reanimated' +import type {MeasureRef} from '@/common-adapters/measure-ref' +import type {Box2Props} from '@/common-adapters/box.shared' + type Margins = keyof typeof Styles.globalMargins const marginKeys = Object.keys(Styles.globalMargins) as Array @@ -136,16 +138,16 @@ const useBox2Shared = (p: Box2Props) => { } } -export const Box2 = (p: Box2Props & {ref?: React.Ref}) => { +export const Box2 = (p: Box2Props & {ref?: React.Ref}) => { const {ref, ...rest} = p const props = useBox2Shared(rest) - return + return } /> } -export const Box2Animated = (p: Box2Props & {ref?: React.Ref}) => { +export const Box2Animated = (p: Box2Props & {ref?: React.Ref}) => { const {ref, ...rest} = p const props = useBox2Shared(rest) - return + return } /> } @@ -201,3 +203,5 @@ const styles = { }, } as const + +export type * from '@/common-adapters/box.shared' diff --git a/shared/common-adapters/box.shared.tsx b/shared/common-adapters/box.shared.tsx new file mode 100644 index 000000000000..bcdfd3cfcdaf --- /dev/null +++ b/shared/common-adapters/box.shared.tsx @@ -0,0 +1,49 @@ +import type {NativeSyntheticEvent} from 'react-native' +import type * as React from 'react' +import type * as Styles from '@/styles' +export type {MeasureRef} from './measure-ref' + +export type Box2Props = { + alignItems?: 'center' | 'flex-start' | 'flex-end' | 'stretch' + alignSelf?: 'center' | 'flex-start' | 'flex-end' | 'stretch' + children?: React.ReactNode + centerChildren?: boolean + className?: string + collapsable?: boolean + direction: 'horizontal' | 'vertical' | 'horizontalReverse' | 'verticalReverse' + flex?: number + fullHeight?: boolean + fullWidth?: boolean + justifyContent?: 'center' | 'flex-start' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly' + noShrink?: boolean + overflow?: 'hidden' | 'scroll' | 'visible' | 'auto' + onDragLeave?: (syntheticDragEvent: React.DragEvent) => void + onDragOver?: (syntheticDragEvent: React.DragEvent) => void + onDrop?: (syntheticDragEvent: React.DragEvent) => void + onLayout?: (evt: LayoutEvent) => void + onMouseDown?: (syntheticEvent: React.MouseEvent) => void + onMouseMove?: (syntheticEvent: React.MouseEvent) => void + onMouseLeave?: (syntheticEvent: React.MouseEvent) => void + onMouseUp?: (syntheticEvent: React.MouseEvent) => void + onMouseOver?: (syntheticEvent: React.MouseEvent) => void + onCopyCapture?: (syntheticEvent: React.SyntheticEvent) => void + onContextMenu?: () => void + padding?: keyof typeof Styles.globalMargins + pointerEvents?: 'none' | 'box-none' + relative?: boolean + style?: Styles.StylesCrossPlatform + gap?: keyof typeof Styles.globalMargins + gapStart?: boolean + gapEnd?: boolean + title?: string + tooltip?: string +} + +export type LayoutEvent = NativeSyntheticEvent<{ + layout: { + x: number + y: number + width: number + height: number + } +}> diff --git a/shared/common-adapters/checkbox.desktop.tsx b/shared/common-adapters/checkbox.desktop.tsx index b70546b82229..e425cb3c1a73 100644 --- a/shared/common-adapters/checkbox.desktop.tsx +++ b/shared/common-adapters/checkbox.desktop.tsx @@ -2,7 +2,7 @@ import {Box2} from './box' import ClickableBox from './clickable-box' import Icon from './icon' import Text from './text' -import type {Props} from './checkbox' +import type {Props} from './checkbox.shared' import * as Styles from '@/styles' const Kb = { diff --git a/shared/common-adapters/checkbox.native.tsx b/shared/common-adapters/checkbox.native.tsx index 90203fc12c98..c18b604fa8bb 100644 --- a/shared/common-adapters/checkbox.native.tsx +++ b/shared/common-adapters/checkbox.native.tsx @@ -1,7 +1,22 @@ -import Switch from './switch' -import type {Props} from './checkbox' +import type {TextType} from '@/common-adapters/text.shared' +import type * as React from 'react' +import Switch from '@/common-adapters/switch' import * as Styles from '@/styles' + +type Props = { + key?: string + label?: string | React.ReactNode + checkboxColor?: Styles.Color + checkboxStyle?: Styles.StylesCrossPlatform + labelComponent?: React.ReactNode + labelSubtitle?: string + labelType?: TextType + onCheck?: (newCheckedValue: boolean) => void + checked: boolean + style?: Styles.StylesCrossPlatform + disabled?: boolean +} const Checkbox = (props: Props) => ( React.ReactNode -export default Checkbox diff --git a/shared/common-adapters/choice-list.desktop.tsx b/shared/common-adapters/choice-list.desktop.tsx index 5d07c0bab540..94795be14a1e 100644 --- a/shared/common-adapters/choice-list.desktop.tsx +++ b/shared/common-adapters/choice-list.desktop.tsx @@ -3,7 +3,7 @@ import ClickableBox from './clickable-box' import Text from './text' import IconAuto from './icon-auto' import * as Styles from '@/styles' -import type {Props} from './choice-list' +import type {Props} from './choice-list.shared' import './choice-list.css' const Kb = { diff --git a/shared/common-adapters/choice-list.native.tsx b/shared/common-adapters/choice-list.native.tsx index c4b1887757f9..83ddd130230f 100644 --- a/shared/common-adapters/choice-list.native.tsx +++ b/shared/common-adapters/choice-list.native.tsx @@ -4,7 +4,7 @@ import IconAuto from './icon-auto' import Text from './text' import * as React from 'react' import * as Styles from '@/styles' -import type {Props} from './choice-list' +import type {Props} from './choice-list.shared' const Kb = {Box2, ClickableBox, IconAuto, Text} diff --git a/shared/common-adapters/choice-list.d.ts b/shared/common-adapters/choice-list.shared.tsx similarity index 63% rename from shared/common-adapters/choice-list.d.ts rename to shared/common-adapters/choice-list.shared.tsx index b65f8efd870c..5212cb6183a0 100644 --- a/shared/common-adapters/choice-list.d.ts +++ b/shared/common-adapters/choice-list.shared.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import type {IconType} from './icon' export type Option = { @@ -12,6 +11,3 @@ export type Option = { export type Props = { options: Array