Skip to content

Commit

Permalink
added button to syncm atches (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
saturnaliam authored Feb 24, 2025
1 parent 14603de commit f22150f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/components/NavButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ function NavButton({ text, pageName, disabled, onClick }: NavButtonProps) {
const insets = useSafeAreaInsets();

return (
<View style={[{ flexDirection: 'row-reverse' }]}>
<View style={[{ flexDirection: 'row-reverse', marginTop: 10 }]}>
<Link href={"/" + pageName} asChild>
<Button textColor={TEXT_COLOR} buttonColor={BACKGROUND_COLOR} mode="contained"
contentStyle={{ height: 80, width: 80 }} onPress={onClick} disabled={disabled}>{text}</Button>
contentStyle={{ height: 85, width: 85 }} onPress={onClick} disabled={disabled}>{text}</Button>
</Link>
</View>
)
Expand Down
23 changes: 13 additions & 10 deletions app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@ export default function App() {
const [ eventCode, setEventCode ] = useState("");
const [ unsyncedMatches, setUnsyncedMatches ] = useState(0);

useEffect(() => {
getMatchData().then((data) => {
setNameFilled(data["scouterName"] !== "");
setTeamNumberFilled(data["teamNumber"] !== 0);
setMatchFilled(data["matchNumber"] !== 0);
});



const sync = () => {
AsyncStorage.getItem("unsynced").then(async (res) => {
if (res === null) return;

Expand Down Expand Up @@ -57,7 +49,17 @@ export default function App() {
});
}, { onlyOnce: true });
});
}, [])
}

useEffect(() => {
getMatchData().then((data) => {
setNameFilled(data["scouterName"] !== "");
setTeamNumberFilled(data["teamNumber"] !== 0);
setMatchFilled(data["matchNumber"] !== 0);
});

sync();
}, [])

return (
<View style={styles.container} onTouchStart={Keyboard.dismiss}>
Expand Down Expand Up @@ -95,6 +97,7 @@ export default function App() {

<NavButton text="Go" pageName="auto"
disabled={ !(nameFilled && teamNumberFilled && matchFilled) } />
{ unsyncedMatches > 0 && <NavButton text="Sync" onClick={sync} /> }

<StatusBar style="auto" />
</ScrollView>
Expand Down

0 comments on commit f22150f

Please sign in to comment.