Skip to content

Conversation

@agriyakhetarpal
Copy link
Member

Tip

This PR is currently not in its final state, but it is ready for review.

At this moment, the styling and the View Only header are working, but I have yet to separate the implementation into a new file, remove redundant styling, and find a way to prevent removing the read-only-indicator from the toolbar of widgets, among other tasks.

Purple View Only bar inserted at the top of a shared notebook with the text 'View Only' written in white colour in the middle

@agriyakhetarpal
Copy link
Member Author

The 400+ line diff here at the time of writing is primarily due to the extent to which I had to go in order to make the styling work and look as closely as possible to the Figma design documents we have.

@agriyakhetarpal agriyakhetarpal added the enhancement New feature or request label Jul 1, 2025
@krassowski
Copy link
Collaborator

It would be helpful if we had this tested on CI.

}

/**
* Checks if a notebook is read-only/shared based on its metadata.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a tight coupling to the backend. Instead I would suggest to make sure we manage the writable state which is used natively by JupyterLab (which we already do) and then use this one-liner:

return !notebookPanel.context.contentsModel.writable

Comment on lines +246 to +249
if (!contentHeader) {
console.error('NotebookPanel.contentHeader is not available');
return null;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why would it be unavailable? This seems a bit too defensive.

* @param notebookPanel - The notebook panel to style
* @param headerWidget - The View Only header widget
*/
function applySeamlessHeaderStyling(notebookPanel: any, headerWidget: Widget): void {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why can't we just use CSS for this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we could. I very much do not undersand what this function was intended to do.

In any case I opened #75 as a counter proposal.

@krassowski
Copy link
Collaborator

bot please update snapshots

@krassowski
Copy link
Collaborator

This did not work the last time because none of the changes in this PR gets applied immediately. I added a delay and will regenerate snapshot: bot please update snapshots

@agriyakhetarpal
Copy link
Member Author

Superseded by #75.

@agriyakhetarpal agriyakhetarpal deleted the view-only-bar-for-shared-notebooks branch July 2, 2025 13:09
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.

3 participants