Skip to content

Commit

Permalink
Restart Drill functionality working (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gehrkej authored Apr 12, 2024
1 parent fce84f7 commit 21eafc0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/segments/drill/[id]/submission/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ export default function Index() {

const display = () => {
if (toggleResult == true) {
return <Result submission={outputData} drill={drillInfo} />;
return (
<Result
submission={outputData}
drill={drillInfo}
setToggleResult={setToggleResult}
/>
);
} else {
return (
<Input
Expand Down
16 changes: 15 additions & 1 deletion app/segments/drill/[id]/submission/result.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useLocalSearchParams, useNavigation } from "expo-router";
import { StyleSheet } from "react-native";
import { Appbar } from "react-native-paper";
import { Appbar, Button } from "react-native-paper";
import { SafeAreaView } from "react-native-safe-area-context";
import Header from "~/components/header";
import ResultScreen from "~/components/resultScreen";
Expand All @@ -9,6 +9,7 @@ function Result(props) {
const submission = props.submission;
const navigation = useNavigation();
const drillId = useLocalSearchParams()["id"];
const assignedTime = useLocalSearchParams()["assignedTime"];

return (
<SafeAreaView style={{ flex: 1 }} edges={["right", "top", "left"]}>
Expand All @@ -21,6 +22,19 @@ function Result(props) {
<Header drillInfo={props.drill} />
</Appbar.Header>
<ResultScreen drillId={drillId} attemptData={submission} />
<Button
style={{
margin: 10,
}}
mode="contained"
buttonColor="#F24E1E"
textColor="white"
onPress={() => {
props.setToggleResult(false);
}}
>
Restart Drill
</Button>
</SafeAreaView>
);
}
Expand Down

0 comments on commit 21eafc0

Please sign in to comment.