diff --git a/src/common/MenuLayout.tsx b/src/common/MenuLayout.tsx index 87a4a58f..8e9ab6bd 100644 --- a/src/common/MenuLayout.tsx +++ b/src/common/MenuLayout.tsx @@ -12,8 +12,8 @@ import { AsideMenuProps } from './AsideMenu'; import './MenuLayout.scss'; interface MenuLayoutProps { - sidebarRendered: Function; - sidebarNotRendered: Function; + sidebarPresent: Function; + sidebarNotPresent: Function; } const MenuLayout = ( @@ -29,16 +29,16 @@ const MenuLayout = ( Overview: FC, EditShortUrl: FC, ManageDomains: FC, -) => withSelectedServer(({ selectedServer, sidebarNotRendered, sidebarRendered }) => { +) => withSelectedServer(({ selectedServer, sidebarNotPresent, sidebarPresent }) => { const location = useLocation(); const [ sidebarVisible, toggleSidebar, showSidebar, hideSidebar ] = useToggle(); const showContent = isReachableServer(selectedServer); useEffect(() => hideSidebar(), [ location ]); useEffect(() => { - showContent && sidebarRendered(); + showContent && sidebarPresent(); - return () => sidebarNotRendered(); + return () => sidebarNotPresent(); }, []); if (!showContent) { diff --git a/src/common/reducers/sidebar.ts b/src/common/reducers/sidebar.ts index 7e05686f..cc04da3e 100644 --- a/src/common/reducers/sidebar.ts +++ b/src/common/reducers/sidebar.ts @@ -2,8 +2,8 @@ import { Action } from 'redux'; import { buildActionCreator, buildReducer } from '../../utils/helpers/redux'; /* eslint-disable padding-line-between-statements */ -export const SIDEBAR_RENDERED = 'shlink/common/SIDEBAR_RENDERED'; -export const SIDEBAR_NOT_RENDERED = 'shlink/common/SIDEBAR_NOT_RENDERED'; +export const SIDEBAR_PRESENT = 'shlink/common/SIDEBAR_PRESENT'; +export const SIDEBAR_NOT_PRESENT = 'shlink/common/SIDEBAR_NOT_PRESENT'; /* eslint-enable padding-line-between-statements */ export interface Sidebar { @@ -18,10 +18,10 @@ const initialState: Sidebar = { }; export default buildReducer({ - [SIDEBAR_RENDERED]: () => ({ hasSidebar: true }), - [SIDEBAR_NOT_RENDERED]: () => ({ hasSidebar: false }), + [SIDEBAR_PRESENT]: () => ({ hasSidebar: true }), + [SIDEBAR_NOT_PRESENT]: () => ({ hasSidebar: false }), }, initialState); -export const sidebarRendered = buildActionCreator(SIDEBAR_RENDERED); +export const sidebarPresent = buildActionCreator(SIDEBAR_PRESENT); -export const sidebarNotRendered = buildActionCreator(SIDEBAR_NOT_RENDERED); +export const sidebarNotPresent = buildActionCreator(SIDEBAR_NOT_PRESENT); diff --git a/src/common/services/provideServices.ts b/src/common/services/provideServices.ts index 354c08af..c085aeaf 100644 --- a/src/common/services/provideServices.ts +++ b/src/common/services/provideServices.ts @@ -9,7 +9,7 @@ import ErrorHandler from '../ErrorHandler'; import ShlinkVersionsContainer from '../ShlinkVersionsContainer'; import { ConnectDecorator } from '../../container/types'; import { withoutSelectedServer } from '../../servers/helpers/withoutSelectedServer'; -import { sidebarNotRendered, sidebarRendered } from '../reducers/sidebar'; +import { sidebarNotPresent, sidebarPresent } from '../reducers/sidebar'; import { ImageDownloader } from './ImageDownloader'; const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { @@ -45,7 +45,7 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { 'EditShortUrl', 'ManageDomains', ); - bottle.decorator('MenuLayout', connect([ 'selectedServer' ], [ 'selectServer', 'sidebarRendered', 'sidebarNotRendered' ])); + bottle.decorator('MenuLayout', connect([ 'selectedServer' ], [ 'selectServer', 'sidebarPresent', 'sidebarNotPresent' ])); bottle.serviceFactory('AsideMenu', AsideMenu, 'DeleteServerButton'); @@ -55,8 +55,8 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { bottle.serviceFactory('ErrorHandler', ErrorHandler, 'window', 'console'); // Actions - bottle.serviceFactory('sidebarRendered', () => sidebarRendered); - bottle.serviceFactory('sidebarNotRendered', () => sidebarNotRendered); + bottle.serviceFactory('sidebarPresent', () => sidebarPresent); + bottle.serviceFactory('sidebarNotPresent', () => sidebarNotPresent); }; export default provideServices; diff --git a/test/common/MenuLayout.test.tsx b/test/common/MenuLayout.test.tsx index 4e79a36e..cb563852 100644 --- a/test/common/MenuLayout.test.tsx +++ b/test/common/MenuLayout.test.tsx @@ -22,8 +22,8 @@ describe('', () => { wrapper = shallow( ,