Compare commits
7 Commits
renovate/a
...
ahtisham/I
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2db3a5b68e | ||
|
|
202fd3315a | ||
|
|
fe8ffbd345 | ||
|
|
2913de47ac | ||
|
|
9a26173b7f | ||
|
|
ad3346ea09 | ||
|
|
545b69376f |
@@ -10,12 +10,13 @@ import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
|
||||
import { AppContext } from '@edx/frontend-platform/react';
|
||||
import { breakpoints, useWindowSize } from '@edx/paragon';
|
||||
|
||||
import { Routes } from '../../data/constants';
|
||||
import { RequestStatus, Routes } from '../../data/constants';
|
||||
import { selectTopicsUnderCategory } from '../../data/selectors';
|
||||
import { fetchCourseBlocks } from '../../data/thunks';
|
||||
import { DiscussionContext } from '../common/context';
|
||||
import { clearRedirect } from '../posts/data';
|
||||
import { selectTopics } from '../topics/data/selectors';
|
||||
import { threadsLoadingStatus } from '../posts/data/selectors';
|
||||
import { selectTopics, topicsLoadingStatus } from '../topics/data/selectors';
|
||||
import { fetchCourseTopics } from '../topics/data/thunks';
|
||||
import { discussionsPath, inBlackoutDateRange } from '../utils';
|
||||
import {
|
||||
@@ -48,14 +49,27 @@ export function useTotalTopicThreadCount() {
|
||||
export const useSidebarVisible = () => {
|
||||
const isFiltered = useSelector(selectAreThreadsFiltered);
|
||||
const totalThreads = useSelector(selectPostThreadCount);
|
||||
const isViewingTopics = useRouteMatch(Routes.TOPICS.PATH);
|
||||
const threadsCallStatus = useSelector(threadsLoadingStatus);
|
||||
const isViewingSpecificTopic = useRouteMatch(Routes.TOPICS.TOPIC);
|
||||
const isViewingTopics = useRouteMatch(Routes.TOPICS.ALL);
|
||||
const isViewingLearners = useRouteMatch(Routes.LEARNERS.PATH);
|
||||
const topicsLoading = useSelector(topicsLoadingStatus);
|
||||
|
||||
if (
|
||||
isViewingSpecificTopic
|
||||
&& isViewingSpecificTopic.isExact
|
||||
&& totalThreads > 0
|
||||
&& topicsLoading === RequestStatus.SUCCESSFUL
|
||||
&& threadsCallStatus === RequestStatus.SUCCESSFUL
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isFiltered) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isViewingTopics || isViewingLearners) {
|
||||
if ((isViewingTopics && isViewingTopics.isExact) || isViewingLearners) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user