fitst commit
This commit is contained in:
143
app/(dashboard)/_layout.tsx
Normal file
143
app/(dashboard)/_layout.tsx
Normal 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 sig‘adi
|
||||
>
|
||||
{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 sig‘adi
|
||||
>
|
||||
{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 sig‘adi
|
||||
>
|
||||
{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 sig‘adi
|
||||
>
|
||||
{t('Profil')}
|
||||
</Text>
|
||||
),
|
||||
tabBarIcon: ({ color, size }) => <User color={color} size={size} />,
|
||||
}}
|
||||
/>
|
||||
</Tabs>
|
||||
</BottomSheetModalProvider>
|
||||
</RefreshProvider>
|
||||
</GestureHandlerRootView>
|
||||
);
|
||||
}
|
||||
21
app/(dashboard)/announcements.tsx
Normal file
21
app/(dashboard)/announcements.tsx
Normal 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>
|
||||
);
|
||||
}
|
||||
17
app/(dashboard)/create-announcements.tsx
Normal file
17
app/(dashboard)/create-announcements.tsx
Normal 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
33
app/(dashboard)/index.tsx
Normal 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 yo‘q bo‘lsa hech narsa ko‘rmasin
|
||||
}
|
||||
|
||||
return (
|
||||
<FilterProvider>
|
||||
<SafeAreaView style={{ flex: 1, backgroundColor: isDark ? '#0f172a' : '#ffffff' }}>
|
||||
<CustomHeader />
|
||||
<HomeScreen />
|
||||
</SafeAreaView>
|
||||
</FilterProvider>
|
||||
);
|
||||
}
|
||||
17
app/(dashboard)/profile.tsx
Normal file
17
app/(dashboard)/profile.tsx
Normal 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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user