|
| 1 | +import { FormattedMessage } from '@edx/frontend-platform/i18n'; |
| 2 | +import { |
| 3 | + Alert, |
| 4 | + Card, |
| 5 | + Container, |
| 6 | + Icon, |
| 7 | + Stack, |
| 8 | +} from '@openedx/paragon'; |
| 9 | +import { |
| 10 | + AccessTime, |
| 11 | + Folder, |
| 12 | + SubdirectoryArrowRight, |
| 13 | +} from '@openedx/paragon/icons'; |
| 14 | + |
| 15 | +import type { ContentLibrary } from '@src/library-authoring/data/api'; |
| 16 | +import { LibraryV1Data } from '@src/studio-home/data/api'; |
| 17 | +import { BoldText } from '@src/utils'; |
| 18 | + |
| 19 | +import messages from './messages'; |
| 20 | + |
| 21 | +interface ConfirmationCardProps { |
| 22 | + legacyLib: LibraryV1Data; |
| 23 | + destinationName: string; |
| 24 | +} |
| 25 | + |
| 26 | +const ConfirmationCard = ({ |
| 27 | + legacyLib, |
| 28 | + destinationName, |
| 29 | +}: ConfirmationCardProps) => ( |
| 30 | + <Card className="mb-3.5"> |
| 31 | + <Card.Header |
| 32 | + title={( |
| 33 | + <Stack className="h4" direction="horizontal"> |
| 34 | + <Icon className="mr-1" src={Folder} /> |
| 35 | + <span>{legacyLib.displayName}</span> |
| 36 | + </Stack> |
| 37 | + )} |
| 38 | + subtitle={( |
| 39 | + <Stack className="mb-1.5" direction="horizontal"> |
| 40 | + <Icon className="mr-1.5" src={SubdirectoryArrowRight} /> |
| 41 | + <span>{destinationName}</span> |
| 42 | + </Stack> |
| 43 | + )} |
| 44 | + /> |
| 45 | + {legacyLib.isMigrated && ( |
| 46 | + <Stack className="ml-3.5 mt-1 mb-2 text-gray-500" direction="horizontal"> |
| 47 | + <Icon className="mr-1.5" src={AccessTime} /> |
| 48 | + <span className="x-small"> |
| 49 | + <FormattedMessage |
| 50 | + {...messages.previouslyMigratedAlert} |
| 51 | + values={{ |
| 52 | + libraryName: legacyLib.migratedToTitle, |
| 53 | + b: BoldText, |
| 54 | + }} |
| 55 | + /> |
| 56 | + </span> |
| 57 | + </Stack> |
| 58 | + )} |
| 59 | + </Card> |
| 60 | +); |
| 61 | + |
| 62 | +interface ConfirmationViewProps { |
| 63 | + destination: ContentLibrary; |
| 64 | + legacyLibraries: LibraryV1Data[]; |
| 65 | +} |
| 66 | + |
| 67 | +export const ConfirmationView = ({ |
| 68 | + destination, |
| 69 | + legacyLibraries, |
| 70 | +}: ConfirmationViewProps) => ( |
| 71 | + <Container className="confirmation-view"> |
| 72 | + <Alert variant="info"> |
| 73 | + <FormattedMessage |
| 74 | + {...messages.confirmationViewAlert} |
| 75 | + values={{ |
| 76 | + count: legacyLibraries.length, |
| 77 | + libraryName: destination.title, |
| 78 | + b: BoldText, |
| 79 | + }} |
| 80 | + /> |
| 81 | + </Alert> |
| 82 | + {legacyLibraries.map((legacyLib) => ( |
| 83 | + <ConfirmationCard |
| 84 | + legacyLib={legacyLib} |
| 85 | + destinationName={destination.title} |
| 86 | + /> |
| 87 | + ))} |
| 88 | + </Container> |
| 89 | +); |
0 commit comments