diff --git a/frontend/app/components/UsabilityTesting/TestOverview.tsx b/frontend/app/components/UsabilityTesting/TestOverview.tsx index fa7002aba..2dd8cc565 100644 --- a/frontend/app/components/UsabilityTesting/TestOverview.tsx +++ b/frontend/app/components/UsabilityTesting/TestOverview.tsx @@ -107,7 +107,7 @@ function TestOverview() { }, [testId, siteId]); if (!uxtestingStore.instance) { - return No Data; + return Loading Data...; } else { document.title = `Usability Tests | ${uxtestingStore.instance.title}`; } diff --git a/frontend/app/components/shared/SessionsTabOverview/components/SessionTags/SessionTags.tsx b/frontend/app/components/shared/SessionsTabOverview/components/SessionTags/SessionTags.tsx index f6dd45d47..3bccf97dc 100644 --- a/frontend/app/components/shared/SessionsTabOverview/components/SessionTags/SessionTags.tsx +++ b/frontend/app/components/shared/SessionsTabOverview/components/SessionTags/SessionTags.tsx @@ -2,12 +2,12 @@ import { issues_types, types } from 'Types/session/issue'; import { Segmented } from 'antd'; import cn from 'classnames'; import { Angry, CircleAlert, Skull, WifiOff } from 'lucide-react'; +import { observer } from 'mobx-react-lite'; import React, { memo } from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; -import { observer } from 'mobx-react-lite'; -import { useStore } from 'App/mstore'; +import { useStore } from 'App/mstore'; import { setActiveTab } from 'Duck/search'; import { Icon } from 'UI'; @@ -34,63 +34,61 @@ const tagIcons = { [types.BAD_REQUEST]: , [types.CLICK_RAGE]: , [types.CRASH]: , -} as Record +} as Record; -const SessionTags: React.FC = memo( - ({ activeTab, total, setActiveTab }) => { - const { projectsStore } = useStore(); - const platform = projectsStore.active?.platform || ''; - const tags = issues_types.filter( - (tag) => - tag.type !== 'mouse_thrashing' && - (platform === 'web' - ? tag.type !== types.TAP_RAGE - : tag.type !== types.CLICK_RAGE) - ); - const disable = activeTab.type === 'all' && total === 0; +const SessionTags: React.FC = ({ activeTab, total, setActiveTab }) => { + const { projectsStore } = useStore(); + const platform = projectsStore.active?.platform || ''; + const tags = issues_types.filter( + (tag) => + tag.type !== 'mouse_thrashing' && + (platform === 'web' + ? tag.type !== types.TAP_RAGE + : tag.type !== types.CLICK_RAGE) + ); + const disable = activeTab.type === 'all' && total === 0; - const options = tags.map((tag, i) => ({ - label: ( -
- {tag.icon ? ( - tagIcons[tag.type] ? ( - tagIcons[tag.type] - ) : ( - - ) - ) : null} -
- {tag.name} -
+ const options = tags.map((tag, i) => ({ + label: ( +
+ {tag.icon ? ( + tagIcons[tag.type] ? ( + tagIcons[tag.type] + ) : ( + + ) + ) : null} +
+ {tag.name}
- ), - value: tag.type, - disabled: disable && tag.type !== 'all', - })); - - const onPick = (tabValue: string) => { - const tab = tags.find((t) => t.type === tabValue); - if (tab) { - setActiveTab(tab); - } - }; - return ( -
-
- ); - } -); + ), + value: tag.type, + disabled: disable && tag.type !== 'all', + })); + + const onPick = (tabValue: string) => { + const tab = tags.find((t) => t.type === tabValue); + if (tab) { + setActiveTab(tab); + } + }; + return ( +
+ +
+ ); +}; // Separate the TagItem into its own memoized component. export const TagItem: React.FC<{ @@ -138,4 +136,7 @@ const mapDispatchToProps = (dispatch: any): DispatchProps => dispatch ); -export default connect(mapStateToProps, mapDispatchToProps)(observer(SessionTags)); +export default connect( + mapStateToProps, + mapDispatchToProps +)(observer(SessionTags)); diff --git a/frontend/app/components/shared/TrackingCodeModal/ProjectCodeSnippet/ProjectCodeSnippet.js b/frontend/app/components/shared/TrackingCodeModal/ProjectCodeSnippet/ProjectCodeSnippet.js index abe89daad..925526bcf 100644 --- a/frontend/app/components/shared/TrackingCodeModal/ProjectCodeSnippet/ProjectCodeSnippet.js +++ b/frontend/app/components/shared/TrackingCodeModal/ProjectCodeSnippet/ProjectCodeSnippet.js @@ -1,6 +1,6 @@ import React, { useState } from 'react' import { observer } from 'mobx-react-lite' -import { useStore } from 'Project/mstore' +import { useStore } from 'App/mstore' import { Checkbox } from 'UI'; import cn from 'classnames' import styles from './projectCodeSnippet.module.css' diff --git a/frontend/app/duck/index.ts b/frontend/app/duck/index.ts index 941c9b7ea..915174701 100644 --- a/frontend/app/duck/index.ts +++ b/frontend/app/duck/index.ts @@ -3,8 +3,6 @@ import { combineReducers } from 'redux-immutable'; import user from './user'; import sessions from './sessions'; -import sources from './sources'; -import site from './site'; import customFields from './customField'; import search from './search'; import liveSearch from './liveSearch'; @@ -12,11 +10,9 @@ import liveSearch from './liveSearch'; const rootReducer = combineReducers({ user, sessions, - site, customFields, search, liveSearch, - ...sources }); export type RootStore = ReturnType diff --git a/frontend/app/duck/sources/index.js b/frontend/app/duck/sources/index.js deleted file mode 100644 index 66203d13a..000000000 --- a/frontend/app/duck/sources/index.js +++ /dev/null @@ -1,24 +0,0 @@ -import { fromJS, Map, List } from 'immutable'; -import listSourceCreator, { getAction } from './listSourceCreator'; - - -const filtersFromJS = data => fromJS(data) - .update('USERDEVICE', list => list.filter(value => value !== "")) - .update('FID0', list => list.filter(value => value !== "")) - -export default { - values: listSourceCreator('values', '/events/values', ({ value }) => value), - selectors: listSourceCreator('selectors', '/events/selectors', ({ targetSelector }) => targetSelector), - filterValues: listSourceCreator('filterValues', '/sessions/filters', filtersFromJS, true, Map({ - USEROS: List(), - USERBROWSER: List(), - USERDEVICE: List(), - FID0: List(), - REFERRER: List(), - USERCOUNTRY: List(), - })), -}; - -export function fetch(name, params) { - return getAction(name, params); -} diff --git a/frontend/app/duck/sources/listSourceCreator.js b/frontend/app/duck/sources/listSourceCreator.js deleted file mode 100644 index a82473f20..000000000 --- a/frontend/app/duck/sources/listSourceCreator.js +++ /dev/null @@ -1,39 +0,0 @@ -import { List, Map } from 'immutable'; -import withRequestState, { RequestTypes } from 'Duck/requestStateCreator'; - -const actionMap = {}; - -export default ( - name, - endpoint, - fromJS = a => a, - convertFromRoot = false, - customInitialState = Map({ list: List() }), -) => { - const initialState = customInitialState || Map({ - list: List(), - }); - - const FETCH_LIST = new RequestTypes(`${ name }/FETCH_LIST`); - - actionMap[ name ] = params => ({ - types: FETCH_LIST.toArray(), - call: client => client.get(endpoint, params), - }); - - const reducer = (state = initialState, action = {}) => { - switch (action.type) { - case FETCH_LIST.SUCCESS: - return convertFromRoot - ? state.merge(fromJS(action.data)) - : state.set('list', List(action.data).map(fromJS).toSet().toList()); // ?? - } - return state; - }; - - return withRequestState(FETCH_LIST, reducer); -}; - -export function getAction(name, params) { - return actionMap[ name ](params); -}