-
-
Notifications
You must be signed in to change notification settings - Fork 645
Description
// App.js
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { HomeScreen } from './screens/HomeScreen';
import { FirstYearScreen } from './screens/FirstYearScreen';
import { SubjectScreen } from './screens/SubjectScreen';
import { ChapterScreen } from './screens/ChapterScreen';
const Stack = createNativeStackNavigator();
export default function App() {
return (
<Stack.Navigator initialRouteName="Home">
<Stack.Screen
name="Home"
component={HomeScreen}
options={{ title: 'NESH' }}
/>
<Stack.Screen
name="FirstYear"
component={FirstYearScreen}
options={{ title: 'First Year' }}
/>
<Stack.Screen
name="Subject"
component={SubjectScreen}
options={({ route }) => ({ title: route.params.subjectName })}
/>
<Stack.Screen
name="Chapter"
component={ChapterScreen}
options={({ route }) => ({ title: route.params.chapterName })}
/>
</Stack.Navigator>
);
}
// screens/HomeScreen.js
import React from 'react';
import { View, StyleSheet, ScrollView } from 'react-native';
import { YearCard } from '../components/YearCard';
export function HomeScreen({ navigation }) {
return (
<YearCard
year="First Year"
onPress={() => navigation.navigate('FirstYear')}
isActive={true}
/>
);
}
// components/YearCard.js
import React from 'react';
import { TouchableOpacity, Text, StyleSheet } from 'react-native';
export function YearCard({ year, onPress, isActive }) {
return (
<TouchableOpacity
style={[styles.card, !isActive && styles.inactive]}
onPress={onPress}
disabled={!isActive}
>
{year}
{!isActive && Coming Soon}
);
}
// data/subjects.js
export const subjects = {
'Applied Mathematics-I': {
modules: [
{
name: 'Complex Numbers',
topics: [
'Review of Complex Numbers',
'Algebra of Complex Numbers',
'Cartesian, polar and exponential form',
"D'Moivre's Theorem",
'Expansion of sinnθ, cosnθ',
'Powers and Roots of complex numbers'
],
hours: 4,
coMapping: 'CO1'
},
// Add other modules here
]
},
'Applied Physics': {
modules: [
{
name: 'Lasers',
topics: [
'Spontaneous and stimulated emission',
'Population inversion',
'Pumping, active medium & active center',
'Resonant cavity',
'Coherence length and coherence time',
'Characteristics of lasers',
'He-Ne laser: construction and working',
'Fiber laser Construction and working'
],
hours: 4,
coMapping: 'CO1'
},
// Add other modules here
]
},
// Add other subjects here
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#f5f5f5',
},
grid: {
padding: 16,
flexDirection: 'row',
flexWrap: 'wrap',
justifyContent: 'space-between',
},
card: {
backgroundColor: 'white',
borderRadius: 8,
padding: 16,
marginBottom: 16,
width: '48%',
alignItems: 'center',
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.1,
shadowRadius: 4,
elevation: 3,
},
inactive: {
opacity: 0.7,
},
yearText: {
fontSize: 18,
fontWeight: 'bold',
color: '#1a237e',
},
comingSoon: {
fontSize: 12,
color: '#666',
marginTop: 4,
},
});