Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Users item toolbar #379

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

brichet
Copy link
Contributor

@brichet brichet commented Oct 21, 2024

Copy of #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 jupytercad/JupyterCAD#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

      toolbarRegistry.addFactory<NotebookPanel>(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

     {
       "name": "usersItem",
       "rank": 1005
     }

Copy link
Contributor

Binder 👈 Launch a Binder on branch brichet/jupyter_collaboration/users_item_toolbar

@brichet brichet added the enhancement New feature or request label Oct 21, 2024
@@ -0,0 +1,192 @@
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is docprovider the right place for this, or should be in the collaboration package?

Copy link
Contributor Author

@brichet brichet Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I asked myself the same question, and I put it here because it is really a document related widget, it supposed to handle the document current collaborators.
But I don't have a strong opinion on it, and can move it to collaboration.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! I wouldn't know. Maybe @davidbrochart has an opinion on it.

Copy link
Member

@krassowski krassowski Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that we should think about docprovider as enabling to use ydoc without collaboration, so anything which is collaboration-specific should go to collaboration unless it is impractical.

@jtpio
Copy link
Member

jtpio commented Oct 21, 2024

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
Copy link
Contributor Author

brichet commented Oct 21, 2024

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
Copy link
Member

jtpio commented Oct 22, 2024

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 jtpio added this to the 3.1.0 milestone Oct 22, 2024
@jtpio
Copy link
Member

jtpio commented Oct 22, 2024

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
Copy link
Contributor Author

brichet commented Oct 22, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants