Skip to content

Commit 1c7ad2f

Browse files
authored
feat: Migrate Legacy Libraries Flow [FC-0097] (#2425)
- Creates all steps of the flow described in #2201
1 parent 7ba3db0 commit 1c7ad2f

25 files changed

Lines changed: 1349 additions & 192 deletions

src/generic/unlink-modal/UnlinkModal.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ import {
55
} from '@openedx/paragon';
66
import { Warning } from '@openedx/paragon/icons';
77
import { useIntl } from '@edx/frontend-platform/i18n';
8+
import { BoldText } from '@src/utils';
89

910
import messages from './messages';
1011
import LoadingButton from '../loading-button';
1112

12-
const BoldText = (chunk: string[]) => <b>{chunk}</b>;
13-
1413
type UnlinkModalPropsContainer = {
1514
displayName?: string;
1615
category?: string;

src/index.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { ContentType } from './library-authoring/routes';
3535

3636
import 'react-datepicker/dist/react-datepicker.css';
3737
import './index.scss';
38+
import { LegacyLibMigrationPage } from './legacy-libraries-migration/LegacyLibMigrationPage';
3839

3940
const queryClient = new QueryClient({
4041
defaultOptions: {
@@ -65,6 +66,7 @@ const App = () => {
6566
<Route path="/home" element={<StudioHome />} />
6667
<Route path="/libraries" element={<StudioHome />} />
6768
<Route path="/libraries-v1" element={<StudioHome />} />
69+
<Route path="/libraries-v1/migrate" element={<LegacyLibMigrationPage />} />
6870
<Route path="/library/create" element={<CreateLibrary />} />
6971
<Route path="/library/:libraryId/*" element={<LibraryLayout />} />
7072
<Route

src/index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
@import "certificates/scss/Certificates";
3131
@import "group-configurations/GroupConfigurations";
3232
@import "optimizer-page/scan-results/ScanResults";
33+
@import "legacy-libraries-migration/";
3334

3435
// To apply the glow effect to the selected Section/Subsection, in the Course Outline
3536
div.row:has(> div > div.highlight) {
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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

Comments
 (0)