ソースを参照

Merge pull request #311 from roshancvp/tour

'Take a tour' button
Steven Silvester 8 年 前
コミット
5d817369d3
3 ファイル変更27 行追加4 行削除
  1. 12 3
      src/about/plugin.ts
  2. 6 0
      src/landing/index.css
  3. 9 1
      src/landing/plugin.ts

+ 12 - 3
src/about/plugin.ts

@@ -9,6 +9,10 @@ import {
   Widget
 } from 'phosphor-widget';
 
+import {
+  TabPanel
+} from 'phosphor-tabs';
+
 
 /**
  * The about page extension.
@@ -67,7 +71,14 @@ function activateAbout(app: Application): void {
     id: commandId,
     handler: () => {
       if (!widget.isAttached) app.shell.addToMainArea(widget);
-      app.shell.activateMain(widget.id);
+      let stack = widget.parent;
+      if (!stack) {
+        return;
+      }
+      let tabs = stack.parent;
+      if (tabs instanceof TabPanel) {
+        tabs.currentWidget = widget;
+      }
     }
   }]);
 
@@ -76,6 +87,4 @@ function activateAbout(app: Application): void {
     text: 'About JupyterLab',
     category: 'Help'
   }]);
-
-  app.shell.addToMainArea(widget);
 }

+ 6 - 0
src/landing/index.css

@@ -103,3 +103,9 @@
   font-size: 12px;
   padding-top: 8px;
 }
+
+.jp-Landing-tour {
+    color: #f37a3c;
+    margin-top: 20px;
+    cursor: pointer;
+}

+ 9 - 1
src/landing/plugin.ts

@@ -28,7 +28,7 @@ const landingExtension = {
 function activateLanding(app: Application, services: ServiceManager): void {
   let widget = new Widget();
   widget.id = 'landing-jupyterlab';
-  widget.title.text = 'JupyterLab';
+  widget.title.text = 'Launcher';
   widget.title.closable = true;
   widget.addClass('jp-Landing');
 
@@ -76,6 +76,14 @@ function activateLanding(app: Application, services: ServiceManager): void {
     app.commands.execute('file-operations:new-notebook');
   });
 
+  let tour = document.createElement('span')
+  tour.textContent = 'Take a tour';
+  tour.className = 'jp-Landing-tour';
+  dialog.appendChild(tour);
+  tour.addEventListener('click', () => {
+    app.commands.execute('about-jupyterlab:show');
+  });
+
   img = body.getElementsByClassName('jp-ImageConsole')[0];
   img.addEventListener('click', () => {
     app.commands.execute(`console:create-${services.kernelspecs.default}`);