Commit 9fdd66b0 authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Add support for `notebook` routing in sidebar

parent 33067d0d
......@@ -194,6 +194,7 @@ function HypothesisApp({
{route === 'annotation' && (
<AnnotationViewerContent onLogin={login} />
)}
{route === 'notebook' && <StreamContent />}
{route === 'stream' && <StreamContent />}
{route === 'sidebar' && (
<SidebarContent onLogin={login} onSignUp={signUp} />
......
......@@ -115,6 +115,10 @@ describe('HypothesisApp', () => {
route: 'sidebar',
contentComponent: 'SidebarContent',
},
{
route: 'notebook',
contentComponent: 'StreamContent',
},
{
route: 'stream',
contentComponent: 'StreamContent',
......
......@@ -38,11 +38,6 @@ if (appConfig.googleAnalytics) {
addAnalytics(appConfig.googleAnalytics);
}
const isSidebar = !(
window.location.pathname.startsWith('/stream') ||
window.location.pathname.startsWith('/a/')
);
// Install Preact renderer options to work around browser quirks
rendererOptions.setupBrowserFixes();
......@@ -91,9 +86,9 @@ function autosave(autosaveService) {
}
// @inject
function setupFrameSync(frameSync) {
function setupFrameSync(frameSync, isSidebar) {
if (isSidebar) {
frameSync.connect();
frameSync.connect(true);
}
}
......@@ -140,6 +135,12 @@ import { Injector } from '../shared/injector';
function startApp(config) {
const container = new Injector();
const isSidebar = !(
window.location.pathname.startsWith('/stream') ||
window.location.pathname.startsWith('/a/') ||
window.location.pathname.startsWith('/notebook')
);
// Register services.
container
.register('analytics', analyticsService)
......
......@@ -15,11 +15,15 @@ export default function router($window, store) {
const params = queryString.parse($window.location.search);
let route;
switch (pathSegments[0]) {
case 'a':
route = 'annotation';
params.id = pathSegments[1] || '';
break;
case 'notebook':
route = 'notebook';
break;
case 'stream':
route = 'stream';
break;
......@@ -47,6 +51,9 @@ export default function router($window, store) {
url = `/a/${id}`;
}
break;
case 'notebook':
url = '/notebook';
break;
case 'stream':
url = '/stream';
break;
......
......@@ -7,6 +7,11 @@ const fixtures = [
route: 'sidebar',
params: {},
},
{
path: '/notebook',
route: 'notebook',
params: {},
},
{
path: '/a/foo',
route: 'annotation',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment