Skip to content

Commit

Permalink
Merge pull request #349 from wyne/bug-fixes
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
wyne authored Nov 19, 2023
2 parents 5b4f6f0 + 56d061e commit 1583cef
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@
"private": true,
"name": "scorepad",
"version": "1.0.0"
}
}
28 changes: 28 additions & 0 deletions src/components/Buttons/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import analytics from '@react-native-firebase/analytics';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { ParamListBase } from '@react-navigation/native';

import HeaderButton from './HeaderButton';
import { Icon } from 'react-native-elements/dist/icons/Icon';
import { systemBlue } from '../../constants';

interface Props {
navigation: NativeStackNavigationProp<ParamListBase, string, undefined>;
}

const BackButton: React.FunctionComponent<Props> = ({ navigation }) => {
return (
<HeaderButton accessibilityLabel='Home' onPress={async () => {
navigation.goBack();
await analytics().logEvent('menu');
}}>
<Icon name="bars"
type="font-awesome-5"
size={20}
color={systemBlue} />
</HeaderButton>
);
};

export default BackButton;
File renamed without changes.
2 changes: 1 addition & 1 deletion src/components/Buttons/NewGameButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const NewGameButton: React.FunctionComponent<Props> = ({ navigation }) => {
const menuActions: MenuAction[] = playerNumberOptions.map((number) => {
return {
id: number.toString(),
title: number.toString() + " Players",
title: number.toString() + (number == 1 ? " Player" : " Players"),
};
});

Expand Down
2 changes: 1 addition & 1 deletion src/components/Headers/AppInfoHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Text, StyleSheet } from 'react-native';

import HomeButton from '../Buttons/MenuButton';
import HomeButton from '../Buttons/HomeButton';
import CustomHeader from './CustomHeader';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { ParamListBase } from '@react-navigation/native';
Expand Down
4 changes: 2 additions & 2 deletions src/components/Headers/GameHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { roundNext, roundPrevious } from '../../../redux/GamesSlice';
import { selectGameById } from '../../../redux/GamesSlice';
import { systemBlue } from '../../constants';
import { Button } from 'react-native-elements';
import HomeButton from '../Buttons/MenuButton';
import HomeButton from '../Buttons/HomeButton';
import AddendButton from '../Buttons/AddendButton';
import CustomHeader from './CustomHeader';

Expand Down Expand Up @@ -77,7 +77,7 @@ const GameHeader: React.FunctionComponent<Props> = ({ navigation }) => {
}

const isFirstRound = roundCurrent == 0;
const isLastRound = roundCurrent >= lastRoundIndex;
const isLastRound = roundCurrent + 1 >= lastRoundIndex;

const nextRoundHandler = async () => {
if (isLastRound && currentGame.locked) return;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Headers/ShareHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { Text, StyleSheet } from 'react-native';

import HomeButton from '../Buttons/MenuButton';
import CustomHeader from './CustomHeader';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { ParamListBase } from '@react-navigation/native';
import BackButton from '../Buttons/BackButton';

interface Props {
navigation: NativeStackNavigationProp<ParamListBase, string, undefined>;
Expand All @@ -14,7 +14,7 @@ const ShareHeader: React.FunctionComponent<Props> = ({ navigation }: Props) => {

return (
<CustomHeader navigation={navigation}
headerLeft={<HomeButton navigation={navigation} />}
headerLeft={<BackButton navigation={navigation} />}
headerCenter={<Text style={styles.title}>Share</Text>}
/>
);
Expand Down
13 changes: 11 additions & 2 deletions src/components/ScoreLog/RoundScoreColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,23 @@ const RoundScoreColumn: React.FunctionComponent<Props> = ({ round, isCurrentRoun
});
}, []);

let backgroundColor = 'rgba(0,0,0,0)';

if (isCurrentRound) {
backgroundColor = 'rgba(255,0,0,.1)';
} else if (round % 2 == 0) {
backgroundColor = 'rgba(0,0,0,.1)';
}

return (
<TouchableWithoutFeedback onPress={onPressHandler}>
<View style={{
padding: 10,
// backgroundColor: isCurrentRound ? '#111' : 'black'
paddingBottom: 0,
backgroundColor: backgroundColor,
}}>
<Text style={{
color: isCurrentRound ? 'red' : 'yellow',
color: isCurrentRound ? 'red' : '#AAA',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 20,
Expand Down
3 changes: 1 addition & 2 deletions src/components/ScoreLog/TotalScoreCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const TotalScoreCell: React.FunctionComponent<Props> = ({ playerId }) => {
return (sum || 0) + (current || 0);
});
return (
<Text key={playerId} style={[styles.scoreEntry, { color: 'white', fontWeight: 'bold' }]}>
<Text key={playerId} style={[styles.scoreEntry, { color: 'white' }]}>
{scoreTotal}
</Text>
);
Expand All @@ -25,7 +25,6 @@ const TotalScoreCell: React.FunctionComponent<Props> = ({ playerId }) => {
const styles = StyleSheet.create({
totalHeader: {
color: 'white',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 20
},
Expand Down
1 change: 0 additions & 1 deletion src/components/ScoreLog/TotalScoreColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const TotalScoreColumn = ({ }) => {
const styles = StyleSheet.create({
totalHeader: {
color: 'white',
fontWeight: 'bold',
textAlign: 'center',
fontSize: 20,
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sheets/GameSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const GameSheet: React.FunctionComponent<Props> = ({ navigation, containerHeight
id: currentGame.id,
changes: {
roundCurrent: 0,
roundTotal: 0,
roundTotal: 1,
}
}));
navigation.navigate("Game");
Expand Down
2 changes: 1 addition & 1 deletion src/screens/ShareScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const ShareScreen: React.FunctionComponent<Props> = ({ navigation }) => {

const roundsScrollViewEl = useRef<ScrollView>(null);

const roundsIterator = [...Array(roundTotal + 1).keys()];
const roundsIterator = [...Array(roundTotal).keys()];

const exportImage = async () => {
if (roundsScrollViewEl.current == null) return;
Expand Down

0 comments on commit 1583cef

Please sign in to comment.