added session feed page and session component with click to details

This commit is contained in:
Dean 2024-02-20 14:25:49 -08:00
parent fbbcd51df5
commit 24c14fb7ca
9 changed files with 81 additions and 64 deletions

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import { StyleSheet, Text, View } from "react-native"; import { StyleSheet, Text, View } from "react-native";
const SessionFooter = ({ sessionName, lastPlayed }) => { const SessionCardFooter = ({ sessionName, lastPlayed }) => {
return ( return (
<View> <View>
<Text style={styles.sessionName}>{sessionName}</Text> <Text style={styles.sessionName}>{sessionName}</Text>
@ -28,4 +28,4 @@ const styles = StyleSheet.create({
}, },
}); });
export default SessionFooter; export default SessionCardFooter;

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import { Image, StyleSheet, Text, View } from "react-native"; import { Image, StyleSheet, Text, View } from "react-native";
const SessionHeader = ({ const SessionCardHeader = ({
playerName, playerName,
location, location,
type, type,
@ -67,4 +67,4 @@ const styles = StyleSheet.create({
}, },
}); });
export default SessionHeader; export default SessionCardHeader;

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import { StyleSheet, Text, View } from "react-native"; import { StyleSheet, Text, View } from "react-native";
const AggregateStat = ({ aggregateStat, displayName, numberFormat }) => { const SessionCardStat = ({ aggregateStat, displayName, numberFormat }) => {
return ( return (
<View> <View>
<Text style={styles.statItem}>{displayName}</Text> <Text style={styles.statItem}>{displayName}</Text>
@ -26,4 +26,4 @@ const styles = StyleSheet.create({
}, },
}); });
export default AggregateStat; export default SessionCardStat;

View File

@ -1,12 +1,17 @@
import React from "react"; import React from "react";
import { StyleSheet, View } from "react-native"; import { StyleSheet, View } from "react-native";
import AggregateStat from "./aggregate_stat"; import SessionCardStat from "./session-card-stat";
const SessionStats = ({ makePercent, medianRun, duration, shotPacing }) => { const SessionCardStatsRowContainer = ({
makePercent,
medianRun,
duration,
shotPacing,
}) => {
return ( return (
<View style={styles.statsContainer}> <View style={styles.statsContainer}>
<View> <View>
<AggregateStat <SessionCardStat
displayName="Make Percent" displayName="Make Percent"
aggregateStat={makePercent} aggregateStat={makePercent}
numberFormat="%" numberFormat="%"
@ -14,7 +19,7 @@ const SessionStats = ({ makePercent, medianRun, duration, shotPacing }) => {
</View> </View>
<View style={styles.verticalSpacer} /> <View style={styles.verticalSpacer} />
<View> <View>
<AggregateStat <SessionCardStat
displayName="Median Run" displayName="Median Run"
aggregateStat={medianRun} aggregateStat={medianRun}
numberFormat="" numberFormat=""
@ -22,7 +27,7 @@ const SessionStats = ({ makePercent, medianRun, duration, shotPacing }) => {
</View> </View>
<View style={styles.verticalSpacer} /> <View style={styles.verticalSpacer} />
<View> <View>
<AggregateStat <SessionCardStat
displayName="Time Played" displayName="Time Played"
aggregateStat={duration} aggregateStat={duration}
numberFormat="" numberFormat=""
@ -30,7 +35,7 @@ const SessionStats = ({ makePercent, medianRun, duration, shotPacing }) => {
</View> </View>
<View style={styles.verticalSpacer} /> <View style={styles.verticalSpacer} />
<View> <View>
<AggregateStat <SessionCardStat
displayName="Shot Pacing" displayName="Shot Pacing"
aggregateStat={shotPacing} aggregateStat={shotPacing}
numberFormat="" numberFormat=""
@ -55,4 +60,4 @@ const styles = StyleSheet.create({
}, },
}); });
export default SessionStats; export default SessionCardStatsRowContainer;

View File

@ -1,10 +1,10 @@
import React from "react"; import React from "react";
import { Image, StyleSheet, View } from "react-native"; import { Image, StyleSheet, View } from "react-native";
import SessionFooter from "./session_footer"; import SessionCardFooter from "./session-card-footer";
import SessionHeader from "./session_header"; import SessionCardHeader from "./session-card-header";
import SessionStats from "./session_stats"; import SessionCardStatsRowContainer from "./session-card-stats-row-container";
const StatsCard = ({ const SessionCard = ({
playerName, playerName,
location, location,
type, type,
@ -22,21 +22,21 @@ const StatsCard = ({
return ( return (
<View style={styles.background}> <View style={styles.background}>
<View style={styles.card}> <View style={styles.card}>
<SessionHeader <SessionCardHeader
playerName={playerName} playerName={playerName}
location={location} location={location}
type={type} type={type}
locationIconURL={locationIconURL} locationIconURL={locationIconURL}
profileImageURL={profileImageURL} profileImageURL={profileImageURL}
/> />
<SessionStats <SessionCardStatsRowContainer
makePercent={makePercent} makePercent={makePercent}
medianRun={medianRun} medianRun={medianRun}
duration={duration} duration={duration}
shotPacing={shotPacing} shotPacing={shotPacing}
/> />
<Image source={imageURL} style={styles.image} /> <Image source={imageURL} style={styles.image} />
<SessionFooter sessionName={sessionName} lastPlayed={lastPlayed} /> <SessionCardFooter sessionName={sessionName} lastPlayed={lastPlayed} />
</View> </View>
</View> </View>
); );
@ -52,4 +52,4 @@ const styles = StyleSheet.create({
}, },
}); });
export default StatsCard; export default SessionCard;

View File

@ -3,7 +3,8 @@ import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { Image } from "react-native"; import { Image } from "react-native";
import CameraScreen from "../component/video/camera"; import CameraScreen from "../component/video/camera";
import Profile from "../screens/profile"; import Profile from "../screens/profile";
import Session from "../screens/session"; import Session from "../screens/session-stack/session";
import SessionFeed from "../screens/session-stack/session-feed";
import VideoDetails from "../screens/video-stack/video-details"; import VideoDetails from "../screens/video-stack/video-details";
import { tabIconColors } from "../styles"; import { tabIconColors } from "../styles";
@ -14,7 +15,7 @@ const RecordStack = createNativeStackNavigator();
// tabBarIcon configuration should live on separate file and contain all logic/icons/rendering for the Tabs // tabBarIcon configuration should live on separate file and contain all logic/icons/rendering for the Tabs
const tabIcons = { const tabIcons = {
Session: <Image source={Icon} style={{ width: 20, height: 20 }} />, SessionStack: <Image source={Icon} style={{ width: 20, height: 20 }} />,
VideoStack: <Image source={Icon} style={{ width: 20, height: 20 }} />, VideoStack: <Image source={Icon} style={{ width: 20, height: 20 }} />,
Profile: <Image source={Icon} style={{ width: 20, height: 20 }} />, Profile: <Image source={Icon} style={{ width: 20, height: 20 }} />,
}; };
@ -37,6 +38,15 @@ function VideoTabStack() {
); );
} }
function SessionTabStack() {
return (
<RecordStack.Navigator screenOptions={{ headerShown: false }}>
<RecordStack.Screen name="SessionFeed" component={SessionFeed} />
<RecordStack.Screen name="Session" component={Session} />
</RecordStack.Navigator>
);
}
/** /**
* Functional component creating a tab navigator with called * Functional component creating a tab navigator with called
* Uses React Navigation's Tab.Navigator. Customizes tab bar appearance and icons. * Uses React Navigation's Tab.Navigator. Customizes tab bar appearance and icons.
@ -58,8 +68,8 @@ export default function Tabs(): React.JSX.Element {
})} })}
> >
<Tab.Screen <Tab.Screen
name="Session" name="SessionStack"
component={Session} component={SessionTabStack}
options={{ tabBarLabel: "Session" }} options={{ tabBarLabel: "Session" }}
/> />
<Tab.Screen <Tab.Screen

View File

@ -1,35 +0,0 @@
import React from "react";
import { StyleSheet, View } from "react-native";
import sampleSessionImage from "../assets/sample_session.png";
import StatsCard from "../component/session-card/session-card.tsx";
const SessionFeed: React.FC = () => {
return (
<View style={styles.container}>
<StatsCard
playerName="Dean Machine"
location="Family Billiards, San Francisco"
type="Straight Pool"
makePercent="34"
medianRun="7.3"
duration="5:03:10"
shotPacing="0:00:26"
imageURL={sampleSessionImage}
sessionName="Dusting off the chalk"
lastPlayed="Today at 2:37pm"
profileImageURL="https://www.pngall.com/wp-content/uploads/5/Profile-PNG-File.png"
locationIconURL="https://www.shutterstock.com/image-vector/blank-map-marker-vector-illustration-260nw-1150566347.jpg"
/>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#f0f0f0", // Light gray background
alignItems: "center",
},
});
export default SessionFeed;

View File

@ -0,0 +1,37 @@
import React from "react";
import { StyleSheet, TouchableOpacity, View } from "react-native";
import sampleSessionImage from "../../assets/sample_session.png";
import SessionCard from "../../component/session-card/session-card.tsx";
const SessionFeed: React.FC = ({ navigation }) => {
return (
<View style={styles.container}>
<TouchableOpacity onPress={() => navigation.push("Session")}>
<SessionCard
playerName="Dean Machine"
location="Family Billiards, San Francisco"
type="Straight Pool"
makePercent="34"
medianRun="7.3"
duration="5:03:10"
shotPacing="0:00:26"
imageURL={sampleSessionImage}
sessionName="Dusting off the chalk"
lastPlayed="Today at 2:37pm"
profileImageURL="https://www.pngall.com/wp-content/uploads/5/Profile-PNG-File.png"
locationIconURL="https://www.shutterstock.com/image-vector/blank-map-marker-vector-illustration-260nw-1150566347.jpg"
/>
</TouchableOpacity>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#f0f0f0", // Light gray background
alignItems: "center",
},
});
export default SessionFeed;

View File

@ -3,10 +3,10 @@ import { StyleSheet, View } from "react-native";
import { import {
graph_data_two_measures, graph_data_two_measures,
line_chart_two_y_data, line_chart_two_y_data,
} from "../../test/mock/charts/mock-data"; } from "../../../test/mock/charts/mock-data";
import BarGraph from "../component/charts/bar-graph/bar-graph"; import BarGraph from "../../component/charts/bar-graph/bar-graph";
import ChartContainer from "../component/charts/container/chart-container"; import ChartContainer from "../../component/charts/container/chart-container";
import LineGraph from "../component/charts/line-graph/line-graph"; import LineGraph from "../../component/charts/line-graph/line-graph";
export default function SessionScreen() { export default function SessionScreen() {
return ( return (