Skip to content

Commit a88f52b

Browse files
committed
refactor(tabws): update tooltip duration property name and simplify constructor duration check
1 parent 51fd08e commit a88f52b

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

example/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const createMynahUI = (initialData?: MynahUIDataModel): MynahUI => {
5151
},
5252
config: {
5353
maxTabs: 5,
54-
maxReachedOverlayDuration: 5000,
54+
maxTabsTooltipDuration: 5000,
5555
noMoreTabsTooltip: 'You can only open five conversation tabs at a time.',
5656
autoFocus: true,
5757
tabBarButtons: [

src/components/navigation-tabs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface TabsProps {
2222
onChange?: (selectedTabId: string) => void;
2323
noMoreTabsTooltip?: string;
2424
onBeforeTabRemove?: (tabId: string) => boolean;
25-
maxReachedOverlayDuration?: number;
25+
maxTabsTooltipDuration?: number;
2626
}
2727
export class Tabs {
2828
render: ExtendedHTMLElement;
@@ -118,7 +118,7 @@ export class Tabs {
118118
additionalEvents: {
119119
mouseenter: (e) => {
120120
if (MynahUITabsStore.getInstance().tabsLength() === Config.getInstance().config.maxTabs) {
121-
this.showMaxReachedOverLay(e.currentTarget, this.props.noMoreTabsTooltip ?? Config.getInstance().config.texts.noMoreTabsTooltip, this.props.maxReachedOverlayDuration);
121+
this.showMaxReachedOverLay(e.currentTarget, this.props.noMoreTabsTooltip ?? Config.getInstance().config.texts.noMoreTabsTooltip, this.props.maxTabsTooltipDuration);
122122
}
123123
},
124124
mouseleave: () => {

src/components/notification.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class Notification {
3030
private readonly props;
3131

3232
constructor (props: NotificationProps) {
33-
this.duration = props.duration !== undefined ? props.duration : DEFAULT_TIMEOUT;
33+
this.duration = props.duration ?? DEFAULT_TIMEOUT;
3434
this.type = props.type ?? NotificationType.INFO;
3535
this.props = props;
3636
}

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ export class MynahUI {
289289
this.props.onTabChange(selectedTabId, this.getUserEventId());
290290
}
291291
},
292-
maxReachedOverlayDuration: Config.getInstance().config.maxReachedOverlayDuration,
292+
maxTabsTooltipDuration: Config.getInstance().config.maxTabsTooltipDuration,
293293
noMoreTabsTooltip: Config.getInstance().config.noMoreTabsTooltip,
294294
onBeforeTabRemove: (tabId): boolean => {
295295
if (props.onBeforeTabRemove !== undefined) {

src/static.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ export interface ConfigOptions {
431431
}>;
432432
tabBarButtons?: TabBarMainAction[];
433433
maxTabs: number;
434-
maxReachedOverlayDuration?: number;
434+
maxTabsTooltipDuration?: number;
435435
noMoreTabsTooltip?: string;
436436
showPromptField: boolean;
437437
autoFocus: boolean;

0 commit comments

Comments
 (0)