Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paragon StatusAlert deprecation #562

Merged
merged 17 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
f4fa6be
refactor: updated StatusAlert to Alert in SearchError component
abdullahwaheed Jun 21, 2022
b6287d0
refactor: updated StatusAlert to Alert in SearchNoResults component
abdullahwaheed Jun 21, 2022
206ba7a
refactor: updated StatusAlert to Alert in SearchCourseCard component
abdullahwaheed Jun 21, 2022
da3d602
refactor: updated StatusAlert to Alert in SearchProgramCard component
abdullahwaheed Jun 21, 2022
799c024
refactor: updated StatusAlert to Alert in SkillsCourse component
abdullahwaheed Jun 21, 2022
1cc05d9
refactor: upgraded paragon version to include required icons
abdullahwaheed Jul 26, 2022
2584f3e
fix: fixed custom styling and icon issues as suggested in the review
abdullahwaheed Jul 26, 2022
f9429ef
Merge branch 'master' of github.com:openedx/frontend-app-learner-port…
abdullahwaheed Jul 26, 2022
e71023a
refactor: reverted paragon version as it was breaking other code and …
abdullahwaheed Jul 27, 2022
c24084c
refactor: updated paragon, used paragon icon in place of font awesome
abdullahwaheed Sep 20, 2022
ccaf7f0
Merge branch 'master' of github.com:openedx/frontend-app-learner-port…
abdullahwaheed Sep 20, 2022
719ea48
Merge branch 'master' of github.com:openedx/frontend-app-learner-port…
abdullahwaheed Sep 23, 2022
ccd4c59
Merge branch 'master' of github.com:openedx/frontend-app-learner-port…
abdullahwaheed Nov 22, 2022
8c09495
Merge branch 'master' of github.com:openedx/frontend-app-learner-port…
abdullahwaheed Jan 6, 2023
82ced2e
Merge branch 'master' into abdullahwaheed/pagaron-status-alert-deprec…
abdullahwaheed Jan 13, 2023
b15c201
Merge branch 'master' into abdullahwaheed/pagaron-status-alert-deprec…
adamstankiewicz Jan 30, 2023
f67e0df
Merge branch 'master' into abdullahwaheed/pagaron-status-alert-deprec…
abdullahwaheed Jan 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 12 additions & 24 deletions src/components/search/SearchError.jsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,24 @@
import React, { useCallback } from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import { StatusAlert } from '@edx/paragon';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { Alert } from '@edx/paragon';
import { Warning } from '@edx/paragon/icons';
import { getSearchErrorMessage } from '../utils/search';

const SearchError = ({ title }) => {
const searchErrorMessage = getSearchErrorMessage(title);
const renderDialog = useCallback(
() => (
<div className="lead d-flex align-items-center py-3">
<div className="mr-3">
<FontAwesomeIcon icon={faExclamationTriangle} size="2x" />
</div>
<div>
{searchErrorMessage.messageTitle}
<br />
{searchErrorMessage.messageContent}
</div>
</div>
),
[searchErrorMessage.messageContent, searchErrorMessage.messageTitle],
);

// TODO: Design Debt. Replace with `Alert` from @edx/paragon.
return (
<StatusAlert
alertType="danger"
dialog={renderDialog()}
<Alert
variant="danger"
dismissible={false}
icon={Warning}
open
/>
>
<Alert.Heading>
{searchErrorMessage.messageTitle}
</Alert.Heading>
{searchErrorMessage.messageContent}
</Alert>
);
};

Expand Down
36 changes: 11 additions & 25 deletions src/components/search/SearchNoResults.jsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,26 @@
import React, { useCallback } from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import { StatusAlert } from '@edx/paragon';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faSearchMinus } from '@fortawesome/free-solid-svg-icons';
import { Alert } from '@edx/paragon';
import { ZoomOut } from '@edx/paragon/icons';

import { PopularResults } from './popular-results';
import { getNoResultsMessage } from '../utils/search';

const SearchNoResults = ({ title }) => {
const noResultsMessage = getNoResultsMessage(title);
const renderDialog = useCallback(
() => (
<div className="lead d-flex align-items-center py-3">
<div className="mr-3">
<FontAwesomeIcon icon={faSearchMinus} size="2x" />
</div>
<div>
{noResultsMessage.messageTitle}
<br />
{noResultsMessage.messageContent}
</div>
</div>
),
[noResultsMessage.messageContent, noResultsMessage.messageTitle],
);

// TODO: Design Debt. Replace with `Alert` from @edx/paragon.
return (
<>
<StatusAlert
<Alert
className="mb-5"
alertType="info"
dialog={renderDialog()}
variant="info"
dismissible={false}
open
/>
icon={ZoomOut}
show
>
<Alert.Heading>{noResultsMessage.messageTitle}</Alert.Heading>
{noResultsMessage.messageContent}
</Alert>
<PopularResults title={title} />
</>
);
Expand Down
28 changes: 9 additions & 19 deletions src/components/skills-quiz/SearchCourseCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import PropTypes from 'prop-types';
import { v4 as uuidv4 } from 'uuid';
import { AppContext } from '@edx/frontend-platform/react';
import { SearchContext } from '@edx/frontend-enterprise-catalog-search';
import { StatusAlert, CardGrid } from '@edx/paragon';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faSearchMinus } from '@fortawesome/free-solid-svg-icons';
import { Alert, CardGrid } from '@edx/paragon';
import { ZoomOut } from '@edx/paragon/icons';
import { camelCaseObject } from '@edx/frontend-platform/utils';
import { SkillsContext } from './SkillsContextProvider';

Expand All @@ -18,17 +17,6 @@ import { UserSubsidyContext } from '../enterprise-user-subsidy';
import CourseCard from './CourseCard';
import { SubsidyRequestsContext } from '../enterprise-subsidy-requests';

const renderDialog = () => (
<div className="lead d-flex align-items-center py-3">
<div className="mr-3">
<FontAwesomeIcon icon={faSearchMinus} size="2x" />
</div>
<p>
{ NO_COURSES_ALERT_MESSAGE }
</p>
</div>
);

const SearchCourseCard = ({ index }) => {
const { enterpriseConfig } = useContext(AppContext);
const {
Expand Down Expand Up @@ -99,13 +87,15 @@ const SearchCourseCard = ({ index }) => {

if (hitCount === 0) {
return (
<StatusAlert
<Alert
className="mt-4 mb-5"
alertType="info"
dialog={renderDialog()}
variant="info"
dismissible={false}
open
/>
icon={ZoomOut}
show
>
{ NO_COURSES_ALERT_MESSAGE }
</Alert>
);
}

Expand Down
29 changes: 9 additions & 20 deletions src/components/skills-quiz/SearchProgramCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ import { AppContext } from '@edx/frontend-platform/react';
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
import { camelCaseObject } from '@edx/frontend-platform/utils';
import {
Badge, Card, Icon, StatusAlert, CardGrid, Stack,
Badge, Card, Icon, Alert, CardGrid, Stack,
} from '@edx/paragon';
import { Program } from '@edx/paragon/icons';
import { Program, ZoomOut } from '@edx/paragon/icons';
import { sendEnterpriseTrackEvent } from '@edx/frontend-enterprise-utils';
import { SearchContext } from '@edx/frontend-enterprise-catalog-search';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faSearchMinus } from '@fortawesome/free-solid-svg-icons';
import { SkillsContext } from './SkillsContextProvider';
import { isDefinedAndNotNull, getPrimaryPartnerLogo } from '../../utils/common';
import { ELLIPSIS_STR } from '../course/data/constants';
Expand All @@ -35,17 +33,6 @@ const linkToProgram = (program, slug, enterpriseUUID, programUuid) => {
return `/${slug}/program/${programUuid}`;
};

const renderDialog = () => (
<div className="lead d-flex align-items-center py-3">
<div className="mr-3">
<FontAwesomeIcon icon={faSearchMinus} size="2x" />
</div>
<p>
{ NO_PROGRAMS_ALERT_MESSAGE }
</p>
</div>
);

const SearchProgramCard = ({ index }) => {
const history = useHistory();
const { enterpriseConfig } = useContext(AppContext);
Expand Down Expand Up @@ -174,13 +161,15 @@ const SearchProgramCard = ({ index }) => {

if (hitCount === 0) {
return (
<StatusAlert
<Alert
className="mt-4 mb-5"
alertType="info"
dialog={renderDialog()}
variant="info"
dismissible={false}
open
/>
icon={ZoomOut}
show
>
{ NO_PROGRAMS_ALERT_MESSAGE }
</Alert>
);
}

Expand Down
30 changes: 10 additions & 20 deletions src/components/skills-quiz/SkillsCourses.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, {
import {
Button,
Badge,
StatusAlert,
Alert,
Skeleton,
CardGrid,
} from '@edx/paragon';
Expand All @@ -15,8 +15,7 @@ import { v4 as uuidv4 } from 'uuid';
import { Link } from 'react-router-dom';
import { AppContext } from '@edx/frontend-platform/react';
import { camelCaseObject } from '@edx/frontend-platform/utils';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faSearchMinus } from '@fortawesome/free-solid-svg-icons';
import { ZoomOut } from '@edx/paragon/icons';
import PropTypes from 'prop-types';

import { useSelectedSkillsAndJobSkills } from './data/hooks';
Expand All @@ -31,17 +30,6 @@ import CardLoadingSkeleton from './CardLoadingSkeleton';
import CourseCard from './CourseCard';
import { SubsidyRequestsContext } from '../enterprise-subsidy-requests';

const renderDialog = () => (
<div className="lead d-flex align-items-center py-3">
<div className="mr-3">
<FontAwesomeIcon icon={faSearchMinus} size="2x" />
</div>
<p>
{ NO_COURSES_ALERT_MESSAGE_AGAINST_SKILLS }
</p>
</div>
);

const SkillsCourses = ({ index }) => {
const { enterpriseConfig } = useContext(AppContext);
const { state: { selectedJob } } = useContext(SkillsContext);
Expand Down Expand Up @@ -169,14 +157,16 @@ const SkillsCourses = ({ index }) => {
</React.Fragment>
))}
<div>
{hitCount === 0 && (
<StatusAlert
{ hitCount === 0 && (
<Alert
className="mt-4 mb-5"
alertType="info"
dialog={renderDialog()}
variant="info"
dismissible={false}
open
/>
icon={ZoomOut}
show
>
{ NO_COURSES_ALERT_MESSAGE_AGAINST_SKILLS }
</Alert>
)}
</div>
</div>
Expand Down