Cleanup - removed old files
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Content, Card, CardItem, Body, Text, Button } from 'native-base';
|
||||
import { Image, ScrollView } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { ConnState, startSession } from '../state/DeviceReduxCoupling';
|
||||
|
||||
function HomeView(props) {
|
||||
const buttonText = props.running ? "View Swim Session" : "Start swimming";
|
||||
|
||||
const onButtonPress = () => {
|
||||
if(!props.running) {
|
||||
props.dispatch(startSession());
|
||||
}
|
||||
props.navigation.navigate('Training')
|
||||
};
|
||||
|
||||
return (
|
||||
<Content padder contentContainerStyle={{ justifyContent: 'space-around', flex: 1, marginTop: 70 }}>
|
||||
<ScrollView styles={{ marginHorizontal: 20, paddingTop: 100 }} alwaysBounceHorizontal={true} alwaysBounceVertical={true}>
|
||||
<Card style={{ backgroundColor: "transparent" }}>
|
||||
<CardItem cardBody>
|
||||
<Image source={require('../assets/pool-water.jpg')} style={{ height: 100, width: null, flex: 1 }} />
|
||||
</CardItem>
|
||||
|
||||
<CardItem style={{backgroundColor: 'rgba(255, 255, 255, 0.6)'}}>
|
||||
<Body>
|
||||
<Button block onPress={onButtonPress}>
|
||||
<Text>{buttonText}</Text>
|
||||
</Button>
|
||||
</Body>
|
||||
</CardItem>
|
||||
</Card>
|
||||
|
||||
<Card style={{ backgroundColor: "transparent" }}>
|
||||
<CardItem cardBody>
|
||||
<Image source={require('../assets/blue-water-background.jpg')} style={{ height: 100, width: null, flex: 1 }} />
|
||||
</CardItem>
|
||||
|
||||
<CardItem style={{backgroundColor: 'rgba(255, 255, 255, 0.6)'}}>
|
||||
<Body>
|
||||
<Button block >
|
||||
<Text>Settings</Text>
|
||||
</Button>
|
||||
</Body>
|
||||
</CardItem>
|
||||
</Card>
|
||||
</ScrollView>
|
||||
</Content>
|
||||
);
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return { running: state.deviceState.connState === ConnState.CONNECTED_RUNNING };
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(HomeView);
|
||||
56
components/ImageHeader.js
Normal file
56
components/ImageHeader.js
Normal file
@@ -0,0 +1,56 @@
|
||||
import React from "react";
|
||||
import {
|
||||
View,
|
||||
ImageBackground,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
StyleSheet,
|
||||
} from "react-native";
|
||||
import EntypoIcon from "react-native-vector-icons/Entypo";
|
||||
|
||||
|
||||
function ImageHeader(props) {
|
||||
return (
|
||||
<View style={imageHeaderStyles.container}>
|
||||
<ImageBackground
|
||||
source={props.image}
|
||||
resizeMode="cover"
|
||||
style={{ flex: 1 }}
|
||||
>
|
||||
<View style={imageHeaderStyles.row}>
|
||||
<TouchableOpacity onPress={() => props.navigation.goBack()}>
|
||||
<EntypoIcon name="chevron-left" style={imageHeaderStyles.icon}></EntypoIcon>
|
||||
</TouchableOpacity>
|
||||
<Text style={imageHeaderStyles.text}>{props.text}</Text>
|
||||
</View>
|
||||
</ImageBackground>
|
||||
</View >
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
const imageHeaderStyles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
minHeight: 175,
|
||||
maxHeight: 175,
|
||||
height: 175,
|
||||
width: "100%",
|
||||
},
|
||||
row: {
|
||||
paddingTop: 30,
|
||||
flexDirection: "row",
|
||||
},
|
||||
icon: {
|
||||
color: "white",
|
||||
fontSize: 40,
|
||||
paddingRight: 10,
|
||||
paddingLeft: 10,
|
||||
},
|
||||
text: {
|
||||
color: "white",
|
||||
fontSize: 30,
|
||||
},
|
||||
});
|
||||
|
||||
export default ImageHeader;
|
||||
@@ -1,82 +0,0 @@
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { StyleSheet, Animated } from 'react-native';
|
||||
import { Button, Content, Text, View } from 'native-base';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import IconCard from './IconCard';
|
||||
import Graph from './Graph';
|
||||
import { connect } from 'react-redux';
|
||||
import backgroundColors from './Themes';
|
||||
import { useKeepAwake } from 'expo-keep-awake';
|
||||
import { stopSession } from '../state/DeviceReduxCoupling';
|
||||
import CycleView from './CycleView';
|
||||
|
||||
|
||||
function LiveTrainingView(props) {
|
||||
const analysis = props.session.analysis;
|
||||
const onStopClick = () => {
|
||||
props.dispatch(stopSession());
|
||||
props.navigation.navigate('Home');
|
||||
};
|
||||
const laps = (analysis.peaks.size / props.peaksPerLap).toFixed(1);
|
||||
const totalMomentum = Math.trunc(analysis.totalMomentum * props.kgFactor / 10 / 60);
|
||||
|
||||
const toTimeStr = seconds => {
|
||||
let minuteStr = String(Math.floor(seconds / 60));
|
||||
if(minuteStr.length < 2)
|
||||
minuteStr = "0" + minuteStr;
|
||||
let secondStr = String(Math.floor(seconds % 60));
|
||||
if(secondStr.length < 2)
|
||||
secondStr = "0" + secondStr;
|
||||
return minuteStr + ":" + secondStr;
|
||||
}
|
||||
console.log("Active", analysis.activeTime);
|
||||
useKeepAwake();
|
||||
|
||||
return (
|
||||
<LinearGradient
|
||||
colors={backgroundColors[props.theme]}
|
||||
start={[0, 0]}
|
||||
end={[0.5, 1]}
|
||||
style={{ flex: 1 }}
|
||||
>
|
||||
<Content padder contentContainerStyle={{ justifyContent: 'space-around', flex: 1, paddingTop: 60 }}>
|
||||
|
||||
<CycleView>
|
||||
<IconCard label="BAHNEN" value={laps} iconName="retweet" iconType="AntDesign" />
|
||||
<IconCard label="ZÜGE" value={analysis.peaks.size} iconName="dashboard" iconType="AntDesign" />
|
||||
</CycleView>
|
||||
|
||||
<CycleView>
|
||||
<IconCard label="DAUER" value={toTimeStr(analysis.totalTime)} iconName="clock" iconType="FontAwesome5" />
|
||||
<IconCard label="AKTIVE DAUER" value={toTimeStr(analysis.activeTime)} iconName="stopwatch" iconType="FontAwesome5" />
|
||||
</CycleView>
|
||||
<IconCard label="KRAFT" value={totalMomentum} iconName="ruler" iconType="Entypo" />
|
||||
|
||||
<Graph></Graph>
|
||||
<Button block secondary onPress={onStopClick}><Text>Stop</Text></Button>
|
||||
</Content>
|
||||
</LinearGradient>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
card: {
|
||||
flexDirection: 'row',
|
||||
backgroundColor: 'rgba(0, 0, 0, 0.2)',
|
||||
margin: 5,
|
||||
padding: 5,
|
||||
borderRadius: 3,
|
||||
justifyContent: 'space-between',
|
||||
}
|
||||
});
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
session: state.deviceState,
|
||||
peaksPerLap: state.settings.analysis.peaksPerLap,
|
||||
theme: state.settings.theme,
|
||||
kgFactor: state.settings.analysis.kgFactor,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(LiveTrainingView);
|
||||
@@ -1,46 +0,0 @@
|
||||
import React from 'react';
|
||||
import { NavigationContainer } from '@react-navigation/native';
|
||||
import { createStackNavigator } from '@react-navigation/stack';
|
||||
|
||||
// Own views
|
||||
import MainMenuView from "../views/MainMenuView";
|
||||
import SettingsView from "../views/SettingsView";
|
||||
import TrainingView from "../views/TrainingView";
|
||||
import LastSessionsView from "../views/LastSessionsView";
|
||||
const Stack = createStackNavigator();
|
||||
|
||||
function NewAppMain(props) {
|
||||
|
||||
const screenOptions = {
|
||||
headerShown: false,
|
||||
}
|
||||
|
||||
return (
|
||||
<NavigationContainer>
|
||||
<Stack.Navigator initialRouteName="Home">
|
||||
<Stack.Screen
|
||||
name="Home"
|
||||
component={MainMenuView}
|
||||
options={screenOptions}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Settings"
|
||||
component={SettingsView}
|
||||
options={screenOptions}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Training"
|
||||
component={TrainingView}
|
||||
options={screenOptions}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="LastSessions"
|
||||
component={LastSessionsView}
|
||||
options={screenOptions}
|
||||
/>
|
||||
</Stack.Navigator>
|
||||
</NavigationContainer>
|
||||
)
|
||||
};
|
||||
|
||||
export default NewAppMain;
|
||||
@@ -1,70 +0,0 @@
|
||||
import React from 'react';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { NavigationContainer } from '@react-navigation/native';
|
||||
import { createStackNavigator } from '@react-navigation/stack';
|
||||
import { BlurView } from 'expo-blur';
|
||||
import { StyleSheet } from 'react-native';
|
||||
import backgroundColors from './Themes';
|
||||
|
||||
// Own views
|
||||
import LiveTrainingView from './LiveTrainingView';
|
||||
import HomeView from './HomeView';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
|
||||
const Stack = createStackNavigator();
|
||||
|
||||
|
||||
function ThemedStackNavigation(props) {
|
||||
|
||||
const screenOptions = {
|
||||
cardStyle: {
|
||||
backgroundColor: "transparent",
|
||||
opacity: 1
|
||||
},
|
||||
headerTransparent: "true",
|
||||
headerTitleStyle: {
|
||||
color: 'white',
|
||||
fontWeight: 'bold',
|
||||
fontSize: 20,
|
||||
},
|
||||
headerTintColor: "white",
|
||||
headerBackground: () => (
|
||||
<BlurView
|
||||
tint="dark"
|
||||
intensity={30}
|
||||
style={StyleSheet.absoluteFill}
|
||||
/>
|
||||
),
|
||||
}
|
||||
|
||||
return (
|
||||
<LinearGradient
|
||||
colors={backgroundColors[props.themeName]}
|
||||
start={[0, 0]}
|
||||
end={[0.5, 1]}
|
||||
style={{ flex: 1 }}
|
||||
>
|
||||
<NavigationContainer>
|
||||
<Stack.Navigator initialRouteName="Home">
|
||||
<Stack.Screen
|
||||
name="Home"
|
||||
component={HomeView}
|
||||
options={{ ...screenOptions, headerTitle: "SwimTracker" }}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Training"
|
||||
component={LiveTrainingView}
|
||||
options={{ ...screenOptions, headerTitle: "Training" }}
|
||||
/>
|
||||
</Stack.Navigator>
|
||||
</NavigationContainer>
|
||||
</LinearGradient>
|
||||
)
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return { themeName: state.settings.theme };
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(ThemedStackNavigation);
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
const backgroundColors = {
|
||||
'hot': ['#830e5f', '#fd5139'],
|
||||
'darkBlue': ['#4265a3', '#cfada7'],
|
||||
//'lightBlue': ['#50a4db', '#74bbe2'],
|
||||
'lightBlue': ['#24acdc ', '#65fae6'],
|
||||
'foggy': ['#bc8db8', '#5d5e90'],
|
||||
};
|
||||
|
||||
export default backgroundColors;
|
||||
26
components/themeColors.js
Normal file
26
components/themeColors.js
Normal file
@@ -0,0 +1,26 @@
|
||||
// https://flatuicolors.com/palette/defo
|
||||
|
||||
const themeColors = {
|
||||
'TURQUOISE': "rgb(26, 188, 156)",
|
||||
"EMERALD": "rgb(46, 204, 113)",
|
||||
"PETER RIVER" : "rgb(52, 152, 219)",
|
||||
"AMETHYST" : "rgb(155, 89, 182)",
|
||||
"WET ASPHALT" : "rgb(52, 73, 94)",
|
||||
"GREEN SEA" : "rgb(22, 160, 133)",
|
||||
"NEPHRITIS" : "rgb(39, 174, 96)",
|
||||
"BELIZE HOLE" : "rgb(41, 128, 185)",
|
||||
"WISTERIA" : "rgb(142, 68, 173)",
|
||||
"MIDNIGHT BLUE" : "rgb(44, 62, 80)",
|
||||
"SUN FLOWER" : "rgb(241, 196, 15)",
|
||||
"CARROT" : "rgb(230, 126, 34)",
|
||||
"ALIZARIN" : "rgb(231, 76, 60)",
|
||||
"CLOUDS" : "rgb(236, 240, 241)",
|
||||
"CONCRETE" : "rgb(149, 165, 166)",
|
||||
"ORANGE" : "rgb(243, 156, 18)",
|
||||
"PUMPKIN" : "rgb(211, 84, 0)",
|
||||
"POMEGRANATE" : "rgb(192, 57, 43)",
|
||||
"SILVER" : "rgb(189, 195, 199)",
|
||||
"ASBESTOS" : "rgb(127, 140, 141)",
|
||||
};
|
||||
|
||||
export default themeColors;
|
||||
Reference in New Issue
Block a user