jupyterlab / jupyter-collaboration

A Jupyter Server Extension Providing Support for Y Documents
https://jupyterlab-realtime-collaboration.readthedocs.io/en/latest/
Other
169 stars 31 forks source link

Users item toolbar #379

Open brichet opened 1 month ago

brichet commented 1 month ago

Copy of https://github.com/jupyterlab/jupyter-collaboration/pull/378, to try to fix the check_release workflow.

This PR provides a widget that can be used in a collaborative document to display current users.

This widget is a refactoring of a widget initially created in jupyterCAD. Porting it to jupyter_collaboration has been initially discussed in https://github.com/jupytercad/JupyterCAD/issues/496.

EDIT:

If the widget is integrated to a notebook for example, it looks like: image

Code for the notebook widget (in Jupyterlab) The Notebook is a special case because the document model can be null when first displayed. We need to handle the `modelChange` event. - packages/notebook-extension/src/index.ts ```ts toolbarRegistry.addFactory(FACTORY, 'usersItem', panel => { const container = new Panel(); const onModelChanged = () => { container.widgets.forEach(w => container.layout?.removeWidget(w)); container.addWidget(UsersItem.createWidget({ model: panel.model })); } onModelChanged(); panel.content.modelChanged.connect(onModelChanged); return container; }); ``` - packages/notebook-extension/schema/panel.json ```json { "name": "usersItem", "rank": 1005 } ```
github-actions[bot] commented 1 month ago

Binder :point_left: Launch a Binder on branch _brichet/jupyter_collaboration/users_itemtoolbar

jtpio commented 1 month ago

Should this be merged now while jupyter-collaboration is currently in RC, with 3.0.0 final to be released in the coming days?

Or should this be part of a 3.1.0 release, since it's more of a new feature?

brichet commented 1 month ago

Should this be merged now while jupyter-collaboration is currently in RC, with 3.0.0 final to be released in the coming days?

Or should this be part of a 3.1.0 release, since it's more of a new feature?

Right, we should probably wait for the next release.

jtpio commented 1 month ago

Looks like this repo does not make active use of GitHub milestones, but it could be useful to start using them to track such issues and improvements.

I just created the following two milestones:

Feel free to move it back to the 3.0.x if you think this should be released sooner.

jtpio commented 1 month ago

btw @brichet if you have a screenshot / screencast around that could be posted in the description that would be really useful, thanks! (and we could also add it to the changelog when releasing this)

brichet commented 1 month ago

btw @brichet if you have a screenshot / screencast around that could be posted in the description that would be really useful, thanks! (and we could also add it to the changelog when releasing this)

Thanks, that helped me to finish this PR, I had only tested it with jupyter-collaboration v2 and forgot to copy the styles in there.