Skip to content

Commit

Permalink
A bit of cleaning on comments and descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
brichet committed Oct 23, 2024
1 parent dd5c64f commit 2c25b6b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
8 changes: 7 additions & 1 deletion packages/jupyter-chat/src/components/chat-messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ type AvatarProps = {
};

/**
* the avatar component.
* The avatar component.
*/
export function Avatar(props: AvatarProps): JSX.Element | null {
const { user } = props;
Expand All @@ -593,18 +593,24 @@ export function Avatar(props: AvatarProps): JSX.Element | null {
fontSize: `var(--jp-ui-font-size${props.small ? '0' : '1'})`
};

const name =
user.display_name ?? user.name ?? (user.username || 'User undefined');
return user.avatar_url ? (
<MuiAvatar
sx={{
...sharedStyles
}}
src={user.avatar_url}
alt={name}
title={name}
></MuiAvatar>
) : user.initials ? (
<MuiAvatar
sx={{
...sharedStyles
}}
alt={name}
title={name}
>
<Typography
sx={{
Expand Down
4 changes: 2 additions & 2 deletions packages/jupyter-chat/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* Distributed under the terms of the Modified BSD License.
*/

export * from './active-cell-manager';
export * from './icons';
export * from './model';
export * from './registry';
export * from './types';
export * from './active-cell-manager';
export * from './selection-watcher';
export * from './types';
export * from './widgets/chat-error';
export * from './widgets/chat-sidebar';
export * from './widgets/chat-widget';
27 changes: 10 additions & 17 deletions python/jupyterlab-collaborative-chat/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const pluginIds = {
*/
const autocompletionPlugin: JupyterFrontEndPlugin<IAutocompletionRegistry> = {
id: pluginIds.autocompletionRegistry,
description: 'An autocompletion registry',
description: 'The autocompletion registry.',
autoStart: true,
provides: IAutocompletionRegistry,
activate: (app: JupyterFrontEnd): IAutocompletionRegistry => {
Expand All @@ -88,7 +88,7 @@ const autocompletionPlugin: JupyterFrontEndPlugin<IAutocompletionRegistry> = {
*/
const docFactories: JupyterFrontEndPlugin<IChatFactory> = {
id: pluginIds.docFactories,
description: 'A document factories for collaborative chat',
description: 'Document factories for collaborative chat.',
autoStart: true,
requires: [IRenderMimeRegistry],
optional: [
Expand Down Expand Up @@ -265,7 +265,7 @@ const docFactories: JupyterFrontEndPlugin<IChatFactory> = {
*/
const chatCommands: JupyterFrontEndPlugin<void> = {
id: pluginIds.chatCommands,
description: 'The commands to create or open a chat',
description: 'The commands to create or open a chat.',
autoStart: true,
requires: [ICollaborativeDrive, IChatFactory],
optional: [
Expand Down Expand Up @@ -352,7 +352,7 @@ const chatCommands: JupyterFrontEndPlugin<void> = {
if (!model) {
showErrorMessage(
'Error creating a chat',
'An error occured while creating the chat'
'An error occurred while creating the chat'
);
return '';
}
Expand Down Expand Up @@ -472,19 +472,15 @@ const chatCommands: JupyterFrontEndPlugin<void> = {

const model = await drive.get(filepath);

/**
* Create a share model from the chat file
*/
// Create a share model from the chat file
const sharedModel = drive.sharedModelFactory.createNew({
path: model.path,
format: model.format,
contentType: chatFileType.contentType,
collaborative: true
}) as YChat;

/**
* Initialize the chat model with the share model
*/
// Initialize the chat model with the share model
const chat = new CollaborativeChatModel({
user,
sharedModel,
Expand All @@ -494,9 +490,7 @@ const chatCommands: JupyterFrontEndPlugin<void> = {
selectionWatcher
});

/**
* Add a chat widget to the side panel.
*/
// Add a chat widget to the side panel.
chatPanel.addChat(
chat,
PathExt.join(
Expand Down Expand Up @@ -553,7 +547,7 @@ const chatCommands: JupyterFrontEndPlugin<void> = {
*/
const chatPanel: JupyterFrontEndPlugin<ChatPanel> = {
id: pluginIds.chatPanel,
description: 'A chat extension for Jupyter',
description: 'The chat panel widget.',
autoStart: true,
provides: IChatPanel,
requires: [ICollaborativeDrive, IRenderMimeRegistry],
Expand Down Expand Up @@ -611,7 +605,6 @@ const chatPanel: JupyterFrontEndPlugin<ChatPanel> = {

/*
* Command to move a chat from the main area to the side panel.
*
*/
commands.addCommand(CommandIDs.moveToSide, {
label: 'Move the chat to the side panel',
Expand Down Expand Up @@ -650,7 +643,7 @@ const chatPanel: JupyterFrontEndPlugin<ChatPanel> = {
*/
const activeCellManager: JupyterFrontEndPlugin<IActiveCellManager> = {
id: pluginIds.activeCellManager,
description: 'the active cell manager plugin',
description: 'The active cell manager plugin.',
autoStart: true,
requires: [INotebookTracker],
provides: IActiveCellManagerToken,
Expand All @@ -670,7 +663,7 @@ const activeCellManager: JupyterFrontEndPlugin<IActiveCellManager> = {
*/
const selectionWatcher: JupyterFrontEndPlugin<ISelectionWatcher> = {
id: pluginIds.selectionWatcher,
description: 'the selection watcher plugin',
description: 'The selection watcher plugin.',
autoStart: true,
requires: [],
provides: ISelectionWatcherToken,
Expand Down

0 comments on commit 2c25b6b

Please sign in to comment.