refactor(mobile): chats header opens settings instead of inline logout
This commit is contained in:
@@ -4,7 +4,6 @@ import { Stack, useRouter } from 'expo-router';
|
|||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
Alert,
|
|
||||||
FlatList,
|
FlatList,
|
||||||
Pressable,
|
Pressable,
|
||||||
RefreshControl,
|
RefreshControl,
|
||||||
@@ -14,7 +13,6 @@ import {
|
|||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
|
|
||||||
import { ConversationRow } from '../../components/ConversationRow';
|
import { ConversationRow } from '../../components/ConversationRow';
|
||||||
import { useAuth } from '../../lib/authContext';
|
|
||||||
import { supabase } from '../../lib/supabase';
|
import { supabase } from '../../lib/supabase';
|
||||||
import { colors } from '../../theme/colors';
|
import { colors } from '../../theme/colors';
|
||||||
|
|
||||||
@@ -23,7 +21,6 @@ import { colors } from '../../theme/colors';
|
|||||||
// is a Phase 1.5 follow-up. Tap → conversation detail.
|
// is a Phase 1.5 follow-up. Tap → conversation detail.
|
||||||
export default function Chats() {
|
export default function Chats() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { signOut } = useAuth();
|
|
||||||
const [list, setList] = useState<ConversationSummary[] | null>(null);
|
const [list, setList] = useState<ConversationSummary[] | null>(null);
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
const [refreshing, setRefreshing] = useState(false);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
@@ -48,19 +45,6 @@ export default function Chats() {
|
|||||||
setRefreshing(false);
|
setRefreshing(false);
|
||||||
}, [load]);
|
}, [load]);
|
||||||
|
|
||||||
const confirmLogout = () => {
|
|
||||||
Alert.alert('Abmelden', 'Diese Sitzung beenden?', [
|
|
||||||
{ text: 'Abbrechen', style: 'cancel' },
|
|
||||||
{
|
|
||||||
text: 'Abmelden',
|
|
||||||
style: 'destructive',
|
|
||||||
onPress: () => {
|
|
||||||
void signOut();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
@@ -69,8 +53,8 @@ export default function Chats() {
|
|||||||
headerStyle: { backgroundColor: colors.bg },
|
headerStyle: { backgroundColor: colors.bg },
|
||||||
headerTitleStyle: { color: colors.text },
|
headerTitleStyle: { color: colors.text },
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<Pressable onPress={confirmLogout} hitSlop={10}>
|
<Pressable onPress={() => router.push('/(app)/settings')} hitSlop={10}>
|
||||||
<Text style={styles.logoutLink}>Abmelden</Text>
|
<Text style={styles.logoutLink}>Einstellungen</Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user