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

Restyle shot pill #155

Merged
merged 10 commits into from
Apr 29, 2024
5 changes: 3 additions & 2 deletions app/segments/drill/[id]/submission/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,9 @@ export default function Input({ drillInfo, setToggleResult, setOutputData }) {
<NavigationRectangle
key={id}
drillInfo={drillInfo}
attemptShots={attemptShots}
shot={item}
inputValues={inputValues[id]}
shotIndex={item.shotNum}
currentShot={currentShot}
/>
</Pressable>
))}
Expand Down Expand Up @@ -880,6 +880,7 @@ const styles = StyleSheet.create({
alignItems: "center",
flexDirection: "column",
justifyContent: "flex-start",
gap: 10,
paddingVertical: 20,
},
modalContainerStyle: {
Expand Down
150 changes: 106 additions & 44 deletions components/input/navigationRectangle.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,120 @@
import { StyleSheet, View } from "react-native";
import { Icon, Text } from "react-native-paper";
import { View } from "react-native";
import { Divider, Icon, Surface, Text } from "react-native-paper";

import { getIconByKey } from "~/Utility";

export default function NavigationRectangle({
drillInfo,
attemptShots,
inputValues,
shotIndex,
shot,
currentShot,
}) {
// console.log("inputValues", inputValues);
const keys = Object.keys(inputValues);
return (
<View style={styles.container}>
<View style={styles.rowContainer}>
<Text>
Shot {shotIndex}/{attemptShots.length}
</Text>
<Text>
Target: {attemptShots[shotIndex - 1].target}
{drillInfo.requirements[0].distanceMeasure}
<Surface
style={{
backgroundColor: "#d9d9d9",
padding: 10,
paddingLeft: 20,
paddingRight: 20,
borderRadius: 10,
maxHeight: 250,
width: "80%",
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
elevation: 5,
}}
Gehrkej marked this conversation as resolved.
Show resolved Hide resolved
>
<View>
<Text
style={{
fontSize: 20,
}}
>
Shot <Text style={{ fontWeight: "bold" }}>{shot.shotNum}</Text>
</Text>
</View>
<View style={styles.rowContainer}>
{drillInfo.inputs.map((item, id) => (
<View style={styles.horizontalContainer} key={id}>
<Icon source={getIconByKey(item.id)} />
<Text>
{inputValues[item.id]} {item.distanceMeasure}

<View
style={{
FrankreedX marked this conversation as resolved.
Show resolved Hide resolved
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
}}
>
<View
style={{
flexDirection: "row",
justifyContent: "space-between",
gap: 10,
}}
>
{drillInfo.requirements.map((requirement) => (
<Text
key={requirement.name}
style={{
fontSize: 16,
padding: 2,
}}
>
{requirement.prompt}:
<Text style={{ fontWeight: "bold" }}>
{" "}
{shot.items[requirement.name]} {requirement.distanceMeasure}
</Text>
</Text>
</View>
))}
))}
</View>

<Divider
style={{ backgroundColor: "#A0A0A0", height: 1, width: "100%" }}
/>

<View
style={{
flexDirection: "row",
justifyContent: "space-evenly",
}}
>
{currentShot + 1 == shot.shotNum ? (
<View
style={{
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
marginTop: 10,
}}
>
<Text style={{ fontSize: 13, padding: 2, fontWeight: "bold" }}>
Current Shot
</Text>
</View>
) : (
drillInfo.inputs.map((input, id) => {
if (inputValues[input.id]) {
return (
<View
style={{
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
marginTop: 10,
}}
key={id}
>
<Icon source={getIconByKey(input.id)} size={15} />
<Text style={{ fontSize: 13, padding: 2 }}>
{inputValues[input.id]} {input.distanceMeasure}
</Text>
</View>
);
}
})
)}
</View>
</View>
</View>
</Surface>
);
}
const styles = StyleSheet.create({
container: {
backgroundColor: "#d9d9d9",
padding: 20,
borderRadius: 10,
maxHeight: 250,
width: "80%",
overflow: "hidden",
marginBottom: 20,
},
rowContainer: {
flexDirection: "row",
justifyContent: "space-between",
marginBottom: 10,
},
title: {
fontWeight: "bold",
},
horizontalContainer: {
flexDirection: "row",
alignItems: "center",
},
});
Loading