Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
jongwooha98 committed Nov 22, 2021
1 parent 0d68409 commit 08b8a97
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 24 deletions.
21 changes: 3 additions & 18 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useCallback, useEffect, useState } from 'react';
import '@karrotframe/navigator/index.css';
import { Navigator, Screen, useNavigator } from '@karrotframe/navigator';
import { Navigator, Screen } from '@karrotframe/navigator';
import { Home } from 'pages/Home';
import { Game2048Home } from 'pages/Game2048/Home';
import { Game2048Game } from 'pages/Game2048/Game';
Expand Down Expand Up @@ -31,8 +31,7 @@ import { useMinigameApi } from 'services/api/minigameApi';
const App: React.FC = () => {
const minigameApi = useMinigameApi();

const { setRegionInfo, setTownInfo, setUserInfo, setIsInstalled } =
useUserData();
const { setRegionInfo, setTownInfo, setIsInstalled } = useUserData();
const { accessToken } = useAccessToken();
const { signAccessToken, removeCookie } = useSignAccessToken();
const [analytics, setAnalytics] = useState(emptyAnalytics);
Expand Down Expand Up @@ -97,21 +96,6 @@ const App: React.FC = () => {
[minigameApi.regionApi, setTownInfo]
);

// const updateUserInfo = useCallback(async () => {
// console.log('update user info attempt');
// const {
// data: { data },
// } = await minigameApi.userApi.getUserInfoUsingGET();
// console.log(data);
// if (data) {
// setUserInfo(data.id, data.nickname);
// // FA: track user with set user id
// analytics.setUserId(data.id);

// console.log('setuserinfo', data.id, data.nickname);
// }
// }, [analytics, minigameApi.userApi, setUserInfo]);

const fetchData = useCallback(
async (code: string, regionId: string) => {
console.log('fetch data', code, regionId);
Expand Down Expand Up @@ -140,6 +124,7 @@ const App: React.FC = () => {
}

fetchData(code as string, regionId as string);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
// accessToken,
analytics,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Game2048/Game/Modal/GameOver.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const GameOver: React.FC<Props> = (props) => {
} catch (error) {
console.error(error);
}
}, [gameType, minigameApi.gameUserApi]);
}, [gameType, minigameApi.gameUserApi, updateMyScore]);

const handleViewLeaderboard = async () => {
console.log('try to view leaderboard');
Expand Down
5 changes: 1 addition & 4 deletions src/pages/Game2048/Game/hooks/useGame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const useGame = () => {
const [state, dispatch] = useReducer(game2048Reducer, initialState);
const { score, tiles, byIds, hasChanged, inMotion } = state;
const [isGameOver, setIsGameOver] = useState<boolean>(false);
const [nextBoard, setNextBoard] = useState<number[]>();

const createTile = useCallback(
({ coordinate, value }: Partial<TileProps>) => {
Expand Down Expand Up @@ -222,10 +221,8 @@ export const useGame = () => {
setTimeout(() => {
dispatch(moveEndAction());
}, animationDuration);

setNextBoard(() => retrieveTileMap());
},
[dispatch, retrieveTileMap, throttledMergeTile, tiles, updateTile]
[dispatch, throttledMergeTile, tiles, updateTile]
);

const moveLeftFactory = (board: number[]) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { css } from '@emotion/css';
import styled from '@emotion/styled';
import { TopUserRow } from '../Row/TopRow';
import { DefaultUserRow } from '../Row/DefaultRow';
Expand Down

0 comments on commit 08b8a97

Please sign in to comment.