Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
wyne committed Apr 17, 2024
1 parent 0844cb6 commit c0f23a3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
5 changes: 5 additions & 0 deletions redux/SettingsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface SettingsState {
onboarded: string | undefined;
showPointParticles: boolean;
showPlayerIndex: boolean;
showColorPalettes?: boolean;
interactionType: InteractionType;
lastStoreReviewPrompt: number;
};
Expand Down Expand Up @@ -48,6 +49,9 @@ const settingsSlice = createSlice({
toggleShowPlayerIndex(state) {
state.showPlayerIndex = !state.showPlayerIndex;
},
toggleShowColorPalettes(state) {
state.showColorPalettes = !state.showColorPalettes;
},
setMultiplier(state, action: PayloadAction<number>) {
state.multiplier = action.payload;
},
Expand Down Expand Up @@ -80,6 +84,7 @@ export const {
setOnboardedVersion,
toggleShowPointParticles,
toggleShowPlayerIndex,
toggleShowColorPalettes,
setInteractionType,
setLastStoreReviewPrompt,
} = settingsSlice.actions;
Expand Down
3 changes: 2 additions & 1 deletion src/components/ColorPalettes/PalettePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ const PalettePreview: React.FunctionComponent<Props> = ({ colors, selected }) =>
width: 40, height: 40,
flexDirection: 'row',
flexWrap: 'wrap',
borderColor: selected ? '#eee' : 'transparent',
borderColor: selected ? 'white' : 'transparent',
borderWidth: 1,
borderRadius: 3,
padding: 1,
}}>
{colors.map((color, index) => (
<View
Expand Down
9 changes: 5 additions & 4 deletions src/components/Sheets/GameSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ const GameSheet: React.FunctionComponent<Props> = ({ navigation, containerHeight
[]
);

const showColorPalettes = useAppSelector(state => state.settings.showColorPalettes);

return (
<BottomSheet
ref={gameSheetRef}
Expand Down Expand Up @@ -229,11 +231,10 @@ const GameSheet: React.FunctionComponent<Props> = ({ navigation, containerHeight

<Animated.View style={[styles.sheetContent, animatedSheetStyle]}>
<Rounds navigation={navigation} show={!fullscreen} />
<Text style={{ color: 'white', margin: 10, marginTop: 0 }}>
Tap on a column to set the current round.
</Text>

<PaletteSelector />
{showColorPalettes &&
<PaletteSelector />
}

<Animated.View layout={Layout.delay(200)}>

Expand Down
8 changes: 7 additions & 1 deletion src/screens/AppInfoScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Alert, Linking, Platform, ScrollView, StyleSheet, Switch, Text, View }
import { Button } from 'react-native-elements';

import { useAppDispatch, useAppSelector } from '../../redux/hooks';
import { toggleShowPlayerIndex, toggleShowPointParticles } from '../../redux/SettingsSlice';
import { toggleShowColorPalettes, toggleShowPlayerIndex, toggleShowPointParticles } from '../../redux/SettingsSlice';
import RotatingIcon from '../components/AppInfo/RotatingIcon';

interface Props {
Expand Down Expand Up @@ -41,10 +41,12 @@ const AppInfoScreen: React.FunctionComponent<Props> = ({ navigation }) => {

const showPointParticles = useAppSelector(state => state.settings.showPointParticles);
const showPlayerIndex = useAppSelector(state => state.settings.showPlayerIndex);
const showColorPalettes = useAppSelector(state => state.settings.showColorPalettes);

const dispatch = useAppDispatch();
const toggleParticleSwitch = () => { dispatch(toggleShowPointParticles()); };
const togglePlayerIndexSwitch = () => { dispatch(toggleShowPlayerIndex()); };
const toggleColorPalettesSwitch = () => { dispatch(toggleShowColorPalettes()); };

const alertWithVersion = async () => {
Alert.alert('ScorePad with Rounds\n' +
Expand Down Expand Up @@ -76,6 +78,10 @@ const AppInfoScreen: React.FunctionComponent<Props> = ({ navigation }) => {
<SectionItemText text="Player Numbers" />
<Switch onValueChange={togglePlayerIndexSwitch} value={showPlayerIndex} />
</SectionItem>
<SectionItem>
<SectionItemText text="Color Palettes" />
<Switch onValueChange={toggleColorPalettesSwitch} value={showColorPalettes} />
</SectionItem>
</Section>

<Section title="Help">
Expand Down
5 changes: 1 addition & 4 deletions src/screens/EditPlayerScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useState } from 'react';
import analytics from '@react-native-firebase/analytics';
import { ParamListBase, RouteProp } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { NativeSyntheticEvent, ScrollView, StyleSheet, Text, TextInput, TextInputEndEditingEventData, View } from 'react-native';
import { NativeSyntheticEvent, ScrollView, StyleSheet, TextInput, TextInputEndEditingEventData, View } from 'react-native';
import { Input } from 'react-native-elements';

import { useAppDispatch, useAppSelector } from '../../redux/hooks';
Expand Down Expand Up @@ -118,9 +118,6 @@ const EditPlayerScreen: React.FC<EditPlayerScreenProps> = ({

<View style={{ margin: 20 }} />

<Text style={{ color: 'white' }}>Local State: {localPlayerName}</Text>
<Text style={{ color: 'white' }}>Player State: {player.playerName}</Text>

</ScrollView>
);
};
Expand Down

0 comments on commit c0f23a3

Please sign in to comment.