i want to make a screen where only admin can be redirected on his admin-panel here
import { Pressable, Text, TextInput, View, Image, TouchableOpacity, Modal } from ‘react-native’;
import { gStyle } from ‘…/styles/style’;
import { Feather } from ‘@expo/vector-icons’;
import React, { useState, useEffect } from ‘react’;
import { useNavigation } from ‘@react-navigation/native’;
import { firebase } from ‘…/Firebase/firebase’;
import ‘firebase/compat/auth’;
import ‘firebase/compat/database’;
import ‘firebase/compat/firestore’;

export default function Header() {
const [searchTerm, setSearchTerm] = useState(‘’);

const [searchResult, setSearchResult]= useState(‘’);

const navigation = useNavigation();

const handleSearch = async ()=>{
if(!searchTerm.trim()){
setSearchResult([]);
return;
}
const futureMKSnapshot = await firebase
.firestore()
.collection(‘FutureMK’)
.where(‘name’,‘>=’,searchTerm)
.where(‘name’,‘<=’,searchTerm + ‘\uf8ff’)
.get();

const pastMKSnapshot = await firebase
.firestore()
.collection(‘PastMK’)
.where(‘name’,‘>=’,searchTerm)
.where(‘name’,‘<=’,searchTerm + ‘\uf8ff’)
.get();

const futureMKData = futureMKSnapshot.docs.map(doc => ({
id: doc.id,
…doc.data(),
}));

const pastMKData = pastMKSnapshot.docs.map(doc => ({
id: doc.id,
…doc.data(),
}));

const results = […futureMKData, …pastMKData].filter(item=>
item.name.toLowerCase().includes(searchTerm.toLowerCase()));
const storage=firebase.storage();
const resultWithImages = await Promise.all(
results.map(async item=>{
try{
const imagePath=item.image;
const imageRef=storage.ref().child(imagePath);
const url = await imageRef.getDownloadURL();
return {… item, image:url};
}catch(error){
console.log(‘Ошибка загрузки изображения: ‘, error);
return item;
}
})
);
setSearchResult(resultWithImages);
navigation.navigate(‘Search’, { results: resultWithImages });
};

const [userAuthenticated, setUserAuthenticated] = useState(false);

const [isModalVisible, setIsModalVisible] = useState(false);

const showModal = () => {
setIsModalVisible(true);
};

const hideModal = () => {
setIsModalVisible(false);
};



useEffect(() => {
const unsubscribe = firebase.auth().onAuthStateChanged(user => {
if (user) {
setUserAuthenticated(true);
} else {
setUserAuthenticated(false);
}
});

return unsubscribe;
}, []);
return (
<View style={gStyle.main}>
<View style={gStyle.headerContainer}>
<Image
source={require(’…/assets/logo.png’)}
style={gStyle.logoImg}
/>
<View style={gStyle.menu}>
<TouchableOpacity onPress={showModal}>
<Text style={gStyle.menuRedLine}></Text>
<Text style={gStyle.menuRedLine}></Text>
<Text style={gStyle.menuRedLine}></Text>
<Modal visible={isModalVisible} animationType=‘fade’ transparent={true}>
<View style={gStyle.modal}>
<TouchableOpacity onPress={hideModal}>
<Text style={gStyle.close}>Х</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={()=>navigation.navigate(‘Home’)}
>
<Text style={gStyle.menuItem}>Главная</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={()=>navigation.navigate(‘AllFutureMK’)}
>
<Text style={gStyle.menuItem}>Будущие мастер-классы</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={()=>navigation.navigate(‘AllPastMK’)}
>
<Text style={gStyle.menuItem}>Архив мастер-классов</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={()=>navigation.navigate(‘Sales’)}
>

<Text style={gStyle.menuItem}>Скидки</Text>
</TouchableOpacity>
{userAuthenticated ?
<TouchableOpacity
onPress={()=>navigation.navigate(‘Profile’)}
>
<Text style={gStyle.menuItem}>Личный кабинет</Text>
</TouchableOpacity>
:
<TouchableOpacity
onPress={()=>navigation.navigate(‘Auth’)}
>
<Text style={gStyle.menuItem}>Личный кабинет</Text>
</TouchableOpacity>
}
<TouchableOpacity
onPress={()=>navigation.navigate(‘AdminPanel’)}
>
<Text style={gStyle.menuItem}>Админ-панель</Text>
</TouchableOpacity>
</View>
</Modal>
</TouchableOpacity>
</View>
</View>
<View style={gStyle.searchBox}>
<TextInput style={gStyle.search}
placeholder=“Поиск”
onChangeText={(text)=>setSearchTerm(text)}
/>
<View style={gStyle.boxBtn}>
<Pressable style={gStyle.searchBtn}
onPress={handleSearch}
>
<Feather name=“search” size={25} color=“white” />
</Pressable>
</View>
</View>
</View>
);
}