1
0
mirror of https://gitlab.com/ceda_ei/sonzai.git synced 2025-10-23 20:20:06 +02:00

Compare commits

..

4 Commits

Author SHA1 Message Date
7425b566d5 Do not show Timetable till subjects are not added. 2020-03-29 13:45:27 +05:30
265485acb1 Auto close snackbar. 2020-03-29 13:39:17 +05:30
e151e51eb0 Enable Hermes 2020-03-28 23:04:56 +05:30
6eadc6739f Replace BottomNavigation with react-native-tab-view.
Squashed commit of the following:

commit e4dd4768b7
Author: Ceda EI <ceda_ei@webionite.com>
Date:   Sat Mar 28 16:45:18 2020 +0530

    Style tab navigation.

commit 6a6795c7fb
Author: Ceda EI <ceda_ei@webionite.com>
Date:   Thu Mar 26 04:05:50 2020 +0530

    Add basic working model using react-native-tab-view.
2020-03-28 18:18:49 +05:30
3 changed files with 27 additions and 12 deletions

View File

@@ -77,7 +77,7 @@ import com.android.build.OutputFile
project.ext.react = [ project.ext.react = [
entryFile: "index.js", entryFile: "index.js",
enableHermes: false, // clean and rebuild if changing enableHermes: true, // clean and rebuild if changing
] ]
apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/react-native/react.gradle"

View File

@@ -2,6 +2,7 @@ import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { import {
Portal, Portal,
Text,
} from "react-native-paper"; } from "react-native-paper";
import { createStackNavigator } from "@react-navigation/stack"; import { createStackNavigator } from "@react-navigation/stack";
@@ -12,6 +13,17 @@ const Stack = createStackNavigator();
export default function Timetable({ addTimetableEntry, removeTimetableEntry, timetable, subjects }) { export default function Timetable({ addTimetableEntry, removeTimetableEntry, timetable, subjects }) {
const days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; const days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
if (subjects.length === 0) {
return (
<Text
style={{
textAlign: "center",
marginTop: 12,
}}
>
No Subjects added. Add Subjects first.
</Text>);
}
return ( return (
<Portal.Host><Stack.Navigator headerMode="none"> <Portal.Host><Stack.Navigator headerMode="none">
<Stack.Screen name="Timetable"> <Stack.Screen name="Timetable">

View File

@@ -47,19 +47,22 @@ function AddEntry({addTimetableEntry, days, day, subjects, navigation }) {
} }
function submit() { function submit() {
if (subject.id === null) { let message = "";
setSnackbar({ visible: true, message: "Missing subject." }); if (subject.id === null)
return; message = "Missing Subject";
} else if (start === null) { else if (start === null)
setSnackbar({ visible: true, message: "Missing start time." }); message = "Missing start time.";
return; else if (end === null)
} else if (end === null) { message = "Missing end time.";
setSnackbar({ visible: true, message: "Missing end time." }); else if (count === 0)
return; message = "Missing count.";
} else if (count === 0) {
setSnackbar({ visible: true, message: "Missing count." }); if (message !== "") {
setSnackbar({visible: true, message: message});
setTimeout(() => setSnackbar({ visible: false, message: null }), 2000);
return; return;
} }
addTimetableEntry(day, { addTimetableEntry(day, {
sub_id: subject.id, sub_id: subject.id,
count, count,