Skip to content

Commit 8413fb1

Browse files
committed
optimize welcome page
1 parent 72b2ce9 commit 8413fb1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

themes/welcome.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ class WelcomeMessage {
9696
};
9797
const pageFocusHandler = new PageFocusHandler();
9898
pageFocusHandler.addFocusCallback(reflesh_render_status);
99+
100+
// call update when page size change, call this.update when page size change
101+
window.addEventListener('resize', this.update.bind(this));
99102
}
100103

101104
begin_render() {
@@ -207,9 +210,8 @@ class WelcomeMessage {
207210
const width_to_hide_welcome = 1200;
208211
if (!await this.isChatbotEmpty() || page_width < width_to_hide_welcome || welcome_card_overflow) {
209212
if (this.visible) {
210-
// console.log("remove welcome");
211-
this.removeWelcome();
212-
this.visible = false;
213+
console.log("remove welcome");
214+
this.removeWelcome(); this.visible = false; // this two lines must always be together
213215
this.card_array = [];
214216
this.static_welcome_message_previous = [];
215217
}
@@ -218,9 +220,8 @@ class WelcomeMessage {
218220
if (this.visible) {
219221
return;
220222
}
221-
// console.log("welcome");
222-
this.showWelcome();
223-
this.visible = true;
223+
console.log("show welcome");
224+
this.showWelcome(); this.visible = true; // this two lines must always be together
224225
this.startRefleshCards();
225226
}
226227

0 commit comments

Comments
 (0)