Skip to content

Commit

Permalink
Merge branch 'master' into fatima/INF-1224
Browse files Browse the repository at this point in the history
  • Loading branch information
awais-ansari authored Jan 31, 2024
2 parents c4b75bf + f69b2c1 commit 60aa2b0
Show file tree
Hide file tree
Showing 159 changed files with 1,153 additions and 1,079 deletions.
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ module.exports = createConfig('jest', {
// If you want to add config BEFORE jest loads, use setupFiles instead.
setupFiles: ['<rootDir>/.env.test'],
setupFilesAfterEnv: [
'<rootDir>/src/setupTest.js',
'<rootDir>/src/setupTest.jsx',
],
coveragePathIgnorePatterns: [
'src/setupTest.js',
'src/setupTest.jsx',
'src/i18n',
],
});
15 changes: 11 additions & 4 deletions src/components/FilterBar.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/forbid-prop-types */
import React, { useCallback, useMemo, useState } from 'react';
import PropTypes from 'prop-types';

Expand All @@ -15,7 +14,7 @@ import {
PostsStatusFilter, RequestStatus,
ThreadOrdering, ThreadType,
} from '../data/constants';
import { selectCourseCohorts } from '../discussions/cohorts/data/selectors';
import selectCourseCohorts from '../discussions/cohorts/data/selectors';
import messages from '../discussions/posts/post-filter-bar/messages';
import { ActionItem } from '../discussions/posts/post-filter-bar/PostFilterBar';

Expand Down Expand Up @@ -194,8 +193,16 @@ const FilterBar = ({

FilterBar.propTypes = {
intl: intlShape.isRequired,
filters: PropTypes.array.isRequired,
selectedFilters: PropTypes.object.isRequired,
filters: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string,
filters: PropTypes.arrayOf(PropTypes.string),
})).isRequired,
selectedFilters: PropTypes.shape({
postType: ThreadType,
status: PostsStatusFilter,
orderBy: ThreadOrdering,
cohort: PropTypes.string,
}).isRequired,
onFilterChange: PropTypes.func.isRequired,
showCohortsFilter: PropTypes.bool,
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/NavigationBar/CourseTabsNavigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useDispatch, useSelector } from 'react-redux';

import { useIntl } from '@edx/frontend-platform/i18n';

import { fetchTab } from './data/thunks';
import fetchTab from './data/thunks';
import Tabs from './tabs/Tabs';
import messages from './messages';

Expand Down
1 change: 0 additions & 1 deletion src/components/NavigationBar/data/api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/prefer-default-export */
import { camelCaseObject } from '@edx/frontend-platform';
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';

Expand Down
4 changes: 2 additions & 2 deletions src/components/NavigationBar/data/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
import { initializeMockApp } from '@edx/frontend-platform/testing';

import { initializeStore } from '../../../store';
import { executeThunk } from '../../../test-utils';
import executeThunk from '../../../test-utils';
import { getCourseMetadataApiUrl } from './api';
import { fetchTab } from './thunks';
import fetchTab from './thunks';

import './__factories__';

Expand Down
4 changes: 2 additions & 2 deletions src/components/NavigationBar/data/selectors.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* eslint-disable import/prefer-default-export */
const selectCourseTabs = state => state.courseTabs;

export const selectCourseTabs = state => state.courseTabs;
export default selectCourseTabs;
55 changes: 33 additions & 22 deletions src/components/NavigationBar/data/slice.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-param-reassign */
import { createSlice } from '@reduxjs/toolkit';

export const LOADING = 'loading';
Expand All @@ -17,27 +16,39 @@ const slice = createSlice({
org: null,
},
reducers: {
fetchTabDenied: (state, { payload }) => {
state.courseId = payload.courseId;
state.courseStatus = DENIED;
},
fetchTabFailure: (state, { payload }) => {
state.courseId = payload.courseId;
state.courseStatus = FAILED;
},
fetchTabRequest: (state, { payload }) => {
state.courseId = payload.courseId;
state.courseStatus = LOADING;
},
fetchTabSuccess: (state, { payload }) => {
state.courseId = payload.courseId;
state.targetUserId = payload.targetUserId;
state.tabs = payload.tabs;
state.courseStatus = LOADED;
state.courseTitle = payload.courseTitle;
state.courseNumber = payload.courseNumber;
state.org = payload.org;
},
fetchTabDenied: (state, { payload }) => (
{
...state,
courseId: payload.courseId,
courseStatus: DENIED,
}
),
fetchTabFailure: (state, { payload }) => (
{
...state,
courseId: payload.courseId,
courseStatus: FAILED,
}
),
fetchTabRequest: (state, { payload }) => (
{
...state,
courseId: payload.courseId,
courseStatus: LOADING,
}
),
fetchTabSuccess: (state, { payload }) => (
{
...state,
courseId: payload.courseId,
targetUserId: payload.targetUserId,
tabs: payload.tabs,
courseStatus: LOADED,
courseTitle: payload.courseTitle,
courseNumber: payload.courseNumber,
org: payload.org,
}
),
},
});

Expand Down
3 changes: 1 addition & 2 deletions src/components/NavigationBar/data/thunks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/prefer-default-export, no-unused-expressions */
import { logError } from '@edx/frontend-platform/logging';

import { getHttpErrorStatus } from '../../../discussions/utils';
Expand All @@ -10,7 +9,7 @@ import {
fetchTabSuccess,
} from './slice';

export function fetchTab(courseId, rootSlug) {
export default function fetchTab(courseId, rootSlug) {
return async (dispatch) => {
dispatch(fetchTabRequest({ courseId }));
try {
Expand Down
2 changes: 0 additions & 2 deletions src/components/NavigationBar/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useIntl } from '@edx/frontend-platform/i18n';
import { Icon, SearchField } from '@edx/paragon';
import { Search as SearchIcon } from '@edx/paragon/icons';

import { DiscussionContext } from '../discussions/common/context';
import DiscussionContext from '../discussions/common/context';
import { setUsernameSearch } from '../discussions/learners/data';
import { setSearchQuery } from '../discussions/posts/data';
import postsMessages from '../discussions/posts/post-actions-bar/messages';
Expand Down
21 changes: 0 additions & 21 deletions src/components/icons/InsertLink.jsx

This file was deleted.

27 changes: 0 additions & 27 deletions src/components/icons/Issue.jsx

This file was deleted.

19 changes: 0 additions & 19 deletions src/components/icons/People.jsx

This file was deleted.

21 changes: 0 additions & 21 deletions src/components/icons/PushPin.jsx

This file was deleted.

27 changes: 0 additions & 27 deletions src/components/icons/Question.jsx

This file was deleted.

19 changes: 0 additions & 19 deletions src/components/icons/QuestionAnswer.jsx

This file was deleted.

19 changes: 0 additions & 19 deletions src/components/icons/QuestionAnswerOutline.jsx

This file was deleted.

19 changes: 0 additions & 19 deletions src/components/icons/StarFilled.jsx

This file was deleted.

19 changes: 0 additions & 19 deletions src/components/icons/StarOutline.jsx

This file was deleted.

19 changes: 0 additions & 19 deletions src/components/icons/ThumbUpFilled.jsx

This file was deleted.

Loading

0 comments on commit 60aa2b0

Please sign in to comment.