Mercurial > libervia-web
annotate libervia/web/pages/calendar/_browser/__init__.py @ 1557:855729ef75f2
browser (calls): improve call buttons:
- following template change, there are now a call button for video and one for audio, and
no more "switch" button, this is more intuitive
- search items have been customised with a 3 dots menu to show a dropdown, which let
select the "video" or "audio" call mode. By defaut, a click on a search item will do a
video call.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 15 Aug 2023 17:16:45 +0200 |
parents | eb00d593801d |
children |
rev | line source |
---|---|
1508
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 from browser import document, window |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 from browser.timer import set_interval |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 calendar_start = window.calendar_start |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 def update_current_time_line(): |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 now = window.Date.new() |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 # Calculate the position of the current-time-line |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 now_ts = now.getTime() / 1000 |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 minutes_passed = (now_ts - calendar_start) / 60 |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 new_top = minutes_passed + 15 |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 # Update the current-time-line position and make it visible |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 current_time_line = document["current-time-line"] |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 current_time_line.style.top = f"{new_top}px" |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 current_time_line.hidden = False |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 # Initial update |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 update_current_time_line() |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 # Update the current-time-line every minute |
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 set_interval(update_current_time_line, 60 * 1000) |