diff --git a/README.md b/README.md index 31d6bd3b..de2d6112 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ -![retrolab-logo](./retrolab.png) +

+ RetroLab +

![Github Actions Status](https://github.com/jtpio/retrolab/workflows/Build/badge.svg) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gist/jtpio/77c82c512f6779a1a05ab59d915dfc36/master?urlpath=/retro/notebooks/tour.ipynb) @@ -68,6 +74,19 @@ Support for existing JupyterLab themes! ![themes](https://user-images.githubusercontent.com/591645/101953333-75d9c180-3bfa-11eb-868f-af54d1ea7091.gif) +For an even more retro look, you might want to start `retrolab` with the `--retro-logo` CLI flag: + +```bash +jupyter retro --retro-logo + +# or +# jupyter retro --RetroApp.retro_logo=True +``` + +Example with the [JupyterLab Miami Nights Theme](https://github.com/timkpaine/jupyterlab_miami_nights) installed as a prebuilt extension: + +![image](https://user-images.githubusercontent.com/591645/119634905-77e3b580-be13-11eb-9c4c-d187ebea9df8.png) + ### Zen Mode 😌 ![compact-zen-mode](https://user-images.githubusercontent.com/591645/101923740-149cf880-3bd0-11eb-9617-e3349a76d034.gif) diff --git a/logo.png b/logo.png new file mode 100644 index 00000000..2e18e1f6 Binary files /dev/null and b/logo.png differ diff --git a/logo.svg b/logo.svg new file mode 100644 index 00000000..1c5fe0cc --- /dev/null +++ b/logo.svg @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + RETROLAB + + + diff --git a/packages/application-extension/src/index.ts b/packages/application-extension/src/index.ts index 55a9cbb2..2f52b1fe 100644 --- a/packages/application-extension/src/index.ts +++ b/packages/application-extension/src/index.ts @@ -27,7 +27,7 @@ import { ITranslator, TranslationManager } from '@jupyterlab/translation'; import { RetroApp, RetroShell, IRetroShell } from '@retrolab/application'; -import { jupyterIcon } from '@retrolab/ui-components'; +import { jupyterIcon, retroInlineIcon } from '@retrolab/ui-components'; import { Widget } from '@lumino/widgets'; @@ -84,7 +84,10 @@ const logo: JupyterFrontEndPlugin = { node.target = '_blank'; node.rel = 'noopener noreferrer'; const logo = new Widget({ node }); - jupyterIcon.element({ + + const retroLogo = PageConfig.getOption('retroLogo') === 'true'; + const icon = retroLogo ? retroInlineIcon : jupyterIcon; + icon.element({ container: node, elementPosition: 'center', padding: '2px 2px 2px 8px', diff --git a/packages/help-extension/src/index.tsx b/packages/help-extension/src/index.tsx index 986c25fc..1e6c6b2b 100644 --- a/packages/help-extension/src/index.tsx +++ b/packages/help-extension/src/index.tsx @@ -111,7 +111,7 @@ const plugin: JupyterFrontEndPlugin = { const title = ( <> - + ); @@ -136,7 +136,7 @@ const plugin: JupyterFrontEndPlugin = { ); - return showDialog({ + const dialog = new Dialog({ title, body, buttons: [ @@ -147,6 +147,8 @@ const plugin: JupyterFrontEndPlugin = { }) ] }); + dialog.addClass('jp-AboutRetro'); + void dialog.launch(); } }); diff --git a/packages/help-extension/style/base.css b/packages/help-extension/style/base.css index 0a354f4b..2b68712a 100644 --- a/packages/help-extension/style/base.css +++ b/packages/help-extension/style/base.css @@ -1,3 +1,7 @@ +.jp-AboutRetro .jp-Dialog-header { + justify-content: center; +} + .jp-AboutRetro-header { display: flex; flex-direction: row; diff --git a/packages/lab-extension/src/index.ts b/packages/lab-extension/src/index.ts index 816d9c44..1fffea28 100644 --- a/packages/lab-extension/src/index.ts +++ b/packages/lab-extension/src/index.ts @@ -21,7 +21,7 @@ import { NotebookPanel } from '@jupyterlab/notebook'; -import { jupyterIcon } from '@jupyterlab/ui-components'; +import { retroSunIcon } from '@retrolab/ui-components'; import { CommandRegistry } from '@lumino/commands'; @@ -56,7 +56,7 @@ class RetroButton createNew(panel: NotebookPanel): IDisposable { const button = new ToolbarButton({ tooltip: 'Open with RetroLab', - icon: jupyterIcon, + icon: retroSunIcon, onClick: () => { this._commands.execute(CommandIDs.openRetro); } diff --git a/packages/ui-components/src/icon/iconimports.ts b/packages/ui-components/src/icon/iconimports.ts index 259a0391..7908c76d 100644 --- a/packages/ui-components/src/icon/iconimports.ts +++ b/packages/ui-components/src/icon/iconimports.ts @@ -9,6 +9,10 @@ import jupyterSvgstr from '../../style/icons/jupyter.svg'; import retroSvgstr from '../../style/icons/retrolab.svg'; +import retroInlineSvgstr from '../../style/icons/retrolabInline.svg'; + +import retroSunSvgstr from '../../style/icons/retrolabSun.svg'; + export const jupyterIcon = new LabIcon({ name: 'retro-ui-components:jupyter', svgstr: jupyterSvgstr @@ -18,3 +22,13 @@ export const retroIcon = new LabIcon({ name: 'retro-ui-components:retrolab', svgstr: retroSvgstr }); + +export const retroInlineIcon = new LabIcon({ + name: 'retro-ui-components:retrolabInline', + svgstr: retroInlineSvgstr +}); + +export const retroSunIcon = new LabIcon({ + name: 'retro-ui-components:retroSun', + svgstr: retroSunSvgstr +}); diff --git a/packages/ui-components/style/icons/retrolab.svg b/packages/ui-components/style/icons/retrolab.svg index d098ecc5..4e802b0f 100644 --- a/packages/ui-components/style/icons/retrolab.svg +++ b/packages/ui-components/style/icons/retrolab.svg @@ -1,69 +1,39 @@ - - - - - image/svg+xml - - - - - - - - RetroLab + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/ui-components/style/icons/retrolabInline.svg b/packages/ui-components/style/icons/retrolabInline.svg new file mode 100644 index 00000000..77b793ec --- /dev/null +++ b/packages/ui-components/style/icons/retrolabInline.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/ui-components/style/icons/retrolabSun.svg b/packages/ui-components/style/icons/retrolabSun.svg new file mode 100644 index 00000000..ed794bb8 --- /dev/null +++ b/packages/ui-components/style/icons/retrolabSun.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/retrolab/app.py b/retrolab/app.py index 154bfd4a..f17601bc 100644 --- a/retrolab/app.py +++ b/retrolab/app.py @@ -1,7 +1,8 @@ import os from os.path import join as pjoin -from jupyter_core.application import base_aliases, base_flags +from jupyter_core.application import base_aliases +from jupyter_server.serverapp import flags from jupyter_server.base.handlers import JupyterHandler from jupyter_server.extension.handler import ( ExtensionHandlerMixin, @@ -33,11 +34,12 @@ def get_page_config(self): page_config = { "appVersion": version, "baseUrl": self.base_url, - "terminalsAvailable": self.settings.get('terminals_available', False), + "terminalsAvailable": self.settings.get("terminals_available", False), "token": self.settings["token"], "fullStaticUrl": ujoin(self.base_url, "static", self.name), "frontendUrl": ujoin(self.base_url, "retro/"), "collaborative": app.collaborative, + "retroLogo": app.retro_logo, } mathjax_config = self.settings.get("mathjax_config", "TeX-AMS_HTML-full,Safe") @@ -103,6 +105,12 @@ def get(self, path=None): return self.write(tpl) +aliases = dict(base_aliases) +aliases.update({ + "retro-logo": "RetroApp.retro_logo" +}) + + class RetroApp(NBClassicConfigShimMixin, LabServerApp): name = "retro" app_name = "RetroLab" @@ -122,20 +130,26 @@ class RetroApp(NBClassicConfigShimMixin, LabServerApp): collaborative = Bool( False, config=True, help="Whether to enable collaborative mode." ) + retro_logo = Bool( + False, config=True, help="Whether to use the RetroLab inline logo." + ) - aliases = dict(base_aliases) - flags = dict(base_flags) + flags = flags flags["collaborative"] = ( {"RetroApp": {"collaborative": True}}, "Whether to enable collaborative mode.", ) + flags["retro-logo"] = ( + {"RetroApp": {"retro_logo": True}}, + "Whether to use the RetroLab inline logo", + ) def initialize_handlers(self): self.handlers.append( ( rf"/{self.file_url_prefix}/((?!.*\.ipynb($|\?)).*)", web.RedirectHandler, - {"url": "/retro/edit/{0}"} + {"url": "/retro/edit/{0}"}, ) ) self.handlers.append(("/retro/tree(.*)", RetroTreeHandler))