complated

This commit is contained in:
Samandar Turgunboyev
2026-02-17 10:46:57 +05:00
parent 754f11804a
commit d747c72c8d
71 changed files with 917 additions and 397 deletions

View File

@@ -8,8 +8,10 @@ import { useTranslation } from 'react-i18next';
import {
ActivityIndicator,
FlatList,
Platform,
Pressable,
RefreshControl,
Share,
StyleSheet,
Text,
ToastAndroid,
@@ -64,9 +66,31 @@ export function ReferralsTab() {
setRefreshing(false);
};
// Clipboard + Share funksiyasi
const handleCopyAndShare = async (code: string) => {
const referralLink = `https://t.me/infotargetbot/join?startapp=${code}`;
// Clipboard-ga nusxa olish
await Clipboard.setStringAsync(referralLink);
// Share qilish
try {
await Share.share({
message: referralLink,
title: t('Referal linkni ulashish'),
});
} catch (err) {
console.log('Share error:', err);
}
if (Platform.OS === 'android') {
ToastAndroid.show(t('Refferal kopiya qilindi'), ToastAndroid.SHORT);
}
};
if (isLoading) {
return (
<SafeAreaView style={{ flex: 1 }}>
<SafeAreaView style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<ActivityIndicator size="large" />
</SafeAreaView>
);
@@ -103,26 +127,12 @@ export function ReferralsTab() {
onEndReached={() => hasNextPage && fetchNextPage()}
renderItem={({ item }) => (
<View style={[styles.card, { backgroundColor: theme.cardBg }]}>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-between',
alignContent: 'center',
alignItems: 'center',
}}
>
<View style={styles.cardRow}>
<View style={styles.cardHeader}>
<HandCoins size={20} color={theme.primary} />
<Text style={[styles.code, { color: theme.text }]}>{item.code}</Text>
</View>
<TouchableOpacity
onPress={async () => {
await Clipboard.setStringAsync(
`https://t.me/infotargetbot/join?startapp=${item.code}`
);
ToastAndroid.show('Refferal kopiya qilindi', ToastAndroid.SHORT);
}}
>
<TouchableOpacity onPress={() => handleCopyAndShare(item.code)}>
<CopyIcon size={20} color={theme.primary} />
</TouchableOpacity>
</View>
@@ -165,7 +175,7 @@ const styles = StyleSheet.create({
},
headerTitle: { fontSize: 18, fontWeight: '700' },
list: { padding: 16, gap: 12 },
list: { padding: 16, gap: 12, paddingBottom: 30 },
card: {
borderRadius: 16,
@@ -173,6 +183,13 @@ const styles = StyleSheet.create({
gap: 10,
},
cardRow: {
flexDirection: 'row',
justifyContent: 'space-between',
alignContent: 'center',
alignItems: 'center',
},
cardHeader: {
flexDirection: 'row',
gap: 8,