Compare commits
9 Commits
sundas/INF
...
sundas/INF
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c6a75e7d9 | ||
|
|
eb43b7139a | ||
|
|
5aa090950e | ||
|
|
fd37d3441c | ||
|
|
009417bb57 | ||
|
|
f13b34c6c7 | ||
|
|
1ba5b938c4 | ||
|
|
c1478dbb41 | ||
|
|
5cc5156b2b |
@@ -24,7 +24,7 @@ function HTMLLoader({
|
||||
|
||||
function typeset(code) {
|
||||
promise = promise.then(() => {
|
||||
if (typeof window?.MathJax !== 'undefined') {
|
||||
if (typeof window?.MathJax !== 'undefined' && typeof window?.MathJax.startup !== 'undefined') {
|
||||
window.MathJax.startup.defaultPageReady().then((window.MathJax?.typesetPromise(code())));
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -75,7 +75,7 @@ function ActionsDropdown({
|
||||
placement="bottom-end"
|
||||
>
|
||||
<div
|
||||
className="bg-white p-1 shadow d-flex flex-column"
|
||||
className="bg-white shadow d-flex flex-column"
|
||||
data-testid="actions-dropdown-modal-popup"
|
||||
>
|
||||
{actions.map(action => (
|
||||
@@ -91,9 +91,15 @@ function ActionsDropdown({
|
||||
close();
|
||||
handleActions(action.action);
|
||||
}}
|
||||
className="d-flex justify-content-start py-1.5 mr-4"
|
||||
className="d-flex justify-content-start actions-dropdown-item"
|
||||
>
|
||||
<Icon src={action.icon} className="mr-1" /> {intl.formatMessage(action.label)}
|
||||
<Icon
|
||||
src={action.icon}
|
||||
className="icon-size-24"
|
||||
/>
|
||||
<span className="font-weight-normal font-xl ml-2">
|
||||
{intl.formatMessage(action.label)}
|
||||
</span>
|
||||
</Dropdown.Item>
|
||||
</React.Fragment>
|
||||
))}
|
||||
|
||||
@@ -8,13 +8,14 @@ import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
import { Alert } from '@edx/paragon';
|
||||
import { Report } from '@edx/paragon/icons';
|
||||
|
||||
import { AvatarOutlineAndLabelColors } from '../../data/constants';
|
||||
import {
|
||||
selectModerationSettings, selectUserHasModerationPrivileges, selectUserIsGroupTa, selectUserIsStaff,
|
||||
} from '../data/selectors';
|
||||
import { commentShape } from '../post-comments/comments/comment/proptypes';
|
||||
import messages from '../post-comments/messages';
|
||||
import { postShape } from '../posts/post/proptypes';
|
||||
import AuthorLabel from './AuthorLabel';
|
||||
import AlertBar from './AlertBar';
|
||||
|
||||
function AlertBanner({
|
||||
intl,
|
||||
@@ -29,6 +30,8 @@ function AlertBanner({
|
||||
const canSeeLastEditOrClosedAlert = (userHasModerationPrivileges || userIsGroupTa
|
||||
|| userIsGlobalStaff || userIsContentAuthor
|
||||
);
|
||||
const editByLabelColor = AvatarOutlineAndLabelColors[content.editByLabel];
|
||||
const closedByLabelColor = AvatarOutlineAndLabelColors[content.closedByLabel];
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -40,40 +43,22 @@ function AlertBanner({
|
||||
{reasonCodesEnabled && canSeeLastEditOrClosedAlert && (
|
||||
<>
|
||||
{content.lastEdit?.reason && (
|
||||
<Alert variant="info" className="px-3 shadow-none mb-1 py-10px bg-light-200">
|
||||
<div className="d-flex align-items-center flex-wrap text-gray-700 font-style">
|
||||
{intl.formatMessage(messages.editedBy)}
|
||||
<span className="ml-1 mr-3">
|
||||
<AuthorLabel author={content.lastEdit.editorUsername} linkToProfile postOrComment />
|
||||
</span>
|
||||
<span
|
||||
className="mx-1.5 font-size-8 font-style text-light-700"
|
||||
style={{ lineHeight: '15px' }}
|
||||
>
|
||||
{intl.formatMessage(messages.fullStop)}
|
||||
</span>
|
||||
{intl.formatMessage(messages.reason)}: {content.lastEdit.reason}
|
||||
</div>
|
||||
</Alert>
|
||||
<AlertBar
|
||||
message={messages.editedBy}
|
||||
author={content.lastEdit.editorUsername}
|
||||
authorLabel={content.editByLabel}
|
||||
labelColor={editByLabelColor && `text-${editByLabelColor}`}
|
||||
reason={content.lastEdit.reason}
|
||||
/>
|
||||
)}
|
||||
{content.closed && (
|
||||
<Alert variant="info" className="px-3 shadow-none mb-1 py-10px bg-light-200">
|
||||
<div className="d-flex align-items-center flex-wrap text-gray-700 font-style">
|
||||
{intl.formatMessage(messages.closedBy)}
|
||||
<span className="ml-1 ">
|
||||
<AuthorLabel author={content.closedBy} linkToProfile postOrComment />
|
||||
</span>
|
||||
<span
|
||||
className="mx-1.5 font-size-8 font-style text-light-700"
|
||||
style={{ lineHeight: '15px' }}
|
||||
>
|
||||
{intl.formatMessage(messages.fullStop)}
|
||||
</span>
|
||||
|
||||
{content.closeReason && (`${intl.formatMessage(messages.reason)}: ${content.closeReason}`)}
|
||||
|
||||
</div>
|
||||
</Alert>
|
||||
<AlertBar
|
||||
message={messages.closedBy}
|
||||
author={content.closedBy}
|
||||
authorLabel={content.closedByLabel}
|
||||
labelColor={closedByLabelColor && `text-${closedByLabelColor}`}
|
||||
reason={content.closeReason}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
60
src/discussions/common/AlertBar.jsx
Normal file
60
src/discussions/common/AlertBar.jsx
Normal file
@@ -0,0 +1,60 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
import { Alert } from '@edx/paragon';
|
||||
|
||||
import messages from '../post-comments/messages';
|
||||
import AuthorLabel from './AuthorLabel';
|
||||
|
||||
function AlertBar({
|
||||
intl,
|
||||
message,
|
||||
author,
|
||||
authorLabel,
|
||||
labelColor,
|
||||
reason,
|
||||
}) {
|
||||
return (
|
||||
<Alert variant="info" className="px-3 shadow-none mb-1 py-10px bg-light-200">
|
||||
<div className="d-flex align-items-center flex-wrap text-gray-700 font-style">
|
||||
{intl.formatMessage(message)}
|
||||
<span className="ml-1">
|
||||
<AuthorLabel
|
||||
author={author}
|
||||
authorLabel={authorLabel}
|
||||
labelColor={labelColor}
|
||||
linkToProfile
|
||||
postOrComment
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
className="mr-1.5 font-size-8 font-style text-light-700"
|
||||
style={{ lineHeight: '15px' }}
|
||||
>
|
||||
{intl.formatMessage(messages.fullStop)}
|
||||
</span>
|
||||
{reason && (`${intl.formatMessage(messages.reason)}: ${reason}`)}
|
||||
</div>
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
|
||||
AlertBar.propTypes = {
|
||||
intl: intlShape.isRequired,
|
||||
message: PropTypes.string,
|
||||
author: PropTypes.string,
|
||||
authorLabel: PropTypes.string,
|
||||
labelColor: PropTypes.string,
|
||||
reason: PropTypes.string,
|
||||
};
|
||||
|
||||
AlertBar.defaultProps = {
|
||||
message: '',
|
||||
author: '',
|
||||
authorLabel: '',
|
||||
labelColor: '',
|
||||
reason: '',
|
||||
};
|
||||
|
||||
export default injectIntl(AlertBar);
|
||||
@@ -14,7 +14,3 @@ export const selectUsernameSearch = () => state => state.learners.usernameSearch
|
||||
export const selectLearnerSorting = () => state => state.learners.sortedBy;
|
||||
|
||||
export const selectLearnerNextPage = () => state => state.learners.nextPage;
|
||||
|
||||
export const selectLearnerAvatar = author => state => (
|
||||
state.learners.learnerProfiles[author]?.profileImage?.imageUrlLarge
|
||||
);
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
import React from 'react';
|
||||
|
||||
import { useSelector } from 'react-redux';
|
||||
|
||||
import { Avatar } from '@edx/paragon';
|
||||
|
||||
import { selectLearnerAvatar } from '../data/selectors';
|
||||
import { learnerShape } from './proptypes';
|
||||
|
||||
function LearnerAvatar({ learner }) {
|
||||
const learnerAvatar = useSelector(selectLearnerAvatar(learner.username));
|
||||
return (
|
||||
<div className="mr-3 mt-1">
|
||||
<Avatar
|
||||
size="sm"
|
||||
alt={learner.username}
|
||||
src={learnerAvatar}
|
||||
style={{
|
||||
height: '2rem',
|
||||
width: '2rem',
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { useSelector } from 'react-redux';
|
||||
|
||||
import { injectIntl } from '@edx/frontend-platform/i18n';
|
||||
import { Avatar } from '@edx/paragon';
|
||||
@@ -9,13 +8,11 @@ import { Avatar } from '@edx/paragon';
|
||||
import { AvatarOutlineAndLabelColors } from '../../../../data/constants';
|
||||
import { AuthorLabel } from '../../../common';
|
||||
import { useAlertBannerVisible } from '../../../data/hooks';
|
||||
import { selectAuthorAvatars } from '../../../posts/data/selectors';
|
||||
import { commentShape } from './proptypes';
|
||||
|
||||
function CommentHeader({
|
||||
comment,
|
||||
}) {
|
||||
const authorAvatars = useSelector(selectAuthorAvatars(comment.author));
|
||||
const colorClass = AvatarOutlineAndLabelColors[comment.authorLabel];
|
||||
const hasAnyAlert = useAlertBannerVisible(comment);
|
||||
|
||||
@@ -28,7 +25,6 @@ function CommentHeader({
|
||||
<Avatar
|
||||
className={`border-0 ml-0.5 mr-2.5 ${colorClass ? `outline-${colorClass}` : 'outline-anonymous'}`}
|
||||
alt={comment.author}
|
||||
src={authorAvatars?.imageUrlSmall}
|
||||
style={{
|
||||
width: '32px',
|
||||
height: '32px',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import * as timeago from 'timeago.js';
|
||||
|
||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
} from '../../../common';
|
||||
import timeLocale from '../../../common/time-locale';
|
||||
import { useAlertBannerVisible } from '../../../data/hooks';
|
||||
import { selectAuthorAvatars } from '../../../posts/data/selectors';
|
||||
import { editComment, removeComment } from '../../data/thunks';
|
||||
import messages from '../../messages';
|
||||
import CommentEditor from './CommentEditor';
|
||||
@@ -60,7 +59,6 @@ function Reply({
|
||||
[ContentActions.REPORT]: () => handleAbusedFlag(),
|
||||
}), [dispatch, handleAbusedFlag, reply.endorsed, reply.id, showDeleteConfirmation]);
|
||||
|
||||
const authorAvatars = useSelector(selectAuthorAvatars(reply.author));
|
||||
const colorClass = AvatarOutlineAndLabelColors[reply.authorLabel];
|
||||
const hasAnyAlert = useAlertBannerVisible(reply);
|
||||
|
||||
@@ -101,7 +99,6 @@ function Reply({
|
||||
<Avatar
|
||||
className={`ml-0.5 mt-0.5 border-0 ${colorClass ? `outline-${colorClass}` : 'outline-anonymous'}`}
|
||||
alt={reply.author}
|
||||
src={authorAvatars?.imageUrlSmall}
|
||||
style={{
|
||||
width: '32px',
|
||||
height: '32px',
|
||||
|
||||
@@ -44,7 +44,3 @@ export const selectThreadSorting = () => state => state.threads.sortedBy;
|
||||
export const selectThreadFilters = () => state => state.threads.filters;
|
||||
|
||||
export const selectThreadNextPage = () => state => state.threads.nextPage;
|
||||
|
||||
export const selectAuthorAvatars = author => state => (
|
||||
state.threads.avatars?.[author]?.profile.image
|
||||
);
|
||||
|
||||
@@ -2,7 +2,6 @@ import React, { useMemo } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { useSelector } from 'react-redux';
|
||||
|
||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
import { Avatar, Badge, Icon } from '@edx/paragon';
|
||||
@@ -11,14 +10,12 @@ import { Issue, Question } from '../../../components/icons';
|
||||
import { AvatarOutlineAndLabelColors, ThreadType } from '../../../data/constants';
|
||||
import { AuthorLabel } from '../../common';
|
||||
import { useAlertBannerVisible } from '../../data/hooks';
|
||||
import { selectAuthorAvatars } from '../data/selectors';
|
||||
import messages from './messages';
|
||||
import { postShape } from './proptypes';
|
||||
|
||||
export function PostAvatar({
|
||||
post, authorLabel, fromPostLink, read,
|
||||
}) {
|
||||
const authorAvatars = useSelector(selectAuthorAvatars(post.author));
|
||||
const outlineColor = AvatarOutlineAndLabelColors[authorLabel];
|
||||
|
||||
const avatarSize = useMemo(() => {
|
||||
@@ -63,7 +60,6 @@ export function PostAvatar({
|
||||
width: avatarSize,
|
||||
}}
|
||||
alt={post.author}
|
||||
src={authorAvatars?.imageUrlSmall}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -502,3 +502,23 @@ header {
|
||||
padding-left: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-size-24 {
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
}
|
||||
|
||||
.actions-dropdown-item {
|
||||
padding: 12px 16px;
|
||||
height: 48px;
|
||||
width: 304px;
|
||||
}
|
||||
|
||||
.font-xl {
|
||||
font-size: 18px;
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
.usabilla_live_button_container{
|
||||
right: 0px !important;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user