fix(ui): fix prop types for sessionitem
This commit is contained in:
parent
cea1218613
commit
d72f47b296
2 changed files with 18 additions and 18 deletions
|
|
@ -20,14 +20,14 @@ const PER_PAGE = 10;
|
|||
|
||||
interface Props {
|
||||
loading: Boolean,
|
||||
list: List<any>,
|
||||
list: List<any>,
|
||||
fetchLiveList: () => Promise<void>,
|
||||
applyFilter: () => void,
|
||||
filters: any,
|
||||
addAttribute: (obj) => void,
|
||||
addFilterByKeyAndValue: (key: FilterKey, value: string) => void,
|
||||
updateCurrentPage: (page: number) => void,
|
||||
currentPage: number,
|
||||
currentPage: number,
|
||||
metaList: any,
|
||||
updateSort: (sort: any) => void,
|
||||
sort: any,
|
||||
|
|
@ -41,7 +41,7 @@ function LiveSessionList(props: Props) {
|
|||
const sortOptions = metaList.map(i => ({
|
||||
text: capitalize(i), value: i
|
||||
})).toJS();
|
||||
|
||||
|
||||
// const displayedCount = Math.min(currentPage * PER_PAGE, sessions.size);
|
||||
// const addPage = () => props.updateCurrentPage(props.currentPage + 1)
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ function LiveSessionList(props: Props) {
|
|||
if (filter.key === FilterKey.USERID) {
|
||||
const _userId = session.userId ? session.userId.toLowerCase() : '';
|
||||
hasValidFilter = _values.length > 0 ? (_values.includes(_userId) && hasValidFilter) || _values.some(i => _userId.includes(i)) : hasValidFilter;
|
||||
}
|
||||
}
|
||||
if (filter.category === FilterCategory.METADATA) {
|
||||
const _source = session.metadata[filter.key] ? session.metadata[filter.key].toLowerCase() : '';
|
||||
hasValidFilter = _values.length > 0 ? (_values.includes(_source) && hasValidFilter) || _values.some(i => _source.includes(i)) : hasValidFilter;
|
||||
|
|
@ -80,7 +80,7 @@ function LiveSessionList(props: Props) {
|
|||
setSessions(filteredSessions);
|
||||
}, [filters, list]);
|
||||
|
||||
useEffect(() => {
|
||||
useEffect(() => {
|
||||
props.fetchLiveList();
|
||||
timeout();
|
||||
return () => {
|
||||
|
|
@ -88,7 +88,7 @@ function LiveSessionList(props: Props) {
|
|||
}
|
||||
}, [])
|
||||
|
||||
const onUserClick = (userId, userAnonymousId) => {
|
||||
const onUserClick = (userId: string, userAnonymousId: string) => {
|
||||
if (userId) {
|
||||
props.addFilterByKeyAndValue(FilterKey.USERID, userId);
|
||||
} else {
|
||||
|
|
@ -183,7 +183,7 @@ export default withPermissions(['ASSIST_LIVE'])(connect(
|
|||
metaList: state.getIn(['customFields', 'list']).map(i => i.key),
|
||||
sort: state.getIn(['liveSearch', 'sort']),
|
||||
}),
|
||||
{
|
||||
{
|
||||
fetchLiveList,
|
||||
applyFilter,
|
||||
addAttribute,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { observer } from 'mobx-react-lite';
|
|||
import { durationFormatted, formatTimeOrDate } from 'App/date';
|
||||
import stl from './sessionItem.css';
|
||||
import Counter from './Counter'
|
||||
import { useLocation, RouteComponentProps } from 'react-router-dom';
|
||||
import { withRouter, RouteComponentProps } from 'react-router-dom';
|
||||
import SessionMetaList from './SessionMetaList';
|
||||
import PlayLink from './PlayLink';
|
||||
import ErrorBars from './ErrorBars';
|
||||
|
|
@ -47,15 +47,16 @@ interface Props {
|
|||
issueTypes: [];
|
||||
active: boolean;
|
||||
},
|
||||
onUserClick: (userId: string, userAnonymousId: string) => null;
|
||||
hasUserFilter: boolean;
|
||||
disableUser: boolean;
|
||||
metaList: Array<any>;
|
||||
showActive: boolean;
|
||||
lastPlayedSessionId: string;
|
||||
onUserClick?: (userId: string, userAnonymousId: string) => void;
|
||||
hasUserFilter?: boolean;
|
||||
disableUser?: boolean;
|
||||
metaList?: Array<any>;
|
||||
showActive?: boolean;
|
||||
lastPlayedSessionId?: string;
|
||||
live?: boolean;
|
||||
}
|
||||
|
||||
function SessionItem(props: Props) {
|
||||
function SessionItem(props: RouteComponentProps<Props>) {
|
||||
const { settingsStore } = useStore();
|
||||
const { timezone } = settingsStore.sessionSettings;
|
||||
|
||||
|
|
@ -88,9 +89,8 @@ function SessionItem(props: Props) {
|
|||
issueTypes,
|
||||
active,
|
||||
} = session;
|
||||
const location = useLocation();
|
||||
|
||||
console.log(location.pathname);
|
||||
const location = props.location;
|
||||
|
||||
const formattedDuration = durationFormatted(duration);
|
||||
const hasUserId = userId || userAnonymousId;
|
||||
|
|
@ -187,4 +187,4 @@ function SessionItem(props: Props) {
|
|||
)
|
||||
}
|
||||
|
||||
export default observer<Props>(SessionItem)
|
||||
export default withRouter<Props>(observer<Props>(SessionItem))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue