ui: drop unreferenced types
This commit is contained in:
parent
6ea2be8dc4
commit
60ac0ed312
9 changed files with 2 additions and 180 deletions
|
|
@ -149,7 +149,6 @@ export default connect(
|
|||
jwt: state.getIn(['user', 'jwt']),
|
||||
fullscreen: state.getIn(['player']).fullcreen,
|
||||
showEvents: state.get('showEvents'),
|
||||
members: state.getIn(['members', 'list']),
|
||||
}),
|
||||
{
|
||||
toggleFullscreen,
|
||||
|
|
|
|||
|
|
@ -257,7 +257,6 @@ export default connect(
|
|||
jwt: state.getIn(['user', 'jwt']),
|
||||
fullscreen: state.getIn(['player', 'fullscreen']),
|
||||
showEvents: state.get('showEvents'),
|
||||
members: state.getIn(['members', 'list']),
|
||||
startedAt: state.getIn(['sessions', 'current']).startedAt || 0,
|
||||
}),
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import NoteEvent from './NoteEvent';
|
|||
@withToggle('showLoadInfo', 'toggleLoadInfo')
|
||||
@connect(
|
||||
(state) => ({
|
||||
members: state.getIn(['members', 'list']),
|
||||
currentUserId: state.getIn(['user', 'account', 'id'])
|
||||
}),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -12,10 +12,8 @@ import SessionList from './components/SessionList';
|
|||
function SessionsTabOverview({
|
||||
activeTab,
|
||||
appliedFilter,
|
||||
members,
|
||||
}: {
|
||||
activeTab: string;
|
||||
members: object[];
|
||||
sites: object[];
|
||||
siteId: string;
|
||||
appliedFilter: any;
|
||||
|
|
@ -50,7 +48,7 @@ function SessionsTabOverview({
|
|||
{activeTab !== 'notes' ? (
|
||||
<SessionList />
|
||||
) : (
|
||||
<NotesList members={members} />
|
||||
<NotesList />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { observer } from 'mobx-react-lite';
|
|||
import { useStore } from 'App/mstore';
|
||||
import AnimatedSVG, { ICONS } from 'Shared/AnimatedSVG/AnimatedSVG';
|
||||
|
||||
function NotesList({ members }: { members: Array<Record<string, any>> }) {
|
||||
function NotesList() {
|
||||
const { notesStore } = useStore();
|
||||
|
||||
React.useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import filters from './filters';
|
|||
import funnelFilters from './funnelFilters';
|
||||
import player from './components/player'
|
||||
import sources from './sources';
|
||||
import members from './member';
|
||||
import site from './site';
|
||||
import customFields from './customField';
|
||||
import integrations from './integrations';
|
||||
|
|
@ -25,7 +24,6 @@ const rootReducer = combineReducers({
|
|||
filters,
|
||||
funnelFilters,
|
||||
player,
|
||||
members,
|
||||
site,
|
||||
customFields,
|
||||
errors,
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
import { Map } from 'immutable';
|
||||
import Member from 'Types/member';
|
||||
import crudDuckGenerator from './tools/crudDuck';
|
||||
import { RequestTypes } from 'Duck/requestStateCreator';
|
||||
import { reduceDucks } from 'Duck/tools';
|
||||
|
||||
const GENERATE_LINK = new RequestTypes('member/GENERATE_LINK');
|
||||
|
||||
const crudDuck = crudDuckGenerator('client/member', Member, { idKey: 'id' });
|
||||
export const { fetchList, init, edit, remove, } = crudDuck.actions;
|
||||
|
||||
const initialState = Map({
|
||||
definedPercent: 0,
|
||||
});
|
||||
|
||||
const reducer = (state = initialState, action = {}) => {
|
||||
switch (action.type) {
|
||||
case GENERATE_LINK.SUCCESS:
|
||||
return state.update(
|
||||
'list',
|
||||
list => list
|
||||
.map(member => {
|
||||
if(member.id === action.id) {
|
||||
return Member({...member.toJS(), invitationLink: action.data.invitationLink })
|
||||
}
|
||||
return member
|
||||
})
|
||||
);
|
||||
}
|
||||
return state;
|
||||
};
|
||||
|
||||
export function save(instance) {
|
||||
return {
|
||||
types: crudDuck.actionTypes.SAVE.toArray(),
|
||||
call: client => client.put( instance.id ? `/client/members/${ instance.id }` : '/client/members', instance.toData()),
|
||||
};
|
||||
}
|
||||
|
||||
export default reduceDucks(crudDuck, { initialState, reducer }).reducer;
|
||||
|
|
@ -2,7 +2,6 @@ import Site from "Types/site";
|
|||
import GDPR from 'Types/site/gdpr';
|
||||
import {
|
||||
mergeReducers,
|
||||
createItemInListUpdater,
|
||||
success,
|
||||
array,
|
||||
createListUpdater
|
||||
|
|
@ -24,7 +23,6 @@ const storedSiteId = localStorage.getItem(SITE_ID_STORAGE_KEY);
|
|||
|
||||
const name = 'project';
|
||||
const idKey = 'id';
|
||||
const itemInListUpdater = createItemInListUpdater(idKey);
|
||||
const updateItemInList = createListUpdater(idKey);
|
||||
|
||||
const EDIT_GDPR = 'sites/EDIT_GDPR';
|
||||
|
|
|
|||
|
|
@ -1,129 +0,0 @@
|
|||
import { PayloadAction, createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
||||
import Site, { ISite } from "Types/site";
|
||||
import GDPR, { IGDPR } from 'Types/site/gdpr';
|
||||
import { apiClient } from 'App/api_client';
|
||||
|
||||
import { GLOBAL_HAS_NO_RECORDINGS, SITE_ID_STORAGE_KEY } from "../constants/storageKeys";
|
||||
import { array } from "./funcTools/tools";
|
||||
|
||||
|
||||
const storedSiteId = localStorage.getItem(SITE_ID_STORAGE_KEY);
|
||||
|
||||
interface SiteState {
|
||||
list: ISite[];
|
||||
instance: ISite | null;
|
||||
remainingSites?: number;
|
||||
siteId?: number;
|
||||
active: ISite | null;
|
||||
}
|
||||
|
||||
const initialState: SiteState = {
|
||||
list: [],
|
||||
instance: null,
|
||||
remainingSites: undefined,
|
||||
siteId: undefined,
|
||||
active: null,
|
||||
};
|
||||
|
||||
const siteSlice = createSlice({
|
||||
name: 'site',
|
||||
initialState,
|
||||
reducers: {
|
||||
init: (state, action: PayloadAction<ISite>) => {
|
||||
state.instance = action.payload;
|
||||
},
|
||||
editGDPR(state, action: PayloadAction<IGDPR>) {
|
||||
state.instance = {
|
||||
...state.instance!,
|
||||
gdpr: action.payload,
|
||||
}
|
||||
},
|
||||
setSiteId(state, action: PayloadAction<string>) {
|
||||
const siteId = action.payload;
|
||||
const site = state.list.find((s) => s.id === parseInt(siteId));
|
||||
if (site) {
|
||||
state.siteId = siteId;
|
||||
state.active = site;
|
||||
localStorage.setItem(SITE_ID_STORAGE_KEY, siteId);
|
||||
}
|
||||
},
|
||||
updateProjectRecordingStatus(state, action: PayloadAction<{ siteId: string; status: boolean }>) {
|
||||
const { siteId, status } = action.payload;
|
||||
const site = state.list.find((s) => s.id === parseInt(siteId));
|
||||
if (site) {
|
||||
site.recorded = status;
|
||||
}
|
||||
},
|
||||
fetchGDPRSuccess(state, action: { data: IGDPR }) {
|
||||
state.instance = {
|
||||
...state.instance!,
|
||||
gdpr: GDPR(action.data),
|
||||
}
|
||||
},
|
||||
saveSiteSuccess(state, action: { data: ISite }) {
|
||||
const newSite = Site(action.data);
|
||||
state.siteId = newSite.id;
|
||||
state.instance = newSite;
|
||||
state.active = newSite;
|
||||
},
|
||||
saveGDPRSuccess(state, action: { data: IGDPR }) {
|
||||
const gdpr = GDPR(action.data);
|
||||
state.instance = {
|
||||
...state.instance!,
|
||||
gdpr: gdpr,
|
||||
}
|
||||
},
|
||||
fetchListSuccess(state, action: { data: ISite[], siteIdFromPath: number }) {
|
||||
const siteId = state.siteId;
|
||||
const ids = action.data.map(s => parseInt(s.projectId))
|
||||
const siteExists = ids.includes(parseInt(siteId!));
|
||||
if (action.siteIdFromPath && ids.includes(parseInt(action.siteIdFromPath))) {
|
||||
state.siteId = action.siteIdFromPath;
|
||||
} else if (!siteId || !siteExists) {
|
||||
state.siteId = ids.includes(parseInt(storedSiteId!))
|
||||
? storedSiteId
|
||||
: action.data[0].projectId;
|
||||
}
|
||||
const list = action.data.map(Site);
|
||||
const hasRecordings = list.some(s => s.recorded);
|
||||
if (!hasRecordings) {
|
||||
localStorage.setItem(GLOBAL_HAS_NO_RECORDINGS, 'true');
|
||||
} else {
|
||||
localStorage.removeItem(GLOBAL_HAS_NO_RECORDINGS);
|
||||
}
|
||||
|
||||
state.list = list;
|
||||
state.active = list.find(s => parseInt(s.id) === parseInt(state.siteId!));
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
export function save(site: ISite) {
|
||||
return {
|
||||
types: ['sites/saveSiteRequest', 'sites/saveSiteSuccess', 'sites/saveSiteFail'],
|
||||
call: (client) => client.post(`/projects`, site),
|
||||
};
|
||||
}
|
||||
|
||||
export function fetchGDPR(siteId: number) {
|
||||
return {
|
||||
types: ['sites/fetchGDPRRequest', 'sites/fetchGDPRSuccess', 'sites/fetchGDPRFail'],
|
||||
call: (client) => client.get(`/${siteId}/gdpr`),
|
||||
};
|
||||
}
|
||||
|
||||
export const saveGDPR = (siteId: number) => (dispatch, getState) => {
|
||||
const g = getState().site.instance.gdpr;
|
||||
return dispatch({
|
||||
types: ['sites/saveGDPRRequest', 'sites/saveGDPRSuccess', 'sites/saveGDPRFail'],
|
||||
call: client => client.post(`/${siteId}/gdpr`, g)
|
||||
});
|
||||
};
|
||||
|
||||
export function fetchList(siteId: number) {
|
||||
return {
|
||||
types: ['sites/fetchListRequest', 'sites/fetchListSuccess', 'sites/fetchListFail'],
|
||||
call: client => client.get('/projects'),
|
||||
siteIdFromPath: siteId
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue