Keldos commited on
Commit
562142e
·
1 Parent(s): f36945f

WIP: toolbox pop from buttom on mobile devices

Browse files
web_assets/javascript/ChuanhuChat.js CHANGED
@@ -30,6 +30,7 @@ var chuanhuPopup = null;
30
  var settingBox = null;
31
  var trainingBox = null;
32
  var popupWrapper = null;
 
33
 
34
  var isInIframe = (window.self !== window.top);
35
  var currentTime = new Date().getTime();
@@ -73,6 +74,7 @@ function initialize() {
73
  settingBox = gradioApp().querySelector('#chuanhu-setting');
74
  trainingBox = gradioApp().querySelector('#chuanhu-training');
75
  popupWrapper = gradioApp().querySelector('#popup-wrapper');
 
76
 
77
 
78
  if (loginUserForm) {
 
30
  var settingBox = null;
31
  var trainingBox = null;
32
  var popupWrapper = null;
33
+ var chuanhuHeader = null;
34
 
35
  var isInIframe = (window.self !== window.top);
36
  var currentTime = new Date().getTime();
 
74
  settingBox = gradioApp().querySelector('#chuanhu-setting');
75
  trainingBox = gradioApp().querySelector('#chuanhu-training');
76
  popupWrapper = gradioApp().querySelector('#popup-wrapper');
77
+ chuanhuHeader = gradioApp().querySelector('#chuanhu-header');
78
 
79
 
80
  if (loginUserForm) {
web_assets/javascript/webui.js CHANGED
@@ -120,9 +120,11 @@ function toolboxClick() {
120
  var toolbox = gradioApp().querySelector('#toolbox-area');
121
  if (toolbox.classList.contains('showSide')) {
122
  toolbox.classList.remove('showSide');
 
123
  closeSide();
124
  } else {
125
  toolbox.classList.add('showSide');
 
126
  showSideMask();
127
  }
128
  }
 
120
  var toolbox = gradioApp().querySelector('#toolbox-area');
121
  if (toolbox.classList.contains('showSide')) {
122
  toolbox.classList.remove('showSide');
123
+ chuanhuHeader.classList.remove('under-box');
124
  closeSide();
125
  } else {
126
  toolbox.classList.add('showSide');
127
+ chuanhuHeader.classList.add('under-box');
128
  showSideMask();
129
  }
130
  }
web_assets/stylesheet/ChuanhuChat.css CHANGED
@@ -11,6 +11,7 @@
11
  --switch-checkbox-color-dark: #515151;
12
 
13
  --menu-width: 300px;
 
14
  --toolbox-width: 280px;
15
  }
16
 
@@ -120,6 +121,7 @@ body.popup-open {
120
  white-space: nowrap;
121
  }
122
 
 
123
  .chuanhu-mask, .chuanhu-side-mask {
124
  background-color: gray;
125
  transition: opacity 0.3s ease;
@@ -134,9 +136,16 @@ body.popup-open {
134
  .chuanhu-mask {
135
  opacity: 0.5;
136
  }
 
137
  .chuanhu-side-mask {
138
  opacity: 0;
139
  }
 
 
 
 
 
 
140
  #popup-wrapper {
141
  display: none;
142
  position: fixed;
@@ -169,13 +178,38 @@ body.popup-open {
169
  }
170
 
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
 
173
  #chuanhu-body {
174
  flex-wrap: nowrap;
175
  gap: 0;
176
  overflow: hidden;
177
  display: inline-flex;
 
178
  /* height: calc(100vh - 72px); */
 
 
179
  }
180
 
181
  /* default invisible */
@@ -191,6 +225,10 @@ body.popup-open {
191
  overflow: hidden;
192
  flex-wrap: nowrap;
193
  }
 
 
 
 
194
  #menu-area > div {
195
  width: var(--menu-width);
196
  }
@@ -224,7 +262,7 @@ body.popup-open {
224
 
225
  @media screen and (max-width: 767px) {
226
  #menu-area {
227
- position: absolute;
228
  transition: left 0.3s ease, visibility 0.1s ease;
229
  left: calc(0px - var(--menu-width));
230
  z-index: 9999;
@@ -232,17 +270,28 @@ body.popup-open {
232
  }
233
  #menu-area.showSide {
234
  left: 0;
235
- margin-left: -16px;
236
  }
 
237
  #toolbox-area {
238
- position: absolute;
239
- transition: right 0.3s ease, visibility 0.1s ease;
240
- right: calc(0px - var(--toolbox-width));
241
- z-index: 9999;
 
242
  overflow: unset;
 
 
 
 
 
 
243
  }
244
  #toolbox-area.showSide {
 
245
  right: 0;
 
 
246
  }
247
  /* #menu-area.showSide, #toolbox-area.showSide {
248
  z-index: 9999;
 
11
  --switch-checkbox-color-dark: #515151;
12
 
13
  --menu-width: 300px;
14
+ --menu-background-fill: white;
15
  --toolbox-width: 280px;
16
  }
17
 
 
121
  white-space: nowrap;
122
  }
123
 
124
+ /* masks */
125
  .chuanhu-mask, .chuanhu-side-mask {
126
  background-color: gray;
127
  transition: opacity 0.3s ease;
 
136
  .chuanhu-mask {
137
  opacity: 0.5;
138
  }
139
+
140
  .chuanhu-side-mask {
141
  opacity: 0;
142
  }
143
+ .chuanhu-top-mask {
144
+ opacity: 0;
145
+ z-index: 10001;
146
+ }
147
+
148
+
149
  #popup-wrapper {
150
  display: none;
151
  position: fixed;
 
178
  }
179
 
180
 
181
+ #chuanhu-header {
182
+ position: fixed;
183
+ top: 0;
184
+ z-index: 1000;
185
+ left: 0;
186
+ right: 0;
187
+ /* padding: 6px 64px; */
188
+ background: var(--background-fill-primary);
189
+
190
+ @media screen and (max-width: 639px) {
191
+ padding: 6px 24px;
192
+ }
193
+ @media screen and (min-width: 640px) {
194
+ padding: 6px 48px;
195
+ }
196
+ /* @media screen and (min-width: 1024px) {
197
+ padding: 6px 96px;
198
+ } */
199
+ }
200
+ #chuanhu-header.under-box {
201
+ z-index: 995 !important;
202
+ }
203
 
204
  #chuanhu-body {
205
  flex-wrap: nowrap;
206
  gap: 0;
207
  overflow: hidden;
208
  display: inline-flex;
209
+ /* margin-top: 54px; */
210
  /* height: calc(100vh - 72px); */
211
+ position: absolute;
212
+ top: 48px;
213
  }
214
 
215
  /* default invisible */
 
225
  overflow: hidden;
226
  flex-wrap: nowrap;
227
  }
228
+ #menu-area {
229
+ border-radius: 0;
230
+ background: var(--menu-background-fill);
231
+ }
232
  #menu-area > div {
233
  width: var(--menu-width);
234
  }
 
262
 
263
  @media screen and (max-width: 767px) {
264
  #menu-area {
265
+ position: fixed;
266
  transition: left 0.3s ease, visibility 0.1s ease;
267
  left: calc(0px - var(--menu-width));
268
  z-index: 9999;
 
270
  }
271
  #menu-area.showSide {
272
  left: 0;
273
+ /* margin-left: -16px; */
274
  }
275
+
276
  #toolbox-area {
277
+ position: fixed;
278
+ width: 100vw;
279
+ transition: top 0.3s ease, visibility 0.1s ease;
280
+ /* right: calc(0px - var(--toolbox-width)); */
281
+ z-index: 10008;
282
  overflow: unset;
283
+ top: 100vh;
284
+ margin: 0;
285
+ }
286
+ #toolbox-area > div {
287
+ width: 100vw;
288
+ height: calc( 90vh - 48px );
289
  }
290
  #toolbox-area.showSide {
291
+ width: 100vw;
292
  right: 0;
293
+ top: calc( 10vh + 48px );
294
+ margin: 0;
295
  }
296
  /* #menu-area.showSide, #toolbox-area.showSide {
297
  z-index: 9999;