diff --git a/changelog.md b/changelog.md index 4bc2e76..50ef96c 100644 --- a/changelog.md +++ b/changelog.md @@ -14,6 +14,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --> ## [Unreleased] +## [1.3.0] - 2022-03-11 +### Changed +- Index page uses cards instead of list to show available pages +- Available URLs dictionary used `text`, `title` and `color` keys per URL to + style the cards as required +- Loading spinner is shown on index page to avoid showing a not fully rendered + or styled webpage + ## [1.2.0] - 2022-03-06 ### Added - Custom logger can be provided to `run` function to enable different logging @@ -121,8 +129,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `sendfile` function implemented in same way as on Micropythons PicoWeb -[Unreleased]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager/compare/1.2.0...develop +[Unreleased]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager/compare/1.3.0...develop +[1.3.0]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager//tree/1.3.0 [1.2.0]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager//tree/1.2.0 [1.1.0]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager//tree/1.1.0 [1.0.0]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager//tree/1.0.0 diff --git a/templates/index.tpl b/templates/index.tpl index 0433ea0..6844eb4 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -9,13 +9,30 @@ Setup + -
-
- This page - {{content}} -
+
+
+ + diff --git a/wifi_manager/version.py b/wifi_manager/version.py index 1565dd3..f23293f 100644 --- a/wifi_manager/version.py +++ b/wifi_manager/version.py @@ -1,3 +1,3 @@ -__version_info__ = ('1', '2', '0') +__version_info__ = ('1', '3', '0') __version__ = '.'.join(__version_info__) __author__ = 'brainelectronics' diff --git a/wifi_manager/wifi_manager.py b/wifi_manager/wifi_manager.py index 3cfe0cb..b948fe7 100644 --- a/wifi_manager/wifi_manager.py +++ b/wifi_manager/wifi_manager.py @@ -261,10 +261,23 @@ def _add_app_routes(self) -> None: func=self.styles) available_urls = { - "/select": "Select WiFi network", - "/configure": "Manage WiFi networks", - "/scan_result": "Latest Scan result", + "/select": { + "title": "Select WiFi", + "color": "border-primary", + "text": "Configure WiFi networks", + }, + "/configure": { + "title": "Manage WiFi networks", + "color": "border-primary", + "text": "Remove credentials of configured WiFi networks", + }, + "/scan_result": { + "title": "Scan data", + "color": "text-white bg-info", + "text": "Latest WiFi scan data as JSON", + } } + self.available_urls = available_urls def _encrypt_data(self, data: Union[str, list, dict]) -> bytes: @@ -543,10 +556,15 @@ def _render_index_page(self, available_pages: dict) -> str: :rtype: str """ content = "" - for url, description in sorted(available_pages.items(), key=lambda item: item[1]): + + # sort dict by 'title' of the dict values + for url, info in sorted(available_pages.items(), + key=lambda item: item[1]['title']): content += """ - {description} - """.format(url=url, description=description) +
+

{title}

{text}

+
+ """.format(color=info['color'], title=info['title'], text=info['text'], url=url) return content