push
This commit is contained in:
@@ -6,11 +6,20 @@ import { useLocalSearchParams, useRouter } from 'expo-router'
|
||||
import { Ionicons } from '@expo/vector-icons'
|
||||
import { useMemberDetail } from '@/hooks/useMembers'
|
||||
import { Avatar } from '@/components/ui/Avatar'
|
||||
import { trpc } from '@/lib/trpc'
|
||||
|
||||
export default function MemberDetailScreen() {
|
||||
const { id } = useLocalSearchParams<{ id: string }>()
|
||||
const router = useRouter()
|
||||
const { data: member, isLoading } = useMemberDetail(id)
|
||||
const getOrCreate = trpc.messages.getOrCreate.useMutation({
|
||||
onSuccess: ({ conversationId }) => {
|
||||
router.push({
|
||||
pathname: '/(app)/chat/[id]',
|
||||
params: { id: conversationId, name: member?.name ?? '' },
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
@@ -87,6 +96,15 @@ export default function MemberDetailScreen() {
|
||||
<Ionicons name="mail-outline" size={18} color="#0F172A" />
|
||||
<Text style={styles.btnSecondaryText}>E-Mail senden</Text>
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity
|
||||
onPress={() => getOrCreate.mutate({ otherMemberId: id })}
|
||||
style={[styles.btnSecondary, getOrCreate.isPending && { opacity: 0.6 }]}
|
||||
activeOpacity={0.8}
|
||||
disabled={getOrCreate.isPending}
|
||||
>
|
||||
<Ionicons name="chatbubble-outline" size={18} color="#0F172A" />
|
||||
<Text style={styles.btnSecondaryText}>Nachricht schreiben</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
|
||||
Reference in New Issue
Block a user