Skip to content

Commit

Permalink
chore: update icons to return dummy promises
Browse files Browse the repository at this point in the history
  • Loading branch information
BeksOmega committed Jul 17, 2023
1 parent 521f38f commit aedf2b9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
20 changes: 16 additions & 4 deletions core/icons/comment_icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,24 @@ export class CommentIcon extends Icon implements IHasBubble, ISerializable {
return this.bubbleVisiblity;
}

setBubbleVisible(visible: boolean): void {
if (visible && (this.textBubble || this.textInputBubble)) return;
if (!visible && !(this.textBubble || this.textInputBubble)) return;
/**
* Sets whether the bubble is visible or not.
*
* @returns A promise that resolves when the the bubble has finished opening.
*/
setBubbleVisible(visible: boolean): Promise<void> {
if (visible && (this.textBubble || this.textInputBubble)) {
return Promise.resolve();
}
if (!visible && !(this.textBubble || this.textInputBubble)) {
return Promise.resolve();
}

this.bubbleVisiblity = visible;

if (!this.sourceBlock.rendered || this.sourceBlock.isInFlyout) return;
if (!this.sourceBlock.rendered || this.sourceBlock.isInFlyout) {
return Promise.resolve();
}

if (visible) {
if (this.sourceBlock.isEditable()) {
Expand All @@ -263,6 +274,7 @@ export class CommentIcon extends Icon implements IHasBubble, ISerializable {
'comment'
)
);
return Promise.resolve();
}

/**
Expand Down
11 changes: 9 additions & 2 deletions core/icons/mutator_icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,13 @@ export class MutatorIcon extends Icon implements IHasBubble {
return !!this.miniWorkspaceBubble;
}

setBubbleVisible(visible: boolean): void {
if (this.bubbleIsVisible() === visible) return;
/**
* Sets whether the bubble is visible or not.
*
* @returns A promise that resolves when the the bubble has finished opening.
*/
setBubbleVisible(visible: boolean): Promise<void> {
if (this.bubbleIsVisible() === visible) return Promise.resolve();

if (visible) {
this.miniWorkspaceBubble = new MiniWorkspaceBubble(
Expand All @@ -178,6 +183,8 @@ export class MutatorIcon extends Icon implements IHasBubble {
'mutator'
)
);

return Promise.resolve();
}

/** @returns the configuration the mini workspace should have. */
Expand Down
11 changes: 9 additions & 2 deletions core/icons/warning_icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,13 @@ export class WarningIcon extends Icon implements IHasBubble {
return !!this.textBubble;
}

setBubbleVisible(visible: boolean): void {
if (this.bubbleIsVisible() === visible) return;
/**
* Sets whether the bubble is visible or not.
*
* @returns A promise that resolves when the the bubble has finished opening.
*/
setBubbleVisible(visible: boolean): Promise<void> {
if (this.bubbleIsVisible() === visible) return Promise.resolve();

if (visible) {
this.textBubble = new TextBubble(
Expand All @@ -187,6 +192,8 @@ export class WarningIcon extends Icon implements IHasBubble {
'warning'
)
);

return Promise.resolve();
}

/**
Expand Down

0 comments on commit aedf2b9

Please sign in to comment.