- Updated modal state management by introducing separate states for each service modal. - Changed service titles to localized versions in Turkmen. - Improved CurrencyConverterModal integration by updating visibility state and placeholder text color for better user experience.
81 lines
2.3 KiB
TypeScript
81 lines
2.3 KiB
TypeScript
import { StyleSheet, SafeAreaView, View, TouchableOpacity, Dimensions } from 'react-native';
|
|
import { Text } from '@/components/Themed';
|
|
import i18n from '@/i18n';
|
|
import { FontAwesome5 } from '@expo/vector-icons';
|
|
import ServiceCard from '@/components/ServiceCard';
|
|
import React, { useState } from 'react';
|
|
import CurrencyConverterModal from '@/components/CurrencyConverterModal';
|
|
|
|
export default function ServicesScreen() {
|
|
const [currencyModalVisible, setCurrencyModalVisible] = useState(false);
|
|
const [hotelModalVisible, setHotelModalVisible] = useState(false);
|
|
const [lostKeyModalVisible, setLostKeyModalVisible] = useState(false);
|
|
const [translatorModalVisible, setTranslatorModalVisible] = useState(false);
|
|
|
|
const services = [
|
|
{
|
|
title: 'Pul',
|
|
name: 'currencyConverter',
|
|
icon: <FontAwesome5 name="dollar-sign" size={24} color="#D4AF37" />,
|
|
onPress: () => setCurrencyModalVisible(true),
|
|
},
|
|
{
|
|
title: 'Otel',
|
|
name: 'hotelCard',
|
|
icon: <FontAwesome5 name="hotel" size={24} color="#D4AF37" />,
|
|
onPress: () => setHotelModalVisible(true),
|
|
},
|
|
{
|
|
title: 'Açar içinde galdy',
|
|
name: 'lostKey',
|
|
icon: <FontAwesome5 name="key" size={24} color="#D4AF37" />,
|
|
onPress: () => setLostKeyModalVisible(true),
|
|
},
|
|
{
|
|
title: 'Perewod',
|
|
name: 'translator',
|
|
icon: <FontAwesome5 name="language" size={24} color="#D4AF37" />,
|
|
onPress: () => setTranslatorModalVisible(true),
|
|
},
|
|
];
|
|
|
|
return (
|
|
<SafeAreaView style={styles.container}>
|
|
<Text style={styles.title}>{i18n.t('services')}</Text>
|
|
|
|
<View style={styles.grid}>
|
|
{services.map((service, index) => (
|
|
<TouchableOpacity key={index} style={styles.cardContainer} onPress={service.onPress}>
|
|
<ServiceCard title={service.title} icon={service.icon} />
|
|
</TouchableOpacity>
|
|
))}
|
|
</View>
|
|
<CurrencyConverterModal
|
|
visible={currencyModalVisible}
|
|
onClose={() => setCurrencyModalVisible(false)}
|
|
/>
|
|
</SafeAreaView>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
},
|
|
title: {
|
|
fontSize: 22,
|
|
fontWeight: 'bold',
|
|
marginVertical: 15,
|
|
marginLeft: 15,
|
|
},
|
|
grid: {
|
|
flexDirection: 'row',
|
|
flexWrap: 'wrap',
|
|
marginLeft: 15,
|
|
},
|
|
cardContainer: {
|
|
width: '50%',
|
|
marginBottom: 15,
|
|
},
|
|
});
|