From 7ecc0e7929ea41493e4a7699c28d6451e10d8052 Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Wed, 10 Feb 2021 14:51:19 -0500 Subject: [PATCH] add /nexblock?view=X&url=y page for rendering single nexblock --- src/index.jsx | 4 +++- src/plugin-test/NexBlockPage.jsx | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/plugin-test/NexBlockPage.jsx diff --git a/src/index.jsx b/src/index.jsx index 9dc01be5..e8aa6938 100755 --- a/src/index.jsx +++ b/src/index.jsx @@ -27,6 +27,7 @@ import { TabContainer } from './tab-page'; import { fetchDatesTab, fetchOutlineTab, fetchProgressTab } from './course-home/data'; import { fetchCourse } from './courseware/data'; import initializeStore from './store'; +import NexBlockPage from './plugin-test/NexBlockPage'; import PluginTestPage from './plugin-test/PluginTestPage'; subscribe(APP_READY, () => { @@ -34,7 +35,8 @@ subscribe(APP_READY, () => { - + + diff --git a/src/plugin-test/NexBlockPage.jsx b/src/plugin-test/NexBlockPage.jsx new file mode 100644 index 00000000..2f1c0217 --- /dev/null +++ b/src/plugin-test/NexBlockPage.jsx @@ -0,0 +1,26 @@ +import React, { Component } from 'react'; + +import Plugin, { COMPONENT } from './Plugin'; + +const FALLBACK_URL = 'http://localhost:7331/remoteEntry.js'; +const FALLBACK_VIEW = 'PluginOne'; + +// eslint-disable-next-line react/prefer-stateless-function +export default class NexBlockPage extends Component { + render() { + // eslint-disable-next-line react/prop-types + const query = new URLSearchParams(this.props.location.search); + + const plugin = { + url: query.get('url') ?? FALLBACK_URL, + scope: 'plugin', + module: `./${query.get('view') ?? FALLBACK_VIEW}`, + type: COMPONENT, + }; + return ( +
+ +
+ ); + } +}