@opencraft/frontend-plugin-sandbox 1.1.0 → 1.2.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-package-for-pr.yaml +3 -3
- package/.nvmrc +1 -1
- package/README.md +7 -21
- package/dist/components/CatalogBanner.js +12 -12
- package/dist/components/CatalogBanner.js.map +1 -1
- package/dist/components/DropDownToggler.js.map +1 -1
- package/dist/components/MenuWrapper.js +1 -1
- package/dist/components/MenuWrapper.js.map +1 -1
- package/dist/index.js +3 -14
- package/dist/index.js.map +1 -1
- package/dist/types.d.js +1 -1
- package/dist/types.d.js.map +1 -1
- package/package.json +42 -42
- package/src/components/CatalogBanner.tsx +42 -42
- package/src/components/DropDownToggler.tsx +2 -3
- package/src/components/MenuWrapper.tsx +2 -3
- package/src/index.ts +4 -17
- package/src/types.d.ts +1 -10
- package/tsconfig.json +18 -8
- package/src/components/WhiteLogo.tsx +0 -16
|
@@ -35,7 +35,7 @@ jobs:
|
|
|
35
35
|
message: |
|
|
36
36
|
You can install this into an MFE using:
|
|
37
37
|
```bash
|
|
38
|
-
RUN --mount=type=cache,target=/root/.npm,sharing=shared npm install 'https://github.com/open-craft/frontend-plugin-sandbox
|
|
38
|
+
RUN --mount=type=cache,target=/root/.npm,sharing=shared npm install 'https://github.com/open-craft/frontend-plugin-sandbox/archive/refs/heads/${{ github.head_ref }}.tar.gz'
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
You can test this on a local tutor environment using the following plugin code:
|
|
@@ -45,8 +45,8 @@ jobs:
|
|
|
45
45
|
f"mfe-dockerfile-post-npm-install-MFE_NAME",
|
|
46
46
|
"""
|
|
47
47
|
RUN --mount=type=cache,target=/root/.npm,sharing=shared npm install '@edx/frontend-component-header@latest'
|
|
48
|
-
ADD https://api.github.com/repos/open-craft/frontend-plugin-sandbox
|
|
49
|
-
RUN --mount=type=cache,target=/root/.npm,sharing=shared npm install 'https://github.com/open-craft/frontend-plugin-sandbox
|
|
48
|
+
ADD https://api.github.com/repos/open-craft/frontend-plugin-sandbox/git/refs/heads/${{ github.head_ref }} /tmp/gitref
|
|
49
|
+
RUN --mount=type=cache,target=/root/.npm,sharing=shared npm install 'https://github.com/open-craft/frontend-plugin-sandbox/archive/refs/heads/${{ github.head_ref }}.tar.gz'
|
|
50
50
|
""",
|
|
51
51
|
)
|
|
52
52
|
)
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
24
|
package/README.md
CHANGED
|
@@ -9,13 +9,13 @@ This repo contains plug-in code for OpenCraft's sandboxes.
|
|
|
9
9
|
The package can be installed from npm using:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm install @opencraft/frontend-plugin-sandbox
|
|
12
|
+
npm install @opencraft/frontend-plugin-sandbox
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Or to install from GitHub directly:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
npm install 'git+https://github.com/open-craft/frontend-plugin-sandbox
|
|
18
|
+
npm install 'git+https://github.com/open-craft/frontend-plugin-sandbox.git#branch_tag_or_commit'
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
@@ -24,7 +24,7 @@ This project exposes all slots and their configuration to simplify testing. You
|
|
|
24
24
|
can add the following to your `env.config.tsx` file to enable all the slots.
|
|
25
25
|
|
|
26
26
|
```jsx
|
|
27
|
-
import { slotSettings } from "@opencraft/frontend-plugin-sandbox
|
|
27
|
+
import { slotSettings } from "@opencraft/frontend-plugin-sandbox";
|
|
28
28
|
|
|
29
29
|
const config = {
|
|
30
30
|
pluginSlots: slotSettings,
|
|
@@ -47,7 +47,7 @@ for mfe_app in ["account", "discussions", "learner-dashboard", "learning", "prof
|
|
|
47
47
|
f"mfe-dockerfile-post-npm-install-{mfe_app}",
|
|
48
48
|
"""
|
|
49
49
|
RUN --mount=type=cache,target=/root/.npm,sharing=shared npm install '@edx/frontend-component-header@latest'
|
|
50
|
-
RUN --mount=type=cache,target=/root/.npm,sharing=shared npm install '@opencraft/frontend-plugin-sandbox
|
|
50
|
+
RUN --mount=type=cache,target=/root/.npm,sharing=shared npm install '@opencraft/frontend-plugin-sandbox'
|
|
51
51
|
""",
|
|
52
52
|
)
|
|
53
53
|
)
|
|
@@ -55,9 +55,9 @@ for mfe_app in ["account", "discussions", "learner-dashboard", "learning", "prof
|
|
|
55
55
|
(
|
|
56
56
|
f"mfe-env-config-runtime-definitions-{mfe_app}",
|
|
57
57
|
"""
|
|
58
|
-
const {
|
|
58
|
+
const { MenuWrapper, SandboxFooter } = await import(
|
|
59
59
|
/* webpackFetchPriority: "eager" */
|
|
60
|
-
'@opencraft/frontend-plugin-sandbox
|
|
60
|
+
'@opencraft/frontend-plugin-sandbox'
|
|
61
61
|
);
|
|
62
62
|
""",
|
|
63
63
|
)
|
|
@@ -87,20 +87,6 @@ for mfe_app in ["account", "discussions", "learner-dashboard", "learning", "prof
|
|
|
87
87
|
},
|
|
88
88
|
}""",
|
|
89
89
|
),
|
|
90
|
-
(
|
|
91
|
-
mfe_app,
|
|
92
|
-
"org.openedx.frontend.layout.header_logo.v1",
|
|
93
|
-
"""
|
|
94
|
-
{
|
|
95
|
-
op: PLUGIN_OPERATIONS.Insert,
|
|
96
|
-
widget: {
|
|
97
|
-
id: 'custom_logo',
|
|
98
|
-
type: DIRECT_PLUGIN,
|
|
99
|
-
RenderWidget: WhiteLogo,
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
}""",
|
|
103
|
-
),
|
|
104
90
|
(
|
|
105
91
|
mfe_app,
|
|
106
92
|
"org.openedx.frontend.layout.header_desktop_user_menu.v1",
|
|
@@ -129,7 +115,7 @@ hooks.Filters.ENV_PATCHES.add_item(
|
|
|
129
115
|
(
|
|
130
116
|
f"mfe-env-config-runtime-definitions-catalog",
|
|
131
117
|
"""
|
|
132
|
-
const { CatalogBanner } = await import('@opencraft/frontend-plugin-sandbox
|
|
118
|
+
const { CatalogBanner } = await import('@opencraft/frontend-plugin-sandbox');
|
|
133
119
|
""",
|
|
134
120
|
)
|
|
135
121
|
)
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Image, Row, Stack } from
|
|
3
|
-
import bannerBg from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Image, Row, Stack } from '@openedx/paragon';
|
|
3
|
+
import bannerBg from '../assets/banner-bg.png';
|
|
4
4
|
export const CatalogBanner = () => /*#__PURE__*/React.createElement(Row, {
|
|
5
5
|
direction: "horizontal",
|
|
6
6
|
className: "bg-primary"
|
|
7
7
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
8
|
-
|
|
8
|
+
direction: "vertical",
|
|
9
9
|
className: "justify-content-center px-6",
|
|
10
10
|
style: {
|
|
11
|
-
maxWidth:
|
|
11
|
+
maxWidth: '55rem'
|
|
12
12
|
}
|
|
13
13
|
}, /*#__PURE__*/React.createElement("h1", {
|
|
14
14
|
className: "display-2 text-light-100"
|
|
15
15
|
}, "You\u2019re viewing a live", /*#__PURE__*/React.createElement("span", {
|
|
16
16
|
className: "text-brand-500"
|
|
17
|
-
},
|
|
17
|
+
}, ' Open edX® '), "demo"), /*#__PURE__*/React.createElement("p", {
|
|
18
18
|
className: "h4 text-light-100 "
|
|
19
19
|
}, "OpenClass is a demo site by OpenCraft where you can explore the Open edX platform as a learner or course author.")), /*#__PURE__*/React.createElement(Stack, {
|
|
20
20
|
className: "justify-content-end",
|
|
21
21
|
style: {
|
|
22
|
-
|
|
22
|
+
backgroundImage: 'url(../assets/banner-bg.png)'
|
|
23
23
|
}
|
|
24
24
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
25
25
|
src: bannerBg,
|
|
26
26
|
style: {
|
|
27
|
-
height:
|
|
28
|
-
width:
|
|
29
|
-
maxHeight:
|
|
30
|
-
objectFit:
|
|
31
|
-
objectPosition:
|
|
27
|
+
height: '100%',
|
|
28
|
+
width: '100%',
|
|
29
|
+
maxHeight: '550px',
|
|
30
|
+
objectFit: 'contain',
|
|
31
|
+
objectPosition: 'right top'
|
|
32
32
|
},
|
|
33
33
|
alt: "illustration of a workspace with a computer screen displaying charts and graphs, accompanied by a desk lamp, coffee cup, and potted plant"
|
|
34
34
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CatalogBanner.js","names":["React","Image","Row","Stack","bannerBg","CatalogBanner","createElement","direction","className","
|
|
1
|
+
{"version":3,"file":"CatalogBanner.js","names":["React","Image","Row","Stack","bannerBg","CatalogBanner","createElement","direction","className","style","maxWidth","backgroundImage","src","height","width","maxHeight","objectFit","objectPosition","alt"],"sources":["../../src/components/CatalogBanner.tsx"],"sourcesContent":["import React from 'react';\nimport { Image, Row, Stack } from '@openedx/paragon';\nimport bannerBg from '../assets/banner-bg.png';\n\nexport const CatalogBanner = () => (\n <Row\n direction=\"horizontal\"\n className=\"bg-primary\"\n >\n <Stack\n direction=\"vertical\"\n className=\"justify-content-center px-6\"\n style={{ maxWidth: '55rem' }}\n >\n <h1 className=\"display-2 text-light-100\">\n You’re viewing a live\n <span className=\"text-brand-500\">\n {' Open edX® '}\n </span>\n demo\n </h1>\n <p className=\"h4 text-light-100 \">\n OpenClass is a demo site by OpenCraft where you can explore the\n Open edX platform as a learner or course author.\n </p>\n </Stack>\n <Stack\n className=\"justify-content-end\"\n style={{\n backgroundImage: 'url(../assets/banner-bg.png)',\n }}\n >\n <Image\n src={bannerBg}\n style={{\n height: '100%',\n width: '100%',\n maxHeight: '550px',\n objectFit: 'contain',\n objectPosition: 'right top',\n }}\n alt=\"illustration of a workspace with a computer screen displaying charts and graphs, accompanied by a desk lamp, coffee cup, and potted plant\"\n />\n </Stack>\n </Row>\n);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,EAAEC,GAAG,EAAEC,KAAK,QAAQ,kBAAkB;AACpD,OAAOC,QAAQ,MAAM,yBAAyB;AAE9C,OAAO,MAAMC,aAAa,GAAGA,CAAA,kBAC3BL,KAAA,CAAAM,aAAA,CAACJ,GAAG;EACFK,SAAS,EAAC,YAAY;EACtBC,SAAS,EAAC;AAAY,gBAEtBR,KAAA,CAAAM,aAAA,CAACH,KAAK;EACJI,SAAS,EAAC,UAAU;EACpBC,SAAS,EAAC,6BAA6B;EACvCC,KAAK,EAAE;IAAEC,QAAQ,EAAE;EAAQ;AAAE,gBAE7BV,KAAA,CAAAM,aAAA;EAAIE,SAAS,EAAC;AAA0B,GAAC,4BAEvC,eAAAR,KAAA,CAAAM,aAAA;EAAME,SAAS,EAAC;AAAgB,GAC7B,aACG,CAAC,QAEL,CAAC,eACLR,KAAA,CAAAM,aAAA;EAAGE,SAAS,EAAC;AAAoB,GAAC,kHAG/B,CACE,CAAC,eACRR,KAAA,CAAAM,aAAA,CAACH,KAAK;EACJK,SAAS,EAAC,qBAAqB;EAC/BC,KAAK,EAAE;IACLE,eAAe,EAAE;EACnB;AAAE,gBAEFX,KAAA,CAAAM,aAAA,CAACL,KAAK;EACJW,GAAG,EAAER,QAAS;EACdK,KAAK,EAAE;IACLI,MAAM,EAAE,MAAM;IACdC,KAAK,EAAE,MAAM;IACbC,SAAS,EAAE,OAAO;IAClBC,SAAS,EAAE,SAAS;IACpBC,cAAc,EAAE;EAClB,CAAE;EACFC,GAAG,EAAC;AAA2I,CAChJ,CACI,CACJ,CACN","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropDownToggler.js","names":["React","useContext","Avatar","DesktopUserMenuTogglePropTypes","AppContext","DropDownToggler","avatar","authenticatedUser","createElement","size","src","alt","username","propTypes"],"sources":["../../src/components/DropDownToggler.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport Avatar from '@edx/frontend-component-header/dist/Avatar';\nimport { DesktopUserMenuTogglePropTypes } from '@edx/frontend-component-header/dist/desktop-header/DesktopUserMenuToggle';\nimport { AppContext } from '@edx/frontend-platform/react';\
|
|
1
|
+
{"version":3,"file":"DropDownToggler.js","names":["React","useContext","Avatar","DesktopUserMenuTogglePropTypes","AppContext","DropDownToggler","avatar","authenticatedUser","createElement","size","src","alt","username","propTypes"],"sources":["../../src/components/DropDownToggler.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport Avatar from '@edx/frontend-component-header/dist/Avatar';\nimport { DesktopUserMenuTogglePropTypes } from '@edx/frontend-component-header/dist/desktop-header/DesktopUserMenuToggle';\nimport { AppContext } from '@edx/frontend-platform/react';\n\nexport const DropDownToggler = ({ avatar }) => {\n const { authenticatedUser } = useContext(AppContext);\n return (\n <Avatar size=\"1.5em\" src={avatar} alt={authenticatedUser.username} />\n );\n};\n\nDropDownToggler.propTypes = DesktopUserMenuTogglePropTypes;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,MAAM,MAAM,4CAA4C;AAC/D,SAASC,8BAA8B,QAAQ,0EAA0E;AACzH,SAASC,UAAU,QAAQ,8BAA8B;AAEzD,OAAO,MAAMC,eAAe,GAAGA,CAAC;EAAEC;AAAO,CAAC,KAAK;EAC7C,MAAM;IAAEC;EAAkB,CAAC,GAAGN,UAAU,CAACG,UAAU,CAAC;EACpD,oBACEJ,KAAA,CAAAQ,aAAA,CAACN,MAAM;IAACO,IAAI,EAAC,OAAO;IAACC,GAAG,EAAEJ,MAAO;IAACK,GAAG,EAAEJ,iBAAiB,CAACK;EAAS,CAAE,CAAC;AAEzE,CAAC;AAEDP,eAAe,CAACQ,SAAS,GAAGV,8BAA8B","ignoreList":[]}
|
|
@@ -17,7 +17,7 @@ export const MenuWrapper = ({
|
|
|
17
17
|
size: "1.5rem"
|
|
18
18
|
}), /*#__PURE__*/React.createElement("div", {
|
|
19
19
|
className: "pl-2 align-self-center"
|
|
20
|
-
}, authenticatedUser
|
|
20
|
+
}, authenticatedUser?.username || 'Account'))), /*#__PURE__*/React.createElement("div", {
|
|
21
21
|
className: "dropdown-divider"
|
|
22
22
|
}), component);
|
|
23
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuWrapper.js","names":["React","useContext","AppContext","Avatar","MenuWrapper","component","authenticatedUser","createElement","Fragment","className","role","size","username"],"sources":["../../src/components/MenuWrapper.tsx"],"sourcesContent":["import React, { ReactElement, useContext } from 'react';\nimport { AppContext } from '@edx/frontend-platform/react';\nimport Avatar from '@edx/frontend-component-header/dist/Avatar';\
|
|
1
|
+
{"version":3,"file":"MenuWrapper.js","names":["React","useContext","AppContext","Avatar","MenuWrapper","component","authenticatedUser","createElement","Fragment","className","role","size","username"],"sources":["../../src/components/MenuWrapper.tsx"],"sourcesContent":["import React, { ReactElement, useContext } from 'react';\nimport { AppContext } from '@edx/frontend-platform/react';\nimport Avatar from '@edx/frontend-component-header/dist/Avatar';\n\nexport const MenuWrapper = ({ component }: { component: ReactElement }) => {\n const { authenticatedUser } = useContext(AppContext);\n return (\n <>\n <div className=\"dropdown-header profile-label\" role=\"heading\" aria-level={1}>\n <div className=\"d-flex\">\n <Avatar size=\"1.5rem\" />\n <div className=\"pl-2 align-self-center\">{authenticatedUser?.username || 'Account'}</div>\n </div>\n </div>\n <div className=\"dropdown-divider\" />\n {component}\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAkBC,UAAU,QAAQ,OAAO;AACvD,SAASC,UAAU,QAAQ,8BAA8B;AACzD,OAAOC,MAAM,MAAM,4CAA4C;AAE/D,OAAO,MAAMC,WAAW,GAAGA,CAAC;EAAEC;AAAuC,CAAC,KAAK;EACzE,MAAM;IAAEC;EAAkB,CAAC,GAAGL,UAAU,CAACC,UAAU,CAAC;EACpD,oBACEF,KAAA,CAAAO,aAAA,CAAAP,KAAA,CAAAQ,QAAA,qBACER,KAAA,CAAAO,aAAA;IAAKE,SAAS,EAAC,+BAA+B;IAACC,IAAI,EAAC,SAAS;IAAC,cAAY;EAAE,gBAC1EV,KAAA,CAAAO,aAAA;IAAKE,SAAS,EAAC;EAAQ,gBACrBT,KAAA,CAAAO,aAAA,CAACJ,MAAM;IAACQ,IAAI,EAAC;EAAQ,CAAE,CAAC,eACxBX,KAAA,CAAAO,aAAA;IAAKE,SAAS,EAAC;EAAwB,GAAEH,iBAAiB,EAAEM,QAAQ,IAAI,SAAe,CACpF,CACF,CAAC,eACNZ,KAAA,CAAAO,aAAA;IAAKE,SAAS,EAAC;EAAkB,CAAE,CAAC,EACnCJ,SACD,CAAC;AAEP,CAAC","ignoreList":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,13 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
2
|
-
import { WhiteLogo } from './components/WhiteLogo';
|
|
3
3
|
import { MenuWrapper } from './components/MenuWrapper';
|
|
4
4
|
import { SandboxFooter } from './components/SandboxFooter';
|
|
5
5
|
import { DropDownToggler } from './components/DropDownToggler';
|
|
6
6
|
import { CatalogBanner } from './components/CatalogBanner';
|
|
7
|
-
export {
|
|
7
|
+
export { MenuWrapper, SandboxFooter, DropDownToggler, CatalogBanner };
|
|
8
8
|
// Example slot settings you can use in your deployment. You may be able to import these
|
|
9
9
|
// for quick development usage.
|
|
10
10
|
export const slotSettings = {
|
|
11
|
-
logo_slot: {
|
|
12
|
-
keepDefault: false,
|
|
13
|
-
plugins: [{
|
|
14
|
-
op: PLUGIN_OPERATIONS.Insert,
|
|
15
|
-
widget: {
|
|
16
|
-
id: 'custom_logo',
|
|
17
|
-
type: DIRECT_PLUGIN,
|
|
18
|
-
RenderWidget: WhiteLogo
|
|
19
|
-
}
|
|
20
|
-
}]
|
|
21
|
-
},
|
|
22
11
|
'org.openedx.frontend.layout.header_desktop_user_menu_toggle.v1': {
|
|
23
12
|
keepDefault: false,
|
|
24
13
|
plugins: [{
|
|
@@ -59,7 +48,7 @@ export const slotSettings = {
|
|
|
59
48
|
}
|
|
60
49
|
}]
|
|
61
50
|
},
|
|
62
|
-
|
|
51
|
+
'org.openedx.frontend.catalog.home_page.banner': {
|
|
63
52
|
plugins: [{
|
|
64
53
|
op: PLUGIN_OPERATIONS.Hide,
|
|
65
54
|
widgetId: 'default_contents'
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DIRECT_PLUGIN","PLUGIN_OPERATIONS","
|
|
1
|
+
{"version":3,"file":"index.js","names":["DIRECT_PLUGIN","PLUGIN_OPERATIONS","MenuWrapper","SandboxFooter","DropDownToggler","CatalogBanner","slotSettings","keepDefault","plugins","op","Insert","widget","id","type","RenderWidget","desktop_user_menu_slot","Wrap","widgetId","wrapper","mobile_user_menu_slot","footer_slot","Hide"],"sources":["../src/index.ts"],"sourcesContent":["// @ts-ignore\nimport { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';\nimport { MenuWrapper } from './components/MenuWrapper';\nimport { SandboxFooter } from './components/SandboxFooter';\nimport { DropDownToggler } from './components/DropDownToggler';\nimport { CatalogBanner } from './components/CatalogBanner';\n\nexport {\n MenuWrapper, SandboxFooter, DropDownToggler, CatalogBanner,\n};\n// Example slot settings you can use in your deployment. You may be able to import these\n// for quick development usage.\nexport const slotSettings = {\n 'org.openedx.frontend.layout.header_desktop_user_menu_toggle.v1': {\n keepDefault: false,\n plugins: [\n {\n op: PLUGIN_OPERATIONS.Insert,\n widget: {\n id: 'custom_desktop_toggle',\n type: DIRECT_PLUGIN,\n RenderWidget: DropDownToggler,\n },\n },\n ],\n },\n desktop_user_menu_slot: {\n keepDefault: true,\n plugins: [\n {\n op: PLUGIN_OPERATIONS.Wrap,\n widgetId: 'default_contents',\n wrapper: MenuWrapper,\n },\n ],\n },\n mobile_user_menu_slot: {\n keepDefault: true,\n plugins: [\n {\n op: PLUGIN_OPERATIONS.Wrap,\n widgetId: 'default_contents',\n wrapper: MenuWrapper,\n },\n ],\n },\n footer_slot: {\n plugins: [\n {\n op: PLUGIN_OPERATIONS.Hide,\n widgetId: 'default_contents',\n },\n {\n op: PLUGIN_OPERATIONS.Insert,\n widget: {\n id: 'custom_footer',\n type: DIRECT_PLUGIN,\n RenderWidget: SandboxFooter,\n },\n },\n ],\n },\n 'org.openedx.frontend.catalog.home_page.banner': {\n plugins: [\n {\n op: PLUGIN_OPERATIONS.Hide,\n widgetId: 'default_contents',\n },\n {\n op: PLUGIN_OPERATIONS.Insert,\n widget: {\n id: 'custom_catalog_banner',\n type: DIRECT_PLUGIN,\n RenderWidget: CatalogBanner,\n },\n },\n ],\n },\n};\n"],"mappings":"AAAA;AACA,SAASA,aAAa,EAAEC,iBAAiB,QAAQ,oCAAoC;AACrF,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SAASC,aAAa,QAAQ,4BAA4B;AAE1D,SACEH,WAAW,EAAEC,aAAa,EAAEC,eAAe,EAAEC,aAAa;AAE5D;AACA;AACA,OAAO,MAAMC,YAAY,GAAG;EAC1B,gEAAgE,EAAE;IAChEC,WAAW,EAAE,KAAK;IAClBC,OAAO,EAAE,CACP;MACEC,EAAE,EAAER,iBAAiB,CAACS,MAAM;MAC5BC,MAAM,EAAE;QACNC,EAAE,EAAE,uBAAuB;QAC3BC,IAAI,EAAEb,aAAa;QACnBc,YAAY,EAAEV;MAChB;IACF,CAAC;EAEL,CAAC;EACDW,sBAAsB,EAAE;IACtBR,WAAW,EAAE,IAAI;IACjBC,OAAO,EAAE,CACP;MACEC,EAAE,EAAER,iBAAiB,CAACe,IAAI;MAC1BC,QAAQ,EAAE,kBAAkB;MAC5BC,OAAO,EAAEhB;IACX,CAAC;EAEL,CAAC;EACDiB,qBAAqB,EAAE;IACrBZ,WAAW,EAAE,IAAI;IACjBC,OAAO,EAAE,CACP;MACEC,EAAE,EAAER,iBAAiB,CAACe,IAAI;MAC1BC,QAAQ,EAAE,kBAAkB;MAC5BC,OAAO,EAAEhB;IACX,CAAC;EAEL,CAAC;EACDkB,WAAW,EAAE;IACXZ,OAAO,EAAE,CACP;MACEC,EAAE,EAAER,iBAAiB,CAACoB,IAAI;MAC1BJ,QAAQ,EAAE;IACZ,CAAC,EACD;MACER,EAAE,EAAER,iBAAiB,CAACS,MAAM;MAC5BC,MAAM,EAAE;QACNC,EAAE,EAAE,eAAe;QACnBC,IAAI,EAAEb,aAAa;QACnBc,YAAY,EAAEX;MAChB;IACF,CAAC;EAEL,CAAC;EACD,+CAA+C,EAAE;IAC/CK,OAAO,EAAE,CACP;MACEC,EAAE,EAAER,iBAAiB,CAACoB,IAAI;MAC1BJ,QAAQ,EAAE;IACZ,CAAC,EACD;MACER,EAAE,EAAER,iBAAiB,CAACS,MAAM;MAC5BC,MAAM,EAAE;QACNC,EAAE,EAAE,uBAAuB;QAC3BC,IAAI,EAAEb,aAAa;QACnBc,YAAY,EAAET;MAChB;IACF,CAAC;EAEL;AACF,CAAC","ignoreList":[]}
|
package/dist/types.d.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
//# sourceMappingURL=types.d.js.map
|
package/dist/types.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.js","names":[],"sources":["../src/types.d.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"types.d.js","names":[],"sources":["../src/types.d.ts"],"sourcesContent":["declare module '*.png';\n"],"mappings":"","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
2
|
+
"name": "@opencraft/frontend-plugin-sandbox",
|
|
3
|
+
"version": "1.2.0-alpha.0",
|
|
4
|
+
"description": "Plugin for custom headers and footers in OpenCraft's sandboxes",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/open-craft/frontend-plugin-sandbox.git"
|
|
8
|
+
},
|
|
9
|
+
"browserslist": [
|
|
10
|
+
"extends @edx/browserslist-config"
|
|
11
|
+
],
|
|
12
|
+
"main": "dist/index.js",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"postinstall": "pnpm run build",
|
|
15
|
+
"build": "fedx-scripts babel -x .ts,.tsx src --out-dir dist --source-maps --ignore **/*.test.jsx,**/__mocks__,**/__snapshots__,**/setupTest.js --copy-files",
|
|
16
|
+
"lint": "fedx-scripts eslint --ext .ts --ext .tsx src/",
|
|
17
|
+
"lint:fix": "fedx-scripts eslint --fix --ext .ts --ext .tsx src/",
|
|
18
|
+
"test": "fedx-scripts jest --coverage --passWithNoTests"
|
|
19
|
+
},
|
|
20
|
+
"author": "OpenCraft",
|
|
21
|
+
"license": "AGPL-3.0",
|
|
22
|
+
"homepage": "https://github.com/open-craft/frontend-plugin-sandbox#readme",
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/open-craft/frontend-plugin-sandbox/issues"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@edx/frontend-component-header": ">=6.6.0",
|
|
31
|
+
"@edx/frontend-platform": ">=8.0.0",
|
|
32
|
+
"@openedx/frontend-plugin-framework": ">=1.2.1",
|
|
33
|
+
"@openedx/paragon": ">=23.14.2",
|
|
34
|
+
"@types/react": "^18.0.0",
|
|
35
|
+
"classnames": "*",
|
|
36
|
+
"react": "^18.0.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@edx/browserslist-config": ">=1.1.1",
|
|
40
|
+
"@openedx/frontend-build": ">=14.6.6",
|
|
41
|
+
"typescript": "^5.2.0"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Image, Row, Stack } from
|
|
3
|
-
import bannerBg from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Image, Row, Stack } from '@openedx/paragon';
|
|
3
|
+
import bannerBg from '../assets/banner-bg.png';
|
|
4
4
|
|
|
5
5
|
export const CatalogBanner = () => (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
<Row
|
|
7
|
+
direction="horizontal"
|
|
8
|
+
className="bg-primary"
|
|
9
|
+
>
|
|
10
|
+
<Stack
|
|
11
|
+
direction="vertical"
|
|
12
|
+
className="justify-content-center px-6"
|
|
13
|
+
style={{ maxWidth: '55rem' }}
|
|
9
14
|
>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}}
|
|
42
|
-
alt="illustration of a workspace with a computer screen displaying charts and graphs, accompanied by a desk lamp, coffee cup, and potted plant"
|
|
43
|
-
/>
|
|
44
|
-
</Stack>
|
|
45
|
-
</Row>
|
|
15
|
+
<h1 className="display-2 text-light-100">
|
|
16
|
+
You’re viewing a live
|
|
17
|
+
<span className="text-brand-500">
|
|
18
|
+
{' Open edX® '}
|
|
19
|
+
</span>
|
|
20
|
+
demo
|
|
21
|
+
</h1>
|
|
22
|
+
<p className="h4 text-light-100 ">
|
|
23
|
+
OpenClass is a demo site by OpenCraft where you can explore the
|
|
24
|
+
Open edX platform as a learner or course author.
|
|
25
|
+
</p>
|
|
26
|
+
</Stack>
|
|
27
|
+
<Stack
|
|
28
|
+
className="justify-content-end"
|
|
29
|
+
style={{
|
|
30
|
+
backgroundImage: 'url(../assets/banner-bg.png)',
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
<Image
|
|
34
|
+
src={bannerBg}
|
|
35
|
+
style={{
|
|
36
|
+
height: '100%',
|
|
37
|
+
width: '100%',
|
|
38
|
+
maxHeight: '550px',
|
|
39
|
+
objectFit: 'contain',
|
|
40
|
+
objectPosition: 'right top',
|
|
41
|
+
}}
|
|
42
|
+
alt="illustration of a workspace with a computer screen displaying charts and graphs, accompanied by a desk lamp, coffee cup, and potted plant"
|
|
43
|
+
/>
|
|
44
|
+
</Stack>
|
|
45
|
+
</Row>
|
|
46
46
|
);
|
|
@@ -2,10 +2,9 @@ import React, { useContext } from 'react';
|
|
|
2
2
|
import Avatar from '@edx/frontend-component-header/dist/Avatar';
|
|
3
3
|
import { DesktopUserMenuTogglePropTypes } from '@edx/frontend-component-header/dist/desktop-header/DesktopUserMenuToggle';
|
|
4
4
|
import { AppContext } from '@edx/frontend-platform/react';
|
|
5
|
-
import { AppContextInterface } from '../types';
|
|
6
5
|
|
|
7
|
-
export const DropDownToggler = ({ avatar })
|
|
8
|
-
const { authenticatedUser } = useContext
|
|
6
|
+
export const DropDownToggler = ({ avatar }) => {
|
|
7
|
+
const { authenticatedUser } = useContext(AppContext);
|
|
9
8
|
return (
|
|
10
9
|
<Avatar size="1.5em" src={avatar} alt={authenticatedUser.username} />
|
|
11
10
|
);
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import React, { ReactElement, useContext } from 'react';
|
|
2
2
|
import { AppContext } from '@edx/frontend-platform/react';
|
|
3
3
|
import Avatar from '@edx/frontend-component-header/dist/Avatar';
|
|
4
|
-
import { AppContextInterface } from '../types';
|
|
5
4
|
|
|
6
5
|
export const MenuWrapper = ({ component }: { component: ReactElement }) => {
|
|
7
|
-
const { authenticatedUser } = useContext
|
|
6
|
+
const { authenticatedUser } = useContext(AppContext);
|
|
8
7
|
return (
|
|
9
8
|
<>
|
|
10
9
|
<div className="dropdown-header profile-label" role="heading" aria-level={1}>
|
|
11
10
|
<div className="d-flex">
|
|
12
11
|
<Avatar size="1.5rem" />
|
|
13
|
-
<div className="pl-2 align-self-center">{authenticatedUser
|
|
12
|
+
<div className="pl-2 align-self-center">{authenticatedUser?.username || 'Account'}</div>
|
|
14
13
|
</div>
|
|
15
14
|
</div>
|
|
16
15
|
<div className="dropdown-divider" />
|
package/src/index.ts
CHANGED
|
@@ -1,28 +1,15 @@
|
|
|
1
1
|
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
2
|
-
import { WhiteLogo } from './components/WhiteLogo';
|
|
3
2
|
import { MenuWrapper } from './components/MenuWrapper';
|
|
4
3
|
import { SandboxFooter } from './components/SandboxFooter';
|
|
5
4
|
import { DropDownToggler } from './components/DropDownToggler';
|
|
6
5
|
import { CatalogBanner } from './components/CatalogBanner';
|
|
6
|
+
|
|
7
7
|
export {
|
|
8
|
-
|
|
8
|
+
MenuWrapper, SandboxFooter, DropDownToggler, CatalogBanner,
|
|
9
9
|
};
|
|
10
10
|
// Example slot settings you can use in your deployment. You may be able to import these
|
|
11
11
|
// for quick development usage.
|
|
12
12
|
export const slotSettings = {
|
|
13
|
-
logo_slot: {
|
|
14
|
-
keepDefault: false,
|
|
15
|
-
plugins: [
|
|
16
|
-
{
|
|
17
|
-
op: PLUGIN_OPERATIONS.Insert,
|
|
18
|
-
widget: {
|
|
19
|
-
id: 'custom_logo',
|
|
20
|
-
type: DIRECT_PLUGIN,
|
|
21
|
-
RenderWidget: WhiteLogo,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
13
|
'org.openedx.frontend.layout.header_desktop_user_menu_toggle.v1': {
|
|
27
14
|
keepDefault: false,
|
|
28
15
|
plugins: [
|
|
@@ -72,7 +59,7 @@ export const slotSettings = {
|
|
|
72
59
|
},
|
|
73
60
|
],
|
|
74
61
|
},
|
|
75
|
-
|
|
62
|
+
'org.openedx.frontend.catalog.home_page.banner': {
|
|
76
63
|
plugins: [
|
|
77
64
|
{
|
|
78
65
|
op: PLUGIN_OPERATIONS.Hide,
|
|
@@ -87,5 +74,5 @@ export const slotSettings = {
|
|
|
87
74
|
},
|
|
88
75
|
},
|
|
89
76
|
],
|
|
90
|
-
}
|
|
77
|
+
},
|
|
91
78
|
};
|
package/src/types.d.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "@edx/typescript-config",
|
|
3
2
|
"compilerOptions": {
|
|
4
|
-
"
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"forceConsistentCasingInFileNames": true,
|
|
8
|
+
"isolatedModules": true,
|
|
9
|
+
"jsx": "react-jsx",
|
|
10
|
+
"lib": [
|
|
11
|
+
"DOM",
|
|
12
|
+
"DOM.Iterable",
|
|
13
|
+
"ESNext"
|
|
14
|
+
],
|
|
15
|
+
"module": "ESNext",
|
|
16
|
+
"moduleResolution": "node",
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
5
18
|
"outDir": "dist",
|
|
6
|
-
"
|
|
7
|
-
"paths": {
|
|
8
|
-
"*": ["*"]
|
|
9
|
-
}
|
|
19
|
+
"skipLibCheck": true
|
|
10
20
|
},
|
|
11
|
-
"include": ["
|
|
12
|
-
"exclude": ["dist", "node_modules"]
|
|
21
|
+
"include": ["src/**/*"],
|
|
22
|
+
"exclude": ["dist/*", "node_modules/*"]
|
|
13
23
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import { AppContext } from '@edx/frontend-platform/react';
|
|
3
|
-
import { ensureConfig } from '@edx/frontend-platform';
|
|
4
|
-
|
|
5
|
-
ensureConfig([
|
|
6
|
-
'LOGO_WHITE_URL',
|
|
7
|
-
], 'White Header Logo');
|
|
8
|
-
|
|
9
|
-
export const WhiteLogo = () => {
|
|
10
|
-
const { config } = useContext<AppContextInterface>(AppContext);
|
|
11
|
-
return (
|
|
12
|
-
<a className="logo" href={`${config.LMS_BASE_URL}/dashboard`}>
|
|
13
|
-
<img className="d-block" src={config.LOGO_WHITE_URL} alt={config.SITE_NAME} />
|
|
14
|
-
</a>
|
|
15
|
-
);
|
|
16
|
-
};
|