rm chatemptypill
This commit is contained in:
@@ -1,101 +0,0 @@
|
|||||||
import {useCallback, useMemo, useState} from 'react'
|
|
||||||
import {Pressable, View} from 'react-native'
|
|
||||||
import Animated, {
|
|
||||||
runOnJS,
|
|
||||||
useAnimatedStyle,
|
|
||||||
useSharedValue,
|
|
||||||
withTiming,
|
|
||||||
} from 'react-native-reanimated'
|
|
||||||
import {msg} from '@lingui/core/macro'
|
|
||||||
import {useLingui} from '@lingui/react'
|
|
||||||
|
|
||||||
import {ScaleAndFadeIn} from '#/lib/custom-animations/ScaleAndFade'
|
|
||||||
import {ShrinkAndPop} from '#/lib/custom-animations/ShrinkAndPop'
|
|
||||||
import {useHaptics} from '#/lib/haptics'
|
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
|
||||||
import {Text} from '#/components/Typography'
|
|
||||||
import {IS_WEB} from '#/env'
|
|
||||||
|
|
||||||
const AnimatedPressable = Animated.createAnimatedComponent(Pressable)
|
|
||||||
|
|
||||||
let lastIndex = 0
|
|
||||||
|
|
||||||
export function ChatEmptyPill() {
|
|
||||||
const t = useTheme()
|
|
||||||
const {_} = useLingui()
|
|
||||||
const playHaptic = useHaptics()
|
|
||||||
const [promptIndex, setPromptIndex] = useState(lastIndex)
|
|
||||||
|
|
||||||
const scale = useSharedValue(1)
|
|
||||||
|
|
||||||
const prompts = useMemo(() => {
|
|
||||||
return [
|
|
||||||
_(msg`Say hello!`),
|
|
||||||
_(msg`Share your favorite feed!`),
|
|
||||||
_(msg`Tell a joke!`),
|
|
||||||
_(msg`Share a fun fact!`),
|
|
||||||
_(msg`Share a cool story!`),
|
|
||||||
_(msg`Send a neat website!`),
|
|
||||||
_(msg`Clip 🐴 clop 🐴`),
|
|
||||||
]
|
|
||||||
}, [_])
|
|
||||||
|
|
||||||
const onPressIn = useCallback(() => {
|
|
||||||
if (IS_WEB) return
|
|
||||||
scale.set(() => withTiming(1.075, {duration: 100}))
|
|
||||||
}, [scale])
|
|
||||||
|
|
||||||
const onPressOut = useCallback(() => {
|
|
||||||
if (IS_WEB) return
|
|
||||||
scale.set(() => withTiming(1, {duration: 100}))
|
|
||||||
}, [scale])
|
|
||||||
|
|
||||||
const onPress = useCallback(() => {
|
|
||||||
runOnJS(playHaptic)()
|
|
||||||
let randomPromptIndex = Math.floor(Math.random() * prompts.length)
|
|
||||||
while (randomPromptIndex === lastIndex) {
|
|
||||||
randomPromptIndex = Math.floor(Math.random() * prompts.length)
|
|
||||||
}
|
|
||||||
setPromptIndex(randomPromptIndex)
|
|
||||||
lastIndex = randomPromptIndex
|
|
||||||
}, [playHaptic, prompts.length])
|
|
||||||
|
|
||||||
const animatedStyle = useAnimatedStyle(() => ({
|
|
||||||
transform: [{scale: scale.get()}],
|
|
||||||
}))
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View
|
|
||||||
style={[
|
|
||||||
a.absolute,
|
|
||||||
a.w_full,
|
|
||||||
a.z_10,
|
|
||||||
a.align_center,
|
|
||||||
{
|
|
||||||
top: -50,
|
|
||||||
},
|
|
||||||
]}>
|
|
||||||
<AnimatedPressable
|
|
||||||
style={[
|
|
||||||
a.px_xl,
|
|
||||||
a.py_md,
|
|
||||||
a.rounded_full,
|
|
||||||
t.atoms.bg_contrast_25,
|
|
||||||
a.align_center,
|
|
||||||
animatedStyle,
|
|
||||||
]}
|
|
||||||
entering={ScaleAndFadeIn}
|
|
||||||
exiting={ShrinkAndPop}
|
|
||||||
onPress={onPress}
|
|
||||||
onPressIn={onPressIn}
|
|
||||||
onPressOut={onPressOut}>
|
|
||||||
<Text
|
|
||||||
style={[a.font_semi_bold, a.pointer_events_none]}
|
|
||||||
selectable={false}
|
|
||||||
emoji>
|
|
||||||
{prompts[promptIndex]}
|
|
||||||
</Text>
|
|
||||||
</AnimatedPressable>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -52,7 +52,6 @@ import {MessageComposer} from '#/screens/Messages/components/MessageComposer'
|
|||||||
import {MessageInput} from '#/screens/Messages/components/MessageInput'
|
import {MessageInput} from '#/screens/Messages/components/MessageInput'
|
||||||
import {MessageListError} from '#/screens/Messages/components/MessageListError'
|
import {MessageListError} from '#/screens/Messages/components/MessageListError'
|
||||||
import {atoms as a, platform, tokens, useTheme, web} from '#/alf'
|
import {atoms as a, platform, tokens, useTheme, web} from '#/alf'
|
||||||
import {ChatEmptyPill} from '#/components/dms/ChatEmptyPill'
|
|
||||||
import {DateDivider} from '#/components/dms/DateDivider'
|
import {DateDivider} from '#/components/dms/DateDivider'
|
||||||
import {MessageItem} from '#/components/dms/MessageItem'
|
import {MessageItem} from '#/components/dms/MessageItem'
|
||||||
import {NewMessagesPill} from '#/components/dms/NewMessagesPill'
|
import {NewMessagesPill} from '#/components/dms/NewMessagesPill'
|
||||||
@@ -666,12 +665,8 @@ function ConversationFooter({
|
|||||||
case 'loading':
|
case 'loading':
|
||||||
return null
|
return null
|
||||||
case 'new-chat':
|
case 'new-chat':
|
||||||
return (
|
// new chat pill goes here - removed for now
|
||||||
<>
|
return children
|
||||||
<ChatEmptyPill />
|
|
||||||
{children}
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
case 'request':
|
case 'request':
|
||||||
return <ChatStatusInfo convoState={convoState} />
|
return <ChatStatusInfo convoState={convoState} />
|
||||||
case 'standard':
|
case 'standard':
|
||||||
|
|||||||
Reference in New Issue
Block a user