Skip to content

Commit 6ef051a

Browse files
authored
remove welcome modal (#427)
1 parent da1bcc2 commit 6ef051a

File tree

4 files changed

+4
-115
lines changed

4 files changed

+4
-115
lines changed

ragna/deploy/_ui/css/modal_welcome/button.css

Lines changed: 0 additions & 4 deletions
This file was deleted.

ragna/deploy/_ui/main_page.py

Lines changed: 4 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
import panel as pn
44
import param
55

6-
from . import js
7-
from . import styles as ui
86
from .central_view import CentralView
97
from .left_sidebar import LeftSidebar
108
from .modal_configuration import ModalConfiguration
11-
from .modal_welcome import ModalWelcome
129
from .right_sidebar import RightSidebar
1310

1411

@@ -71,14 +68,6 @@ def open_modal(self):
7168
self.template.modal.objects[0].objects = [self.modal]
7269
self.template.open_modal()
7370

74-
def open_welcome_modal(self, event):
75-
self.modal = ModalWelcome(
76-
close_button_callback=lambda: self.template.close_modal(),
77-
)
78-
79-
self.template.modal.objects[0].objects = [self.modal]
80-
self.template.open_modal()
81-
8271
async def open_new_chat(self, new_chat_id):
8372
# called after creating a new chat.
8473
self.current_chat_id = new_chat_id
@@ -111,59 +100,9 @@ def update_subviews_current_chat_id(self, avoid_senders=[]):
111100
def __panel__(self):
112101
asyncio.ensure_future(self.refresh_data())
113102

114-
objects = [self.left_sidebar, self.central_view, self.right_sidebar]
115-
116-
if self.chats is not None and len(self.chats) == 0:
117-
"""I haven't found a better way to open the modal when the pages load,
118-
than simulating a click on the "New chat" button.
119-
- calling self.template.open_modal() doesn't work
120-
- calling self.on_click_new_chat doesn't work either
121-
- trying to schedule a call to on_click_new_chat with pn.state.schedule_task
122-
could have worked but my tests were yielding an unstable result.
123-
"""
124-
125-
new_chat_button_name = "open welcome modal"
126-
open_welcome_modal = pn.widgets.Button(
127-
name=new_chat_button_name,
128-
button_type="primary",
129-
)
130-
open_welcome_modal.on_click(self.open_welcome_modal)
131-
132-
hack_open_modal = pn.pane.HTML(
133-
"""
134-
<script> let buttons = $$$('button.bk-btn-primary');
135-
console.log(buttons);
136-
buttons.forEach(function(btn){
137-
if ( btn.innerText.trim() == '{new_chat_btn_name}' ){
138-
btn.click();
139-
}
140-
});
141-
</script>
142-
""".replace(
143-
"{new_chat_btn_name}", new_chat_button_name
144-
).strip(),
145-
# This is not really styling per say, it's just a way to hide from the page the HTML item of this hack.
146-
# It's not worth moving this to a separate file.
147-
stylesheets=[
148-
ui.css(
149-
":host",
150-
{"position": "absolute", "z-index": "-999"},
151-
)
152-
],
153-
)
154-
155-
objects.append(
156-
pn.Row(
157-
open_welcome_modal,
158-
pn.pane.HTML(js.SHADOWROOT_INDEXING),
159-
hack_open_modal,
160-
visible=False,
161-
)
162-
)
163-
164-
main_page = pn.Row(
165-
*objects,
103+
return pn.Row(
104+
self.left_sidebar,
105+
self.central_view,
106+
self.right_sidebar,
166107
css_classes=["main_page_main_row"],
167108
)
168-
169-
return main_page

ragna/deploy/_ui/modal_welcome.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

ragna/deploy/_ui/styles.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"right_sidebar": [pn.widgets.Button, pn.Column, pn.pane.Markdown],
4747
"left_sidebar": [pn.widgets.Button, pn.pane.HTML, pn.Column],
4848
"main_page": [pn.Row],
49-
"modal_welcome": [pn.widgets.Button],
5049
"modal_configuration": [
5150
pn.widgets.IntSlider,
5251
pn.layout.Card,
@@ -103,9 +102,6 @@ def css(selector: Union[str, Iterable[str]], declarations: dict[str, str]) -> st
103102
CONFIG_MODAL_MAX_HEIGHT = 850
104103
CONFIG_MODAL_WIDTH = 800
105104

106-
WELCOME_MODAL_HEIGHT = 275
107-
WELCOME_MODAL_WIDTH = 530
108-
109105

110106
CSS_VARS = css(
111107
":root",

0 commit comments

Comments
 (0)