add /nexblock?view=X&url=y page for rendering single nexblock
This commit is contained in:
@@ -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, () => {
|
||||
<AppProvider store={initializeStore()}>
|
||||
<UserMessagesProvider>
|
||||
<Switch>
|
||||
<Route exact path="/" component={PluginTestPage} />
|
||||
<Route exact path="/plugintest" component={PluginTestPage} />
|
||||
<Route exact path="/nexblock" component={NexBlockPage} />
|
||||
<PageRoute path="/redirect" component={CoursewareRedirectLandingPage} />
|
||||
<PageRoute path="/course/:courseId/home">
|
||||
<TabContainer tab="outline" fetch={fetchOutlineTab} slice="courseHome">
|
||||
|
||||
26
src/plugin-test/NexBlockPage.jsx
Normal file
26
src/plugin-test/NexBlockPage.jsx
Normal file
@@ -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 (
|
||||
<div style={{ marginTop: '2em' }}>
|
||||
<Plugin plugin={plugin} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user