Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properly clears data #61

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default function RootLayout() {
<Stack.Screen name="teleop" options={{ headerShown: false }} />
<Stack.Screen name="auto" options={{ headerShown: false }} />
<Stack.Screen name="summary" options={{ headerShown: false }} />
<Stack.Screen name="submit" options={{ headerShown: false }} />
</Stack>
);
}
26 changes: 26 additions & 0 deletions app/submit.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useState } from "react";
import { ActivityIndicator } from "react-native-paper";
import { addUnsyncedData, deleteMatchData, getMatchData } from "./api/data";
import { View } from "react-native";
import { router } from "expo-router";

export default function App() {
const [ animating, setAnimating ] = useState(true);

getMatchData().then((data) => {
const deleted = deleteMatchData();
const saved = addUnsyncedData(data);

Promise.all([deleted, saved]).then(() => {
setAnimating(false);
router.navigate("");
})
})


return (
<View style={{justifyContent: "center", flex: 1}}>
<ActivityIndicator size="large" animating={animating} />
</View>
)
}
8 changes: 2 additions & 6 deletions app/summary.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { StatusBar } from 'expo-status-bar';
import { Keyboard, ScrollView, StyleSheet, View } from 'react-native';
import LabeledTextInput from './components/LabeledTextInput';
import { addUnsyncedData, getMatchData, updateNotes } from './api/data';
import { addUnsyncedData, deleteMatchData, getMatchData, updateNotes } from './api/data';
import PageHeader from './components/Header';
import SummaryTableView from './views/SummaryTableView';
import Checkbox from './components/Checkbox';
Expand All @@ -26,11 +26,7 @@ export default function App() {
<Checkbox tag='Broke'/>
<Checkbox tag='Tipped over'/>
<Checkbox tag='Gamepiece stuck'/>
<NavButton text="End" onClick={() => {
getMatchData().then((data) => {
addUnsyncedData(data);
}).catch((err) => console.error(err));
}} />
<NavButton text="End" pageName='submit'/>
<StatusBar style="auto" />
</ScrollView>
</View>
Expand Down