|
3 | 3 | import panel as pn
|
4 | 4 | import param
|
5 | 5 |
|
6 |
| -from . import js |
7 |
| -from . import styles as ui |
8 | 6 | from .central_view import CentralView
|
9 | 7 | from .left_sidebar import LeftSidebar
|
10 | 8 | from .modal_configuration import ModalConfiguration
|
11 |
| -from .modal_welcome import ModalWelcome |
12 | 9 | from .right_sidebar import RightSidebar
|
13 | 10 |
|
14 | 11 |
|
@@ -71,14 +68,6 @@ def open_modal(self):
|
71 | 68 | self.template.modal.objects[0].objects = [self.modal]
|
72 | 69 | self.template.open_modal()
|
73 | 70 |
|
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 |
| - |
82 | 71 | async def open_new_chat(self, new_chat_id):
|
83 | 72 | # called after creating a new chat.
|
84 | 73 | self.current_chat_id = new_chat_id
|
@@ -111,59 +100,9 @@ def update_subviews_current_chat_id(self, avoid_senders=[]):
|
111 | 100 | def __panel__(self):
|
112 | 101 | asyncio.ensure_future(self.refresh_data())
|
113 | 102 |
|
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, |
166 | 107 | css_classes=["main_page_main_row"],
|
167 | 108 | )
|
168 |
| - |
169 |
| - return main_page |
0 commit comments