Skip to content

Commit

Permalink
App debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamoziit committed Jan 3, 2025
1 parent 49f7854 commit 8434828
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 24 deletions.
34 changes: 20 additions & 14 deletions android/frontend/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import PersonalizedDashboard from './src/screens/PersonalizedDashboard';
import DashboardList from './src/screens/RegionalDashboardList';
import RegionalDashboard from './src/screens/RegionalDashboard';
import Contribute from './src/screens/Contribute';
import { EnrollmentContextProvider } from './src/context/EnrollmentContext';
import { ElevatedUserContextProvider } from './src/context/ElevatedUserContext';

const Stack = createNativeStackNavigator<RootStackParamList>();

Expand All @@ -29,20 +31,24 @@ function App() {
return (
<Provider store={store}>
<AuthContextProvider>
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen options={{ headerShown: true }} name="Login" component={Login} />
<Stack.Screen name="MainContainer" options={{ title: "KisanSahayak" }} component={MainContainer} />
<Stack.Screen name="ProductDetails" options={{ title: "Product Details" }} component={ProductDetails} />
<Stack.Screen name="Sell" options={{ title: "Sell Item" }} component={MarketplaceSell} />
<Stack.Screen name="MyListings" options={{ title: "Creator Dashboard" }} component={MyListings} />
<Stack.Screen name="History" options={{ title: "History" }} component={History} />
<Stack.Screen name="PersonalizedDashboard" options={{ title: "Personalized Dashboard" }} component={PersonalizedDashboard} />
<Stack.Screen name="OthersDashboard" options={{ title: "Others Dashboard" }} component={DashboardList} />
<Stack.Screen name="RegionalDashboard" options={{ title: "Regional Dashboard" }} component={RegionalDashboard} />
<Stack.Screen name="Contribute" options={{ title: "Contribute" }} component={Contribute} />
</Stack.Navigator>
</NavigationContainer>
<EnrollmentContextProvider>
<ElevatedUserContextProvider>
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen options={{ headerShown: true }} name="Login" component={Login} />
<Stack.Screen name="MainContainer" options={{ title: "KisanSahayak" }} component={MainContainer} />
<Stack.Screen name="ProductDetails" options={{ title: "Product Details" }} component={ProductDetails} />
<Stack.Screen name="Sell" options={{ title: "Sell Item" }} component={MarketplaceSell} />
<Stack.Screen name="MyListings" options={{ title: "Creator Dashboard" }} component={MyListings} />
<Stack.Screen name="History" options={{ title: "History" }} component={History} />
<Stack.Screen name="PersonalizedDashboard" options={{ title: "Personalized Dashboard" }} component={PersonalizedDashboard} />
<Stack.Screen name="OthersDashboard" options={{ title: "Others Dashboard" }} component={DashboardList} />
<Stack.Screen name="RegionalDashboard" options={{ title: "Regional Dashboard" }} component={RegionalDashboard} />
<Stack.Screen name="Contribute" options={{ title: "Contribute" }} component={Contribute} />
</Stack.Navigator>
</NavigationContainer>
</ElevatedUserContextProvider>
</EnrollmentContextProvider>
</AuthContextProvider>
</Provider>
);
Expand Down
4 changes: 3 additions & 1 deletion android/frontend/src/hooks/useCreateMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ const useCreateMetadata = () => {

if (data) {
await AsyncStorage.setItem("KS-enrolledUser", JSON.stringify(data));
const user = await AsyncStorage.getItem("KS-enrolledUser");
console.log(user);
setEnrolledUser(data);
// toast.success("Enrolled successfully");
}
} catch (error) {
// toast.error(error.message);
console.log(error);
} finally {
setLoading(false);
}
Expand Down
20 changes: 11 additions & 9 deletions android/frontend/src/screens/Contribute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import {
StyleSheet,
ActivityIndicator,
} from "react-native";
import { FaCheck } from "react-icons/fa";
import { RiCloseLargeFill } from "react-icons/ri";
import { VscGraph } from "react-icons/vsc";
import { MdEnergySavingsLeaf } from "react-icons/md";
import Icon from "react-native-vector-icons/FontAwesome";
import MaterialIcon from "react-native-vector-icons/MaterialIcons";
import Ionicon from "react-native-vector-icons/Ionicons";
import { useEnrollmentContext } from "../context/EnrollmentContext";
import { useElevatedUserContext } from "../context/ElevatedUserContext";
import useCreateMetadata from "../hooks/useCreateMetadata";
Expand Down Expand Up @@ -42,25 +41,28 @@ const Contribute = () => {
<>
<View style={styles.statsContainer}>
<View style={[styles.statBox, { backgroundColor: "#A7F3D0" }]}>
<FaCheck style={[styles.icon, { color: "#065F46" }]} />
<Icon name="check" style={[styles.icon, { color: "#065F46" }]} />
<Text style={[styles.statText, { color: "#065F46" }]}>
{enrolledUser?.correct}
</Text>
</View>
<View style={[styles.statBox, { backgroundColor: "#FECACA" }]}>
<RiCloseLargeFill style={[styles.icon, { color: "#991B1B" }]} />
<Ionicon name="close-circle" style={[styles.icon, { color: "#991B1B" }]} />
<Text style={[styles.statText, { color: "#991B1B" }]}>
{enrolledUser?.incorrect}
</Text>
</View>
<View style={[styles.statBox, { backgroundColor: "#D1D5DB" }]}>
<VscGraph style={[styles.icon, { color: "#374151" }]} />
<Ionicon name="stats-chart" style={[styles.icon, { color: "#374151" }]} />
<Text style={[styles.statText, { color: "#374151" }]}>
{accuracyCalc()}%
</Text>
</View>
<View style={[styles.statBox, { backgroundColor: "#FDE68A" }]}>
<MdEnergySavingsLeaf style={[styles.icon, { color: "#065F46" }]} />
<MaterialIcon
name="eco"
style={[styles.icon, { color: "#065F46" }]}
/>
<Text style={[styles.statText, { color: "#065F46" }]}>
{enrolledUser?.greenPoints.toFixed(2)}
</Text>
Expand Down Expand Up @@ -204,4 +206,4 @@ const styles = StyleSheet.create({
},
});

export default Contribute;
export default Contribute;
1 change: 1 addition & 0 deletions android/frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type RootStackParamList = {
PersonalizedDashboard: undefined;
OthersDashboard: undefined;
RegionalDashboard: { district: string };
Contribute: undefined;
};

export type Product = {
Expand Down

0 comments on commit 8434828

Please sign in to comment.