This repository has been archived by the owner on Jan 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(selectors): remove unused selectors
fix(selectors): remove unused selectors
- Loading branch information
Showing
1 changed file
with
16 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
// @flow | ||
import type {State as AuthState} from 'reducers/auth' | ||
import type {State as LayoutState} from 'reducers/layout' | ||
import type {State as EntitiesLinksState} from 'reducers/links' | ||
import type {GlobalState} from 'reducers' | ||
import {createSelector} from 'reselect' | ||
|
||
export const getAuthState = (state: GlobalState): AuthState => state.me.auth | ||
export const getLayoutState = (state: GlobalState): LayoutState => state.layout | ||
export const getEntitiesLinksState = (state: GlobalState): EntitiesLinksState => state.entities.links | ||
export const isLoaded = state => state.fetchStatus === 'loaded' | ||
export const getLayoutState = state => state.layout | ||
export const getEntitiesLinksState = state => state.entities.links | ||
|
||
const defaultWindowInnerWidth = 1025 | ||
export const getWindowInnerWidth = (window: Object): number => { | ||
const defaultWindowInnerWidth = 1025 | ||
return window && window.innerWidth | ||
? window.innerWidth | ||
: defaultWindowInnerWidth | ||
} | ||
|
||
export const computeLayoutMobileStatuses = ({innerWidth}) => { | ||
const isMobile: boolean = innerWidth < 993 | ||
const isMobileXS: boolean = innerWidth < 481 | ||
const isMobileSM: boolean = innerWidth > 480 && innerWidth < 767 | ||
return {isMobileSM, isMobileXS, isMobile} | ||
} | ||
|
||
export const getLayoutMobileStatuses = createSelector( | ||
getLayoutState, computeLayoutMobileStatuses | ||
) |