Skip to content

Commit

Permalink
optimize welcome page
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-husky committed Dec 18, 2024
1 parent 72b2ce9 commit 8413fb1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions themes/welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ class WelcomeMessage {
};
const pageFocusHandler = new PageFocusHandler();
pageFocusHandler.addFocusCallback(reflesh_render_status);

// call update when page size change, call this.update when page size change
window.addEventListener('resize', this.update.bind(this));
}

begin_render() {
Expand Down Expand Up @@ -207,9 +210,8 @@ class WelcomeMessage {
const width_to_hide_welcome = 1200;
if (!await this.isChatbotEmpty() || page_width < width_to_hide_welcome || welcome_card_overflow) {
if (this.visible) {
// console.log("remove welcome");
this.removeWelcome();
this.visible = false;
console.log("remove welcome");
this.removeWelcome(); this.visible = false; // this two lines must always be together
this.card_array = [];
this.static_welcome_message_previous = [];
}
Expand All @@ -218,9 +220,8 @@ class WelcomeMessage {
if (this.visible) {
return;
}
// console.log("welcome");
this.showWelcome();
this.visible = true;
console.log("show welcome");
this.showWelcome(); this.visible = true; // this two lines must always be together
this.startRefleshCards();
}

Expand Down

0 comments on commit 8413fb1

Please sign in to comment.