Skip to content

Commit

Permalink
More optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
wyne committed Apr 13, 2024
1 parent 7db8954 commit c90b6f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
12 changes: 4 additions & 8 deletions src/components/Boards/FlexboxBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,18 @@ interface FlexboxBoardProps {
}

const FlexboxBoard: React.FC<FlexboxBoardProps> = () => {
const currentGameId = useAppSelector(state => state.settings.currentGameId);
if (typeof currentGameId == 'undefined') return null;
const fullscreen = useAppSelector(state => state.settings.home_fullscreen);
const playerIds = useAppSelector(state => selectCurrentGame(state)?.playerIds);

if (playerIds == null || playerIds.length == 0) return null;

const palette = ["01497c", "c25858", "f5c800", "275436", "dc902c", "62516a", "755647", "925561"];
const [rows, setRows] = useState<number>(0);
const [cols, setCols] = useState<number>(0);
const fullscreen = useAppSelector(state => state.settings.home_fullscreen);
const currentGame = useAppSelector(selectCurrentGame);

const [width, setWidth] = useState<number | null>(null);
const [height, setHeight] = useState<number | null>(null);

if (currentGame == undefined) return null;

const playerIds = currentGame.playerIds;

const playerCount = playerIds.length;

const desiredAspectRatio = 0.8;
Expand Down
4 changes: 0 additions & 4 deletions src/screens/GameScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { LayoutChangeEvent, StyleSheet, View } from 'react-native';

import { useAppSelector } from '../../redux/hooks';
import { selectCurrentGame } from '../../redux/selectors';
import FlexboxBoard from '../components/Boards/FlexboxBoard';
import AddendModal from '../components/Sheets/AddendModal';
import GameSheet from '../components/Sheets/GameSheet';
Expand All @@ -19,9 +18,6 @@ const ScoreBoardScreen: React.FunctionComponent<Props> = ({ navigation }) => {
if (typeof currentGameId == 'undefined') return null;

const fullscreen = useAppSelector(state => state.settings.home_fullscreen);
const currentGame = useAppSelector(selectCurrentGame);

if (currentGame == undefined) return null;

const [windowHeight, setWindowHeight] = useState<number>(0);

Expand Down

0 comments on commit c90b6f2

Please sign in to comment.