Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Commit

Permalink
Port to JupyterLab v1
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollonval committed Jul 1, 2019
1 parent d947b62 commit ea582e7
Show file tree
Hide file tree
Showing 3 changed files with 842 additions and 515 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jupyterlab_toastify",
"version": "2.2.0",
"version": "2.3.0",
"description": "Integrate 'react-toastify' nicely in JupyterLab.",
"keywords": [
"jupyter",
Expand Down Expand Up @@ -31,7 +31,7 @@
"prepare": "npm run clean && npm run build"
},
"dependencies": {
"@jupyterlab/application": "^0.19.1",
"@jupyterlab/application": "^1.0.0",
"react-toastify": "^4.4.3"
},
"peerDependencies": {
Expand Down
97 changes: 50 additions & 47 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,69 +3,72 @@ import * as ReactDOM from "react-dom";

import { LabToastContainer, INotification } from "./ToastJupyterLab";

import { JupyterLab, JupyterLabPlugin } from "@jupyterlab/application";
import {
JupyterFrontEndPlugin,
JupyterFrontEnd
} from "@jupyterlab/application";

import "../style/index.css";

/**
* Initialization data for the jupyterlab_toastify extension.
*/
const extension: JupyterLabPlugin<void> = {
const extension: JupyterFrontEndPlugin<void> = {
id: "jupyterlab_toastify",
autoStart: true,
activate: (app: JupyterLab) => {
activate: (app: JupyterFrontEnd) => {
app.restored.then(() => {
const node = document.createElement("div");
document.body.appendChild(node);
ReactDOM.render(<LabToastContainer />, node);

// For testing
// let id = INotification.inProgress("Task in progress!");
// setTimeout(INotification.update, 2500, {
// toastId: id,
// message: "Updating task..."
// });
// setTimeout(INotification.update, 3500, {
// toastId: id,
// message: "Task succeed",
// type: "success",
// autoClose: 3000
// });
// INotification.error("Error");
// setTimeout(
// INotification.info,
// 500,
// "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis blandit tellus, non pulvinar justo."
// );
// setTimeout(INotification.warning, 1000, "Warning");
// setTimeout(INotification.success, 1500, "Success");
// setTimeout(INotification.notify, 2000, "Default");
// let id = INotification.inProgress("Task in progress!");
// setTimeout(INotification.update, 2500, {
// toastId: id,
// message: "Updating task..."
// });
// setTimeout(INotification.update, 3500, {
// toastId: id,
// message: "Task succeed",
// type: "success",
// autoClose: 3000
// });
// INotification.error("Error");
// setTimeout(
// INotification.info,
// 500,
// "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis blandit tellus, non pulvinar justo."
// );
// setTimeout(INotification.warning, 1000, "Warning");
// setTimeout(INotification.success, 1500, "Success");
// setTimeout(INotification.notify, 2000, "Default");

// INotification.error("Error with button", {
// buttons: [
// {
// label: "Action1",
// callback: () => alert("Action1 was clicked")
// },
// {
// label: "Action2",
// callback: () => alert("Action2 was clicked")
// }
// ]
// });
// INotification.error("Error with button", {
// buttons: [
// {
// label: "Action1",
// callback: () => alert("Action1 was clicked")
// },
// {
// label: "Action2",
// callback: () => alert("Action2 was clicked")
// }
// ]
// });

// let id2 = INotification.inProgress("Task2 in progress! But how long will it take to get it done?");
// setTimeout(INotification.update, 4500, {
// toastId: id2,
// message: "Task2 succeed",
// type: "success",
// buttons: [
// {
// label: "Action3",
// callback: () => alert("Action3 was clicked")
// }
// ]
// });
// let id2 = INotification.inProgress("Task2 in progress! But how long will it take to get it done?");
// setTimeout(INotification.update, 4500, {
// toastId: id2,
// message: "Task2 succeed",
// type: "success",
// buttons: [
// {
// label: "Action3",
// callback: () => alert("Action3 was clicked")
// }
// ]
// });
});
}
};
Expand Down
Loading

0 comments on commit ea582e7

Please sign in to comment.