Skip to content

Commit

Permalink
[#495]: remove sagas analytics and game
Browse files Browse the repository at this point in the history
  • Loading branch information
Themezv committed May 1, 2024
1 parent 0550443 commit 469f443
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 63 deletions.
3 changes: 1 addition & 2 deletions apps/ligretto-frontend/src/app/store/rootSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import { socketSaga } from '#entities/socket'
import { gameRootSaga } from '#ducks/game'
import { usersRootSaga } from '#ducks/users'
import { authRootSaga, getMeSuccess } from '#ducks/auth'
import { analyticsRootSaga } from '#ducks/analytics/sagas'

export default function* rootSaga() {
yield all([fork(analyticsRootSaga), fork(gameRootSaga), fork(authRootSaga), fork(usersRootSaga), fork(blockedSocketSaga)])
yield all([fork(gameRootSaga), fork(authRootSaga), fork(usersRootSaga), fork(blockedSocketSaga)])
}

function* blockedSocketSaga() {
Expand Down
5 changes: 0 additions & 5 deletions apps/ligretto-frontend/src/ducks/analytics/actions.ts

This file was deleted.

4 changes: 0 additions & 4 deletions apps/ligretto-frontend/src/ducks/analytics/analytics.ts

This file was deleted.

2 changes: 0 additions & 2 deletions apps/ligretto-frontend/src/ducks/analytics/index.ts

This file was deleted.

19 changes: 0 additions & 19 deletions apps/ligretto-frontend/src/ducks/analytics/sagas.ts

This file was deleted.

6 changes: 6 additions & 0 deletions apps/ligretto-frontend/src/ducks/auth/authSagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import type { User } from '../users/usersTypes'
import { logout, getMeRequest, getMeSuccess } from './authActions'
import { LOCAL_STORAGE_TOKEN_KEY } from './constants'

import { analytics } from '#entities/analytics'

export function* initSaga() {
const token = window.localStorage.getItem(LOCAL_STORAGE_TOKEN_KEY) ?? undefined
yield put(getMeRequest({ token }))
Expand All @@ -25,6 +27,10 @@ export function* getMeSaga({ payload }: ReturnType<typeof getMeRequest>) {
username: user?.username,
})
window.localStorage.setItem(LOCAL_STORAGE_TOKEN_KEY, user.token)

analytics.setUserProperties({ id: user.userId, isTemporary: user.isTemporary })
analytics.logEvent('User authorized')

yield put(getMeSuccess({ ...user }))
}

Expand Down
16 changes: 0 additions & 16 deletions apps/ligretto-frontend/src/ducks/game/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,6 @@ import { socketConnectedAction } from '#entities/socket'
import { locationSelector } from '#ducks/router'
import { connectToRoomAction } from '#ducks/rooms'

function* gameUpdateSaga(action: ReturnType<typeof updateGameAction>) {
const game = action.payload
yield put(updateGameSliceAction(game))
}

function* togglePlayerStatusSaga() {
const currentStatus: ReturnType<typeof playerStatusSelector> = yield select(playerStatusSelector)
const gameId: ReturnType<typeof gameIdSelector> = yield select(gameIdSelector)

const status = currentStatus === PlayerStatus.DontReadyToPlay ? PlayerStatus.ReadyToPlay : PlayerStatus.DontReadyToPlay

yield put(setPlayerStatusEmitAction({ status, gameId }))
}

function* connectToRoomSuccessSaga(action: ReturnType<typeof connectToRoomSuccessAction>) {
yield put(updateGameSliceAction(action.payload.game))
yield put(setGameLoadedAction(true))
Expand Down Expand Up @@ -157,8 +143,6 @@ function* handleLocationChangeSaga() {
}

export function* gameRootSaga() {
yield takeLatest(updateGameAction, gameUpdateSaga)
yield takeLatest(togglePlayerStatusAction, togglePlayerStatusSaga)
yield takeLatest(startGameAction, startGameSaga)
yield takeEvery(tapCardAction, tapCardSaga)
yield takeEvery(tapStackOpenDeckCardAction, tapStackOpenDeckCardActionSaga)
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 469f443

Please sign in to comment.