|
| 1 | +import { Helmet } from 'react-helmet'; |
| 2 | +import { FormattedMessage, useIntl } from 'react-intl'; |
| 3 | +import { useParams } from 'react-router'; |
| 4 | + |
| 5 | +import Header from '@src/header'; |
| 6 | +import { useCourseDetails } from '@src/course-outline/data/apiHooks'; |
| 7 | +import SubHeader from '@src/generic/sub-header/SubHeader'; |
| 8 | + |
| 9 | +import Loading from '@src/generic/Loading'; |
| 10 | +import { Stack } from '@openedx/paragon'; |
| 11 | +import messages from './messages'; |
| 12 | +import { SummaryCard } from './SummaryCard'; |
| 13 | + |
| 14 | +export const ImportDetails = () => { |
| 15 | + const intl = useIntl(); |
| 16 | + |
| 17 | + const { courseId } = useParams(); |
| 18 | + const { data, isPending } = useCourseDetails(courseId); |
| 19 | + |
| 20 | + const isSuccess = false; |
| 21 | + |
| 22 | + const renderBody = () => ( |
| 23 | + isSuccess ? ( |
| 24 | + <Stack gap={2}> |
| 25 | + <h4><FormattedMessage {...messages.importSuccessfulTitle} /></h4> |
| 26 | + <p> |
| 27 | + <FormattedMessage |
| 28 | + {...messages.importSuccessfulBody} |
| 29 | + values={{ |
| 30 | + courseName: data?.title, |
| 31 | + }} |
| 32 | + /> |
| 33 | + </p> |
| 34 | + <h4><FormattedMessage {...messages.importSummaryTitle} /></h4> |
| 35 | + <SummaryCard /> |
| 36 | + </Stack> |
| 37 | + ) : ( |
| 38 | + <Stack gap={2}> |
| 39 | + <h4><FormattedMessage {...messages.importFailedTitle} /></h4> |
| 40 | + <p> |
| 41 | + <FormattedMessage |
| 42 | + {...messages.importFailedBody} |
| 43 | + values={{ |
| 44 | + courseName: data?.title, |
| 45 | + }} |
| 46 | + /> |
| 47 | + </p> |
| 48 | + <p> |
| 49 | + Reason |
| 50 | + </p> |
| 51 | + </Stack> |
| 52 | + ) |
| 53 | + ); |
| 54 | + |
| 55 | + return ( |
| 56 | + <> |
| 57 | + <Helmet> |
| 58 | + <title> |
| 59 | + {intl.formatMessage(messages.importDetailsTitle)} |
| 60 | + </title> |
| 61 | + </Helmet> |
| 62 | + <Header isHiddenMainMenu /> |
| 63 | + <div> |
| 64 | + <SubHeader |
| 65 | + title={intl.formatMessage(messages.importDetailsTitle)} |
| 66 | + /> |
| 67 | + {false ? ( |
| 68 | + <Loading /> |
| 69 | + ) : renderBody()} |
| 70 | + </div> |
| 71 | + </> |
| 72 | + ); |
| 73 | +}; |
0 commit comments