From: Roman Bazalevskiy <rvb@rvb.name>
Date: Thu, 17 Nov 2022 07:36:41 +0000 (+0300)
Subject: Контакты в веб-интерфейсе
X-Git-Url: https://git.rvb.name/esp-clock.git/commitdiff_plain/e1b7c70070cda97937a405a2c9e48d190b4391ef?ds=sidebyside;hp=7fff81f521f6b9d6f277d972f59411452fb4a677

Контакты в веб-интерфейсе
---

diff --git a/data/web/index.html b/data/web/index.html
index a464c92..2170b08 100644
--- a/data/web/index.html
+++ b/data/web/index.html
@@ -24,6 +24,8 @@
             <ul id="_ui_menu_list" class="pure-menu-list">
             </ul>
         </div>
+        <footer id="_ui_contacts">
+        </footer>
     </div>
 
     <div id="main">
diff --git a/data/web/script.js b/data/web/script.js
index 025339e..67c213f 100644
--- a/data/web/script.js
+++ b/data/web/script.js
@@ -359,10 +359,10 @@ function DrawPage(id) {
   var page_content = document.getElementById("_ui_page_content");
   var content = ''
   for (const element of pages[idx].elements) {
-    content = content + ElementHTML(element)
+    content = content + ElementHTML(element) + '\n'
   }
   page_content.innerHTML = content
-  window.location.hash = '#'+id
+  window.location.hash = id
 }
 
 function DrawNavigator(project, pages) {
@@ -376,10 +376,35 @@ function DrawNavigator(project, pages) {
   menu.innerHTML = list
 }
 
+function DrawContacts(contacts) {
+  if (!contacts) return;
+  var contact_list = '<hr><h4 class="pure-u1">Контакты</h4>'
+  for (const contact of contacts) {
+    const url = new URL(contact)
+    var ref
+    console.log(url)
+    switch (url.protocol) {
+      case 'http':
+      case 'https:':
+        ref = '&#8962; '+url.hostname
+        break
+      case 'mailto:':
+        ref = '&#9993; '+url.pathname
+        break
+      default:
+        ref = '&#128389; '+url.pathname
+    }
+    contact_list += '<a href="'+contact+'">'+ref+'</a>'
+  }
+  var footer = document.getElementById('_ui_contacts');
+  footer.innerHTML = contact_list
+}
+
 function DrawUI(ui) {
   DrawHeader(ui.project)
   pages = ui.pages
   DrawNavigator(ui.project, pages)
+  DrawContacts(ui.project.contacts)
   var anchor = getAnchor()
   if (anchor) {
     DrawPage(anchor)
diff --git a/data/web/style.css b/data/web/style.css
index c83b684..2cbe74b 100644
--- a/data/web/style.css
+++ b/data/web/style.css
@@ -1237,7 +1237,14 @@ input[type=range]:focus::-ms-fill-upper {
  display:none
 }
 footer {
- text-align:center
+ text-align:center;
+ position: absolute;
+ bottom: 1rem;
+ width: 100%
+}
+footer a {
+ display: inline-block;
+ text-decoration: none
 }
 .notification {
   float: right;
diff --git a/ui.yml b/ui.yml
index 090fa56..a07d6fc 100644
--- a/ui.yml
+++ b/ui.yml
@@ -2,9 +2,10 @@ project:
   name: WiFi Clock
   version: 0.1.1
   contacts:
-    email: rvb@rvb.name
-    tg: rvbglas
-    site: https://git.rvb.name
+    - mailto:rvb@rvb.name
+    - tg:rvbglas
+    - https://git.rvb.name
+    - xmpp:rvb@rvb.name
 pages:
   - id: main
     title: Главная
@@ -45,6 +46,8 @@ pages:
   - id: clock
     title: Часы
     elements:
+      - type: text
+        value: Внешний вид
       - id: panel_font
         label: Шрифт часов
         type: select
@@ -72,12 +75,13 @@ pages:
         type: checkbox
       - id: panel_speed
         label: Скорость        
-        type: number
+        type: range
         min: 1
         max: 20
         step: 1
       - type: hr
-      - type: hr
+      - type: text
+        value: Яркость
       - id: day_from
         label: Дневной режим с
         type: number
@@ -105,9 +109,11 @@ pages:
   - id: alarm
     title: Будильник
     elements:
+      - type: text
+        value: Будильник
       - id: enable_alarm
         type: checkbox
-        label: Включить будильник
+        label: Включить
       - id: alarm_hour
         label: Час
         type: number
@@ -146,9 +152,11 @@ pages:
         min: 100
         max: 2000
       - type: hr
+      - type: text
+        value: Сигнал каждый час
       - id: enable_hourly
         type: checkbox
-        label: Сигнал каждый час
+        label: Включить
       - id: hourly_night
         label: В том числе ночью
         type: checkbox
@@ -273,7 +281,7 @@ pages:
           - value: 1
             text: "TX*"
       - id: button_inversed
-        label: "Кнопка на размыкание"
+        label: Кнопка на размыкание
         type: checkbox
       - type: hr
       - type: text
@@ -308,7 +316,7 @@ pages:
           - value: 1
             text: "TX*"
       - id: buzzer_passive
-        label: "Пассивный зуммер"
+        label: Пассивный зуммер
         type: checkbox
       - type: hr 
       - type: text