* chore: configure WDYR for react profiling * perf: reduced post content re-rendering * perf: post content view and it child optimization * perf: add memoization in post editor * perf: add memoization in postCommnetsView * perf: improved endorsed comment view rendering * perf: improved re-rendering in reply component * fix: uncomment questionType commentsView * fix: removed console errors in postContent area * perf: reduced postType and postId dependancy * perf: improved re-rendering in discussionHome * perf: improved re-rendering of postsList and its child components * perf: improved re-rendering of legacyTopic and learner sidebar * fix: postFilterBar filter was not updating * fix: resolve duplicate comment posts issue * fix: memory leaking issue in comments view * fix: duplicate topic posts in inContext sidebar * perf: add lazy loading * chore: remove WDYR configuration * fix: alert banner padding * chore: update package-lock file * fix: bind tour API call with buttons
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
import React, { useMemo } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { useIntl } from '@edx/frontend-platform/i18n';
|
|
|
|
import messages from '../messages';
|
|
import Topic, { topicShape } from './Topic';
|
|
|
|
const ArchivedBaseGroup = ({
|
|
archivedTopics,
|
|
showDivider,
|
|
}) => {
|
|
const intl = useIntl();
|
|
|
|
const renderArchivedTopics = useMemo(() => (
|
|
archivedTopics?.map((topic, index) => (
|
|
<Topic
|
|
key={topic.id}
|
|
topic={topic}
|
|
showDivider={(archivedTopics.length - 1) !== index}
|
|
/>
|
|
))
|
|
), [archivedTopics]);
|
|
|
|
return (
|
|
<>
|
|
{showDivider && (
|
|
<>
|
|
<div className="divider border-top border-light-500" />
|
|
<div className="divider pt-1 bg-light-300" />
|
|
</>
|
|
)}
|
|
<div
|
|
className="discussion-topic-group d-flex flex-column text-primary-500"
|
|
data-testid="archived-group"
|
|
>
|
|
<div className="pt-3 px-4 font-weight-bold">{intl.formatMessage(messages.archivedTopics)}</div>
|
|
{renderArchivedTopics}
|
|
</div>
|
|
</>
|
|
);
|
|
};
|
|
|
|
ArchivedBaseGroup.propTypes = {
|
|
archivedTopics: PropTypes.arrayOf(topicShape).isRequired,
|
|
showDivider: PropTypes.bool,
|
|
};
|
|
|
|
ArchivedBaseGroup.defaultProps = {
|
|
showDivider: false,
|
|
};
|
|
export default React.memo(ArchivedBaseGroup);
|