Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
wyne committed Apr 21, 2024
1 parent 01a75a0 commit 28f6f6c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/components/ScoreLog/RoundScoreColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import React, { memo, useCallback } from 'react';
import analytics from '@react-native-firebase/analytics';
import { LayoutChangeEvent, Text, TouchableWithoutFeedback, View } from 'react-native';

import { selectSortSelectorKey, updateGame } from '../../../redux/GamesSlice';
import { updateGame } from '../../../redux/GamesSlice';
import { useAppDispatch, useAppSelector } from '../../../redux/hooks';
import { selectCurrentGame } from '../../../redux/selectors';

import RoundScoreCell from './RoundScoreCell';
import { sortSelectors } from './SortHelper';
import { SortSelectorKey, sortSelectors } from './SortHelper';

interface Props {
round: number;
Expand All @@ -24,11 +25,9 @@ const RoundScoreColumn: React.FunctionComponent<Props> = ({
}) => {
const dispatch = useAppDispatch();

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

const sortSelectorKey = useAppSelector(state => selectSortSelectorKey(state, currentGameId || ''));
const sortSelector = sortSelectors[sortSelectorKey];

const currentGameId = useAppSelector(state => selectCurrentGame(state)?.id);
const sortKey = useAppSelector(state => selectCurrentGame(state)?.sortSelectorKey);
const sortSelector = sortSelectors[sortKey || SortSelectorKey.ByIndex];
const sortedPlayerIds = useAppSelector(sortSelector);

const onPressHandler = useCallback(async () => {
Expand Down

0 comments on commit 28f6f6c

Please sign in to comment.