import { useNavigation } from '@react-navigation/native'; import { NativeStackNavigationProp } from '@react-navigation/native-stack'; import { useQuery } from '@tanstack/react-query'; import reference_api from 'api/reference'; import AppText from 'components/AppText'; import LayoutTwo from 'components/LayoutTwo'; import * as React from 'react'; import { useTranslation } from 'react-i18next'; import { Linking, ScrollView, StyleSheet, TouchableOpacity, View, } from 'react-native'; import AppLink from 'react-native-app-link'; import Tabs from '../../home/ui/Tabs'; interface CargoPricesProps {} const CargoPrices = (props: CargoPricesProps) => { const { t } = useTranslation(); const [activeTab, setActiveTab] = React.useState<'AVIA' | 'AUTO'>('AVIA'); const navigation = useNavigation>(); const { data, refetch } = useQuery({ queryKey: ['reference_list'], queryFn: () => reference_api.getReference({ cargoType: activeTab }), }); React.useEffect(() => { refetch(); }, [activeTab]); const openTelegram = React.useCallback(async () => { try { await AppLink.maybeOpenURL('tg://resolve?domain=cpost_admin', { appName: 'Telegram', appStoreId: 686449807, appStoreLocale: 'us', playStoreId: 'org.telegram.messenger', }); } catch (err) { Linking.openURL('https://t.me/cpost_admin'); } }, []); return ( {activeTab === 'AVIA' && ( {data && data.map(ref => ( {ref.title} {ref.price}$/{ref.unitValue} {ref.unit} {ref.shortDescription} ))} {t( 'Avia pochtada bir maxsulotdan seriyalab olish mumkin emas', )} {t( '(Bu kargo narxini o’sishiga olib keladi. Seriyali buyularni avto kargo orqali olib kelish arzonga tushadi)', )} {t('Yetib kelish vaqti')} 7-10 {t('kun')} {t( 'Yuklarni yetib elish vaqti oxirgi qadoqlash kunidan boshlab xisoblanadi', )} {t('Minimal miqdor talab qilinmaydi.')} {t( "ya'ni, qancha gramm mahsulot olsangiz, shuncha og'irligi (gramm) uchun to'lov qilasiz.", )} {t('Muhim!')} {t('Filiallargacha yetkazib berish - bepul.')} {t('Batafsil')}:{' '} @cpost_admin {t( "Agar siz yashayotgan hududda bizning filialimiz mavjud bo'lmasa, o'zingizga eng yaqin bo'lgan filialni tanlab, ro'yhatdan o'tishingiz mumkin.", )} navigation.navigate('ListBranches')} > {t("Filiallarimiz ro'yhati ilovada mavjud")} )} {activeTab === 'AUTO' && ( {data && data.map(ref => ( {ref.title} {ref.price}$/{ref.unitValue} {ref.unit} {ref.shortDescription} ))} {t( 'Avto kargoda bir maxsulotdan seriyalab istalgan katta miqdorda olish mumkin. Doimiyko’p yuk oluvchi ijozlar uchun maxsus arzonlashtrilgan narxlarimiz bor', )} {t('Yetib kelish vaqti')} 10-20 {t('kun')} {t( 'Yuklarni yetib elish vaqti oxirgi qadoqlash kunidan boshlab xisoblanadi', )} {t('Minimal miqdor talab qilinmaydi.')} {t( "ya'ni, qancha gramm mahsulot olsangiz, shuncha og'irligi (gramm) uchun to'lov qilasiz.", )} {t('Muhim!')} {t('Filiallargacha yetkazib berish - bepul.')} {t('Batafsil')}:{' '} @cpost_admin {t( "Agar siz yashayotgan hududda bizning filialimiz mavjud bo'lmasa, o'zingizga eng yaqin bo'lgan filialni tanlab, ro'yhatdan o'tishingiz mumkin.", )} navigation.navigate('ListBranches')} > {t("Filiallarimiz ro'yhati ilovada mavjud")} )} ); }; export default CargoPrices; const styles = StyleSheet.create({ container: { marginTop: 10, }, card: { width: '95%', gap: 5, margin: 'auto', }, cardWhite: { backgroundColor: '#FFFFFF', width: '95%', gap: 5, margin: 'auto', padding: 10, borderRadius: 8, paddingVertical: 15, paddingHorizontal: 12, shadowColor: '#000', shadowOffset: { width: 0, height: 1 }, shadowOpacity: 0.1, shadowRadius: 2, elevation: 1, }, titleBlack: { fontSize: 16, fontWeight: '500', }, desc: { color: '#000000B2', fontSize: 14, fontWeight: '400', }, priceCard: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', }, });