mirror of
https://gitlab.com/ceda_ei/sonzai.git
synced 2025-10-24 04:30:06 +02:00
Compare commits
2 Commits
master
...
react-nati
| Author | SHA1 | Date | |
|---|---|---|---|
| e4dd4768b7 | |||
| 6a6795c7fb |
@@ -1,34 +0,0 @@
|
|||||||
stages:
|
|
||||||
- build
|
|
||||||
- deploy
|
|
||||||
|
|
||||||
build:
|
|
||||||
image: reactnativecommunity/react-native-android
|
|
||||||
stage: build
|
|
||||||
script:
|
|
||||||
- yarn install
|
|
||||||
- cd android && chmod +x gradlew
|
|
||||||
- ./gradlew assembleRelease
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- android/app/build/outputs/
|
|
||||||
|
|
||||||
|
|
||||||
deploy_tg:
|
|
||||||
image: curlimages/curl
|
|
||||||
stage: deploy
|
|
||||||
script:
|
|
||||||
- >-
|
|
||||||
curl
|
|
||||||
-F chat_id=$TG_CHAT_ID
|
|
||||||
-F document=@android/app/build/outputs/apk/release/app-release.apk
|
|
||||||
-F caption=" <b>Branch</b>: <code>$CI_COMMIT_BRANCH</code>
|
|
||||||
|
|
||||||
<b>Commit</b>: <code>$CI_COMMIT_SHORT_SHA</code>
|
|
||||||
|
|
||||||
<b>Tag(if any)</b>: <code>$CI_COMMIT_TAG</code>
|
|
||||||
|
|
||||||
|
|
||||||
<code>$CI_COMMIT_MESSAGE</code>"
|
|
||||||
-F parse_mode=html
|
|
||||||
https://api.telegram.org/bot${TG_BOT_TOKEN}/sendDocument
|
|
||||||
19
README.md
19
README.md
@@ -1,19 +0,0 @@
|
|||||||
# Sonzai
|
|
||||||
|
|
||||||
Attendance Management App.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
### Pre-built APKs
|
|
||||||
|
|
||||||
+ TG: [Sonzai Staging Builds](https://t.me/sonzai_builds)
|
|
||||||
|
|
||||||
Currently, the APKs are being published to a telegram channel via GitLab CI/CD.
|
|
||||||
Once the app reaches v1.0, it will be published on Google Play and F-Droid.
|
|
||||||
|
|
||||||
### Manual Builds
|
|
||||||
|
|
||||||
+ Setup react native dev environment by following React Native CLI Quickstart
|
|
||||||
Guide [here](https://reactnative.dev/docs/environment-setup)
|
|
||||||
+ `yarn install`
|
|
||||||
+ `cd android; ./gradlew assembleRelease`
|
|
||||||
@@ -9,26 +9,6 @@ import {
|
|||||||
|
|
||||||
export default function InputDialog({ visible, onOK, onDismiss, title, label, placeholder }) {
|
export default function InputDialog({ visible, onOK, onDismiss, title, label, placeholder }) {
|
||||||
const [ text, setText ] = useState("");
|
const [ text, setText ] = useState("");
|
||||||
const [ error, setError ] = useState(false);
|
|
||||||
|
|
||||||
function onChangeText(text) {
|
|
||||||
setText(text);
|
|
||||||
setError(text === "");
|
|
||||||
}
|
|
||||||
|
|
||||||
function onCancel() {
|
|
||||||
onDismiss();
|
|
||||||
setText("");
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDone() {
|
|
||||||
if (text === "") {
|
|
||||||
setError(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
onOK(text);
|
|
||||||
setText("");
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<Portal>
|
<Portal>
|
||||||
<Dialog
|
<Dialog
|
||||||
@@ -40,14 +20,13 @@ export default function InputDialog({ visible, onOK, onDismiss, title, label, pl
|
|||||||
label={label}
|
label={label}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
value={text}
|
value={text}
|
||||||
onChangeText={onChangeText}
|
onChangeText={text => setText(text)}
|
||||||
mode="outlined"
|
mode="outlined"
|
||||||
error={error}
|
|
||||||
/>
|
/>
|
||||||
</Dialog.Content>
|
</Dialog.Content>
|
||||||
<Dialog.Actions>
|
<Dialog.Actions>
|
||||||
<Button onPress={onCancel}>Cancel</Button>
|
<Button onPress={() => {onDismiss(); setText("");}}>Cancel</Button>
|
||||||
<Button onPress={onDone}>Done</Button>
|
<Button onPress={() => {onOK(text); setText("");}}>OK</Button>
|
||||||
</Dialog.Actions>
|
</Dialog.Actions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</Portal>
|
</Portal>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {
|
|||||||
Card,
|
Card,
|
||||||
FAB,
|
FAB,
|
||||||
Portal,
|
Portal,
|
||||||
Snackbar,
|
|
||||||
Text,
|
Text,
|
||||||
withTheme
|
withTheme
|
||||||
} from "react-native-paper";
|
} from "react-native-paper";
|
||||||
@@ -17,21 +16,12 @@ import {
|
|||||||
|
|
||||||
import InputDialog from "./InputDialog";
|
import InputDialog from "./InputDialog";
|
||||||
|
|
||||||
function Subjects({ theme, subjects, timetable, addSubject, removeSubject }) {
|
function Subjects({ theme, subjects, addSubject, removeSubject }) {
|
||||||
const [ showDialog, setShowDialog ] = useState(false);
|
const [ showDialog, setShowDialog ] = useState(false);
|
||||||
const [ snackbar, setSnackbar ] = useState(false);
|
|
||||||
function onInput(text) {
|
function onInput(text) {
|
||||||
addSubject(text);
|
addSubject(text);
|
||||||
setShowDialog(false);
|
setShowDialog(false);
|
||||||
}
|
}
|
||||||
function deleteSubject(id) {
|
|
||||||
if (timetable.reduce((acc, val) => acc.concat(val), []).filter(i => i.sub_id === id).length){
|
|
||||||
setSnackbar(true);
|
|
||||||
setTimeout(() => setSnackbar(false), 2000);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
removeSubject(id);
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<Portal.Host><ScrollView style={{ backgroundColor: theme.colors.background }}>
|
<Portal.Host><ScrollView style={{ backgroundColor: theme.colors.background }}>
|
||||||
{subjects.length === 0 ?
|
{subjects.length === 0 ?
|
||||||
@@ -53,7 +43,7 @@ function Subjects({ theme, subjects, timetable, addSubject, removeSubject }) {
|
|||||||
<Card.Title title={subject.name} />
|
<Card.Title title={subject.name} />
|
||||||
<Card.Actions style={{justifyContent: "flex-end"}}>
|
<Card.Actions style={{justifyContent: "flex-end"}}>
|
||||||
<IconButton
|
<IconButton
|
||||||
onPress={() => deleteSubject(subject.id)}
|
onPress={() => removeSubject(subject.id)}
|
||||||
icon="delete"
|
icon="delete"
|
||||||
color={theme.colors.primary}
|
color={theme.colors.primary}
|
||||||
/>
|
/>
|
||||||
@@ -73,7 +63,6 @@ function Subjects({ theme, subjects, timetable, addSubject, removeSubject }) {
|
|||||||
large
|
large
|
||||||
icon="plus"
|
icon="plus"
|
||||||
onPress={() => setShowDialog(true)}
|
onPress={() => setShowDialog(true)}
|
||||||
visible={!snackbar}
|
|
||||||
style={{
|
style={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
margin: 16,
|
margin: 16,
|
||||||
@@ -81,16 +70,6 @@ function Subjects({ theme, subjects, timetable, addSubject, removeSubject }) {
|
|||||||
bottom: 0,
|
bottom: 0,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Snackbar
|
|
||||||
visible={snackbar}
|
|
||||||
onDismiss={() => setSnackbar(false)}
|
|
||||||
action={{
|
|
||||||
label: "Dismiss",
|
|
||||||
onPress: () => setSnackbar(false),
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Subject is in use in TimeTable.
|
|
||||||
</Snackbar>
|
|
||||||
</Portal>
|
</Portal>
|
||||||
</ScrollView></Portal.Host>
|
</ScrollView></Portal.Host>
|
||||||
);
|
);
|
||||||
@@ -98,7 +77,6 @@ function Subjects({ theme, subjects, timetable, addSubject, removeSubject }) {
|
|||||||
|
|
||||||
Subjects.propTypes = {
|
Subjects.propTypes = {
|
||||||
subjects: PropTypes.array,
|
subjects: PropTypes.array,
|
||||||
timetable: PropTypes.array,
|
|
||||||
addSubject: PropTypes.func,
|
addSubject: PropTypes.func,
|
||||||
removeSubject: PropTypes.func,
|
removeSubject: PropTypes.func,
|
||||||
theme: PropTypes.object,
|
theme: PropTypes.object,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ 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";
|
||||||
|
|
||||||
@@ -13,17 +12,6 @@ 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">
|
||||||
@@ -37,16 +25,19 @@ export default function Timetable({ addTimetableEntry, removeTimetableEntry, tim
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Stack.Screen>
|
</Stack.Screen>
|
||||||
<Stack.Screen name="New Entry">
|
{days.map((day, idx) => (
|
||||||
{(props) => (
|
<Stack.Screen name={`New Entry ${day}`} key={idx}>
|
||||||
<AddEntry
|
{(props) => (
|
||||||
{...props}
|
<AddEntry
|
||||||
subjects={subjects}
|
{...props}
|
||||||
days={days}
|
subjects={subjects}
|
||||||
addTimetableEntry={addTimetableEntry}
|
day={idx}
|
||||||
/>
|
days={days}
|
||||||
)}
|
addTimetableEntry={addTimetableEntry}
|
||||||
</Stack.Screen>
|
/>
|
||||||
|
)}
|
||||||
|
</Stack.Screen>
|
||||||
|
))}
|
||||||
</Stack.Navigator></Portal.Host>
|
</Stack.Navigator></Portal.Host>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,20 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import {
|
import {
|
||||||
|
IconButton,
|
||||||
Card,
|
Card,
|
||||||
FAB,
|
FAB,
|
||||||
IconButton,
|
|
||||||
List,
|
List,
|
||||||
Menu,
|
Menu,
|
||||||
Portal,
|
Portal,
|
||||||
Snackbar,
|
Snackbar,
|
||||||
TextInput,
|
TextInput,
|
||||||
ToggleButton,
|
|
||||||
} from "react-native-paper";
|
} from "react-native-paper";
|
||||||
import {
|
import {StyleSheet} from "react-native";
|
||||||
StyleSheet,
|
|
||||||
View
|
|
||||||
} from "react-native";
|
|
||||||
import DateTimePicker from "@react-native-community/datetimepicker";
|
import DateTimePicker from "@react-native-community/datetimepicker";
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
|
|
||||||
function AddEntry({addTimetableEntry, days, subjects, navigation }) {
|
function AddEntry({addTimetableEntry, days, day, subjects, navigation }) {
|
||||||
const [ subject, setSubject ] = useState({ id: null, name: null });
|
const [ subject, setSubject ] = useState({ id: null, name: null });
|
||||||
const [ showSubjectMenu, setShowSubjectMenu ] = useState(false);
|
const [ showSubjectMenu, setShowSubjectMenu ] = useState(false);
|
||||||
const [ showTimePicker, setShowTimePicker ] = useState(false);
|
const [ showTimePicker, setShowTimePicker ] = useState(false);
|
||||||
@@ -28,7 +24,6 @@ function AddEntry({addTimetableEntry, days, subjects, navigation }) {
|
|||||||
const [ end, setEnd ] = useState(null);
|
const [ end, setEnd ] = useState(null);
|
||||||
const [ count, setCount ] = useState(0);
|
const [ count, setCount ] = useState(0);
|
||||||
const [ snackbar, setSnackbar ] = useState({ visible: false, message: "" });
|
const [ snackbar, setSnackbar ] = useState({ visible: false, message: "" });
|
||||||
const [ dayStates, setDayStates ] = useState([ true, false, false, false, false, false, false ]);
|
|
||||||
function parseCount(text) {
|
function parseCount(text) {
|
||||||
const num = parseInt(text);
|
const num = parseInt(text);
|
||||||
if (isNaN(num))
|
if (isNaN(num))
|
||||||
@@ -52,34 +47,24 @@ function AddEntry({addTimetableEntry, days, subjects, navigation }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function submit() {
|
function submit() {
|
||||||
let message = "";
|
if (subject.id === null) {
|
||||||
if (subject.id === null)
|
setSnackbar({ visible: true, message: "Missing subject." });
|
||||||
message = "Missing Subject";
|
return;
|
||||||
else if (start === null)
|
} else if (start === null) {
|
||||||
message = "Missing start time.";
|
setSnackbar({ visible: true, message: "Missing start time." });
|
||||||
else if (end === null)
|
return;
|
||||||
message = "Missing end time.";
|
} else if (end === null) {
|
||||||
else if (count === 0)
|
setSnackbar({ visible: true, message: "Missing end time." });
|
||||||
message = "Missing count.";
|
return;
|
||||||
if (! dayStates.filter(i => i).length)
|
} else if (count === 0) {
|
||||||
message = "No day selected.";
|
setSnackbar({ visible: true, message: "Missing count." });
|
||||||
|
|
||||||
if (message !== "") {
|
|
||||||
setSnackbar({visible: true, message: message});
|
|
||||||
setTimeout(() => setSnackbar({ visible: false, message: null }), 2000);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
addTimetableEntry(day, {
|
||||||
|
sub_id: subject.id,
|
||||||
dayStates.forEach((i, idx) => {
|
count,
|
||||||
if (i) {
|
start,
|
||||||
addTimetableEntry(idx, {
|
end
|
||||||
sub_id: subject.id,
|
|
||||||
count,
|
|
||||||
start,
|
|
||||||
end
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
navigation.pop();
|
navigation.pop();
|
||||||
}
|
}
|
||||||
@@ -88,7 +73,7 @@ function AddEntry({addTimetableEntry, days, subjects, navigation }) {
|
|||||||
return (<>
|
return (<>
|
||||||
<IconButton icon="arrow-left" onPress={() => navigation.pop()}/>
|
<IconButton icon="arrow-left" onPress={() => navigation.pop()}/>
|
||||||
<Card style={style.card}>
|
<Card style={style.card}>
|
||||||
<Card.Title title="Add Class" />
|
<Card.Title title={`Add Class on ${days[day]}`} />
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<List.Section>
|
<List.Section>
|
||||||
<Menu
|
<Menu
|
||||||
@@ -139,26 +124,6 @@ function AddEntry({addTimetableEntry, days, subjects, navigation }) {
|
|||||||
value={count === 0 ? "" : count.toString()}
|
value={count === 0 ? "" : count.toString()}
|
||||||
onChangeText={parseCount}
|
onChangeText={parseCount}
|
||||||
/>
|
/>
|
||||||
<View
|
|
||||||
style={style.daysContainer}
|
|
||||||
>
|
|
||||||
{dayStates.map( (i, idx) => (
|
|
||||||
<ToggleButton
|
|
||||||
key={idx}
|
|
||||||
icon={`alpha-${days[idx][0].toLowerCase()}`}
|
|
||||||
status={i ? "checked": "unchecked"}
|
|
||||||
onPress={
|
|
||||||
() =>
|
|
||||||
setDayStates([
|
|
||||||
...dayStates.slice(0, idx),
|
|
||||||
!i,
|
|
||||||
...dayStates.slice(idx + 1)
|
|
||||||
])
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</View>
|
|
||||||
</List.Section>
|
</List.Section>
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -203,8 +168,9 @@ function AddEntry({addTimetableEntry, days, subjects, navigation }) {
|
|||||||
AddEntry.propTypes = {
|
AddEntry.propTypes = {
|
||||||
addTimetableEntry: PropTypes.func,
|
addTimetableEntry: PropTypes.func,
|
||||||
subjects: PropTypes.array,
|
subjects: PropTypes.array,
|
||||||
days: PropTypes.array,
|
|
||||||
navigation: PropTypes.object,
|
navigation: PropTypes.object,
|
||||||
|
days: PropTypes.array,
|
||||||
|
day: PropTypes.number,
|
||||||
};
|
};
|
||||||
|
|
||||||
const style = StyleSheet.create({
|
const style = StyleSheet.create({
|
||||||
@@ -221,11 +187,6 @@ const style = StyleSheet.create({
|
|||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
justifyContent: "space-between"
|
justifyContent: "space-between"
|
||||||
},
|
},
|
||||||
daysContainer: {
|
|
||||||
flexDirection: "row",
|
|
||||||
justifyContent: "space-evenly",
|
|
||||||
marginTop: 10
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default AddEntry;
|
export default AddEntry;
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import PropTypes from "prop-types";
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
|
IconButton,
|
||||||
Card,
|
Card,
|
||||||
DataTable,
|
DataTable,
|
||||||
Dialog,
|
Dialog,
|
||||||
FAB,
|
|
||||||
Portal,
|
Portal,
|
||||||
Modal,
|
withTheme,
|
||||||
} from "react-native-paper";
|
} from "react-native-paper";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -17,48 +17,20 @@ import {
|
|||||||
} from "react-native";
|
} from "react-native";
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
|
|
||||||
import BottomSheet from "reanimated-bottom-sheet";
|
|
||||||
|
|
||||||
function sortTimes(t1, t2) {
|
function sortTimes(t1, t2) {
|
||||||
if (t1.getHours() > t2.getHours())
|
if (t1.getHours() > t2.getHours())
|
||||||
return 1;
|
return 1;
|
||||||
if (t1.getHours() < t2.getHours())
|
if (t1.getHours() < t2.getHours())
|
||||||
return -1;
|
return -1;
|
||||||
if (t1.getMinutes() > t2.getMinutes())
|
if (t1.getMinute() > t2.getMinute())
|
||||||
return 1;
|
return 1;
|
||||||
if (t1.getMinutes() < t2.getMinutes())
|
if (t1.getMinute() < t2.getMinute())
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function HomeScreen({ days, navigation, removeTimetableEntry, subjects, timetable }) {
|
function HomeScreen({ days, navigation, removeTimetableEntry, subjects, theme, timetable }) {
|
||||||
const [ dialog, setDialog ] = useState({ show: false, id: null });
|
const [ dialog, setDialog ] = useState({ show: false, id: null });
|
||||||
const [ currentBottomSheet, setCurrentBottomSheet ] = useState(null);
|
|
||||||
|
|
||||||
this.bs = React.createRef();
|
|
||||||
const openBottomSheet = () => {this.bs.current.snapTo(0);this.bs.current.snapTo(0);};
|
|
||||||
const closeBottomSheet = () => {this.bs.current.snapTo(2);this.bs.current.snapTo(2);};
|
|
||||||
|
|
||||||
function CardContents() {
|
|
||||||
if (!currentBottomSheet) {
|
|
||||||
return <></>;
|
|
||||||
}
|
|
||||||
const subject = subjects.find(i => i.id === currentBottomSheet.sub_id);
|
|
||||||
return (
|
|
||||||
<Card>
|
|
||||||
<Card.Title title={subject.name} />
|
|
||||||
<Card.Content style={style.bottomNavigation}>
|
|
||||||
<Button mode="contained">Change Subject</Button>
|
|
||||||
<Button mode="contained">Change Start Time</Button>
|
|
||||||
<Button mode="contained">Change End Time</Button>
|
|
||||||
<Button mode="contained" onPress={() => {
|
|
||||||
closeBottomSheet();
|
|
||||||
setDialog({ show: true, id: currentBottomSheet.name });
|
|
||||||
}}>Remove</Button>
|
|
||||||
</Card.Content>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return (<Portal.Host><ScrollView>
|
return (<Portal.Host><ScrollView>
|
||||||
{timetable.map((day, dayIdx) => (
|
{timetable.map((day, dayIdx) => (
|
||||||
<Card
|
<Card
|
||||||
@@ -100,10 +72,7 @@ function HomeScreen({ days, navigation, removeTimetableEntry, subjects, timetabl
|
|||||||
return (
|
return (
|
||||||
<DataTable.Row
|
<DataTable.Row
|
||||||
key={idx}
|
key={idx}
|
||||||
onPress={() => {
|
onPress={() => setDialog({ show: true, id: cls.id })}
|
||||||
setCurrentBottomSheet(cls);
|
|
||||||
openBottomSheet();
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<DataTable.Cell
|
<DataTable.Cell
|
||||||
style={{ flexGrow: 2 }}
|
style={{ flexGrow: 2 }}
|
||||||
@@ -130,6 +99,13 @@ function HomeScreen({ days, navigation, removeTimetableEntry, subjects, timetabl
|
|||||||
})}
|
})}
|
||||||
</DataTable>
|
</DataTable>
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
|
<Card.Actions style={{justifyContent: "flex-end"}}>
|
||||||
|
<IconButton
|
||||||
|
onPress={() => navigation.navigate(`New Entry ${days[dayIdx]}`)}
|
||||||
|
icon="plus"
|
||||||
|
color={theme.colors.primary}
|
||||||
|
/>
|
||||||
|
</Card.Actions>
|
||||||
</Card>
|
</Card>
|
||||||
))}
|
))}
|
||||||
<Portal>
|
<Portal>
|
||||||
@@ -149,33 +125,6 @@ function HomeScreen({ days, navigation, removeTimetableEntry, subjects, timetabl
|
|||||||
</Button>
|
</Button>
|
||||||
</Dialog.Actions>
|
</Dialog.Actions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
<FAB
|
|
||||||
visible={currentBottomSheet == null}
|
|
||||||
large
|
|
||||||
icon="plus"
|
|
||||||
onPress={() => navigation.navigate("New Entry")}
|
|
||||||
style={{
|
|
||||||
position: "absolute",
|
|
||||||
margin: 16,
|
|
||||||
right: 0,
|
|
||||||
bottom: 0,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Modal
|
|
||||||
visible={currentBottomSheet != null}
|
|
||||||
onDismiss={closeBottomSheet}
|
|
||||||
dismissable={false}
|
|
||||||
>
|
|
||||||
</Modal>
|
|
||||||
<BottomSheet
|
|
||||||
ref={this.bs}
|
|
||||||
snapPoints={[300, 150, 0]}
|
|
||||||
initialSnap={1}
|
|
||||||
renderContent={CardContents}
|
|
||||||
enabledInnerScrolling={false}
|
|
||||||
onCloseStart={() => setCurrentBottomSheet(null)}
|
|
||||||
onCloseEnd={() => {}}
|
|
||||||
/>
|
|
||||||
</Portal>
|
</Portal>
|
||||||
</ScrollView></Portal.Host>);
|
</ScrollView></Portal.Host>);
|
||||||
}
|
}
|
||||||
@@ -185,6 +134,7 @@ HomeScreen.propTypes = {
|
|||||||
subjects: PropTypes.array,
|
subjects: PropTypes.array,
|
||||||
navigation: PropTypes.object,
|
navigation: PropTypes.object,
|
||||||
days: PropTypes.array,
|
days: PropTypes.array,
|
||||||
|
theme: PropTypes.object,
|
||||||
removeTimetableEntry: PropTypes.func,
|
removeTimetableEntry: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -202,11 +152,6 @@ const style = StyleSheet.create({
|
|||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
justifyContent: "space-between"
|
justifyContent: "space-between"
|
||||||
},
|
},
|
||||||
bottomNavigation: {
|
|
||||||
height: 250,
|
|
||||||
flexDirection: "column",
|
|
||||||
justifyContent: "space-evenly",
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default HomeScreen;
|
export default withTheme(HomeScreen);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { addSubject, removeSubject } from "../actions";
|
|||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
return {
|
return {
|
||||||
subjects: state.subjects,
|
subjects: state.subjects,
|
||||||
timetable: state.timetable,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
"react-native-uuid": "^1.4.9",
|
"react-native-uuid": "^1.4.9",
|
||||||
"react-native-vector-icons": "^6.6.0",
|
"react-native-vector-icons": "^6.6.0",
|
||||||
"react-redux": "^7.2.0",
|
"react-redux": "^7.2.0",
|
||||||
"reanimated-bottom-sheet": "^1.0.0-alpha.19",
|
|
||||||
"redux": "^4.0.5",
|
"redux": "^4.0.5",
|
||||||
"redux-devtools-extension": "^2.13.8",
|
"redux-devtools-extension": "^2.13.8",
|
||||||
"redux-persist": "^6.0.0"
|
"redux-persist": "^6.0.0"
|
||||||
|
|||||||
26
themes.js
26
themes.js
@@ -1,13 +1,13 @@
|
|||||||
import { DefaultTheme, DarkTheme } from "react-native-paper";
|
import { DefaultTheme, DarkTheme } from "react-native-paper";
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
"name": "Dark: Pink and Blue",
|
"name": "Dark: Pink and Gray",
|
||||||
"theme": {
|
"theme": {
|
||||||
...DarkTheme,
|
...DarkTheme,
|
||||||
mode: "exact",
|
mode: "exact",
|
||||||
colors: {
|
colors: {
|
||||||
primary: "#ff1744",
|
primary: "#ff1744",
|
||||||
accent: "#3949ab",
|
accent: "#e0e0e0",
|
||||||
backdrop: "rgba(0, 0, 0, 0.5)",
|
backdrop: "rgba(0, 0, 0, 0.5)",
|
||||||
background: "#000000",
|
background: "#000000",
|
||||||
disabled: "rgba(255, 255, 255, 0.38)",
|
disabled: "rgba(255, 255, 255, 0.38)",
|
||||||
@@ -63,6 +63,17 @@ export default [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Absolute Dark: Pink and Gray",
|
||||||
|
"theme": {
|
||||||
|
...DarkTheme,
|
||||||
|
colors: {
|
||||||
|
...DarkTheme.colors,
|
||||||
|
primary: "#ff1744",
|
||||||
|
accent: "#e0e0e0",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Absolute Dark: Purple and Gray",
|
"name": "Absolute Dark: Purple and Gray",
|
||||||
"theme": DarkTheme
|
"theme": DarkTheme
|
||||||
@@ -90,6 +101,17 @@ export default [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Light: Pastel Colors 2",
|
||||||
|
"theme": {
|
||||||
|
...DefaultTheme,
|
||||||
|
colors: {
|
||||||
|
...DefaultTheme.colors,
|
||||||
|
primary: "#ffcccb",
|
||||||
|
accent: "#fce4ec",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Light: Purple and Green",
|
"name": "Light: Purple and Green",
|
||||||
"theme": DefaultTheme
|
"theme": DefaultTheme
|
||||||
|
|||||||
@@ -5420,11 +5420,6 @@ realpath-native@^1.1.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
util.promisify "^1.0.0"
|
util.promisify "^1.0.0"
|
||||||
|
|
||||||
reanimated-bottom-sheet@^1.0.0-alpha.19:
|
|
||||||
version "1.0.0-alpha.19"
|
|
||||||
resolved "https://registry.npmjs.org/reanimated-bottom-sheet/-/reanimated-bottom-sheet-1.0.0-alpha.19.tgz#94ea79e7b2896b8f489547415d15d15c99ac44ba"
|
|
||||||
integrity sha512-Q0sGUHYdr5h2n/AY7pKQty35zcUAxxYM1nCl+luSQAyqiY6a5Kf8IBQRsOVvs60sDzqXxtbwxHgM5mkwaiQC4Q==
|
|
||||||
|
|
||||||
redux-devtools-extension@^2.13.8:
|
redux-devtools-extension@^2.13.8:
|
||||||
version "2.13.8"
|
version "2.13.8"
|
||||||
resolved "https://registry.npmjs.org/redux-devtools-extension/-/redux-devtools-extension-2.13.8.tgz#37b982688626e5e4993ff87220c9bbb7cd2d96e1"
|
resolved "https://registry.npmjs.org/redux-devtools-extension/-/redux-devtools-extension-2.13.8.tgz#37b982688626e5e4993ff87220c9bbb7cd2d96e1"
|
||||||
|
|||||||
Reference in New Issue
Block a user