fitst commit

This commit is contained in:
Samandar Turgunboyev
2026-01-28 18:26:50 +05:00
parent 166a55b1e9
commit 124798419b
196 changed files with 26627 additions and 421 deletions

143
app/(dashboard)/_layout.tsx Normal file
View File

@@ -0,0 +1,143 @@
import { useTheme } from '@/components/ThemeContext';
import { RefreshProvider } from '@/components/ui/RefreshContext';
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
import { Tabs } from 'expo-router';
import { Home, Megaphone, PlusCircle, User } from 'lucide-react-native';
import { useTranslation } from 'react-i18next';
import { Text } from 'react-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
export default function TabsLayout() {
const { isDark } = useTheme();
const { t } = useTranslation();
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<RefreshProvider>
<BottomSheetModalProvider>
<Tabs
screenOptions={{
headerShown: false,
tabBarStyle: {
position: 'absolute',
left: 16,
right: 16,
bottom: 0,
height: 70,
borderTopLeftRadius: 16,
borderTopRightRadius: 16,
backgroundColor: isDark ? '#0f172a' : '#fff',
borderWidth: 1,
borderColor: isDark ? '#334155' : '#e2e8f0',
shadowColor: '#000',
shadowOpacity: isDark ? 0.5 : 0.1,
shadowOffset: { width: 0, height: -3 },
shadowRadius: isDark ? 12 : 10,
elevation: 8,
overflow: 'hidden',
},
tabBarActiveTintColor: '#3b82f6',
tabBarInactiveTintColor: isDark ? '#64748b' : '#94a3b8',
tabBarLabelStyle: { fontSize: 12, fontWeight: '600' },
tabBarItemStyle: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'flex-start',
alignContent: 'center',
},
tabBarLabelPosition: 'below-icon',
}}
>
<Tabs.Screen
name="index"
options={{
tabBarLabel: ({ color }) => (
<Text
style={{
color: color,
fontSize: 12,
fontWeight: '600',
textAlign: 'center',
flexWrap: 'wrap',
width: 80, // yetarli joy berish
}}
numberOfLines={2} // 2 qatorga sigadi
>
{t('Bosh sahifa')}
</Text>
),
tabBarIcon: ({ color, size }) => <Home color={color} size={size} />,
}}
/>
<Tabs.Screen
name="create-announcements"
options={{
tabBarLabel: ({ focused, color }) => (
<Text
style={{
color: color,
fontSize: 12,
fontWeight: '600',
textAlign: 'center',
flexWrap: 'wrap',
width: 80, // yetarli joy berish
}}
numberOfLines={2} // 2 qatorga sigadi
>
{t("E'lon joylashtirish")}
</Text>
),
tabBarIcon: ({ color, size }) => <PlusCircle color={color} size={size} />,
}}
/>
<Tabs.Screen
name="announcements"
options={{
tabBarLabel: ({ focused, color }) => (
<Text
style={{
color: color,
fontSize: 12,
fontWeight: '600',
textAlign: 'center',
flexWrap: 'wrap',
width: 80, // yetarli joy berish
}}
numberOfLines={2} // 2 qatorga sigadi
>
{t("E'lonlar")}
</Text>
),
tabBarIcon: ({ color, size }) => <Megaphone color={color} size={size} />,
}}
/>
<Tabs.Screen
name="profile"
options={{
tabBarLabel: ({ focused, color }) => (
<Text
style={{
color: color,
fontSize: 12,
fontWeight: '600',
textAlign: 'center',
flexWrap: 'wrap',
width: 80, // yetarli joy berish
}}
numberOfLines={2} // 2 qatorga sigadi
>
{t('Profil')}
</Text>
),
tabBarIcon: ({ color, size }) => <User color={color} size={size} />,
}}
/>
</Tabs>
</BottomSheetModalProvider>
</RefreshProvider>
</GestureHandlerRootView>
);
}

View File

@@ -0,0 +1,21 @@
import { useTheme } from '@/components/ThemeContext';
import { FilterProvider } from '@/components/ui/FilterContext';
import { CustomHeader } from '@/components/ui/Header';
import DashboardScreen from '@/screens/announcements/ui/AnnouncementsList';
import { Stack } from 'expo-router';
import { SafeAreaView } from 'react-native-safe-area-context';
export default function Announcements() {
const { isDark } = useTheme();
return (
<FilterProvider>
<SafeAreaView
style={{ flex: 1, backgroundColor: isDark ? '#0f172a' : '#ffffff', paddingBottom: 50 }}
>
<CustomHeader />
<Stack.Screen options={{ title: "E'lonlar" }} />
<DashboardScreen />
</SafeAreaView>
</FilterProvider>
);
}

View File

@@ -0,0 +1,17 @@
import { useTheme } from '@/components/ThemeContext';
import { FilterProvider } from '@/components/ui/FilterContext';
import { CustomHeader } from '@/components/ui/Header';
import CreateAdsScreens from '@/screens/create-ads/ui/CreateAdsScreens';
import { SafeAreaView } from 'react-native-safe-area-context';
export default function CreateAnnouncements() {
const { isDark } = useTheme();
return (
<FilterProvider>
<SafeAreaView style={{ flex: 1, backgroundColor: isDark ? '#0f172a' : '#ffffff' }}>
<CustomHeader />
<CreateAdsScreens />
</SafeAreaView>
</FilterProvider>
);
}

33
app/(dashboard)/index.tsx Normal file
View File

@@ -0,0 +1,33 @@
// pages/home/index.tsx
import { useAuth } from '@/components/AuthProvider';
import { useTheme } from '@/components/ThemeContext';
import { FilterProvider } from '@/components/ui/FilterContext';
import { CustomHeader } from '@/components/ui/Header';
import HomeScreen from '@/screens/home/ui/HomeScreen';
import { router } from 'expo-router';
import { useEffect } from 'react';
import { SafeAreaView } from 'react-native-safe-area-context';
export default function Index() {
const { isDark } = useTheme();
const { isAuthenticated, isLoading } = useAuth();
useEffect(() => {
if (!isLoading && !isAuthenticated) {
router.replace('/(auth)');
}
}, [isAuthenticated, isLoading]);
if (isLoading || !isAuthenticated) {
return null; // Loading vaqtida yoki auth yoq bolsa hech narsa kormasin
}
return (
<FilterProvider>
<SafeAreaView style={{ flex: 1, backgroundColor: isDark ? '#0f172a' : '#ffffff' }}>
<CustomHeader />
<HomeScreen />
</SafeAreaView>
</FilterProvider>
);
}

View File

@@ -0,0 +1,17 @@
import { useTheme } from '@/components/ThemeContext';
import { CustomHeader } from '@/components/ui/Header';
import Profile from '@/screens/profile/ui/ProfileScreen';
import { SafeAreaView } from 'react-native-safe-area-context';
export default function ProfileScreen() {
const { isDark } = useTheme();
return (
<SafeAreaView
style={{ flex: 1, backgroundColor: isDark ? '#0f172a' : '#ffffff', paddingBottom: 30 }}
edges={['top']}
>
<CustomHeader logoutbtn={true} />
<Profile />
</SafeAreaView>
);
}