diff --git a/gallery/easel/route/view/common/__init__.py b/gallery/easel/route/view/common/__init__.py index 2e78bc5..bd7f99e 100644 --- a/gallery/easel/route/view/common/__init__.py +++ b/gallery/easel/route/view/common/__init__.py @@ -1,9 +1,37 @@ from pathlib import Path +from typing import NamedTuple -from fastapi import FastAPI +from fastapi import FastAPI, Request +from fastapi.responses import HTMLResponse from fastapi.staticfiles import StaticFiles +from fastapi.templating import Jinja2Templates + +from gallery.version import __version__ + + +class Section(NamedTuple): + link: str + title: str + + +SECTIONS = [ + Section("weather", "Погода"), + Section("schedule", "Телепрограмма"), +] def mount(app: FastAPI): base_dir = Path(__file__).parent app.mount("/static/common", StaticFiles(directory=base_dir / "static")) + templates = Jinja2Templates(directory=base_dir / "templates") + + @app.get("/", response_class=HTMLResponse) + async def get_section_list(request: Request): + return templates.TemplateResponse( + request=request, + name="index.html", + context={ + "version": __version__, + "sections": SECTIONS, + }, + ) diff --git a/gallery/easel/route/view/common/static/favicon.ico b/gallery/easel/route/view/common/static/favicon.ico index a283ecb..99e44cd 100644 Binary files a/gallery/easel/route/view/common/static/favicon.ico and b/gallery/easel/route/view/common/static/favicon.ico differ diff --git a/gallery/easel/route/view/common/static/gallery.png b/gallery/easel/route/view/common/static/gallery.png new file mode 100644 index 0000000..93b0ee0 Binary files /dev/null and b/gallery/easel/route/view/common/static/gallery.png differ diff --git a/gallery/easel/route/view/common/static/style.css b/gallery/easel/route/view/common/static/style.css index ce3160a..57a926b 100644 --- a/gallery/easel/route/view/common/static/style.css +++ b/gallery/easel/route/view/common/static/style.css @@ -52,6 +52,33 @@ app align-items: center; } +.app-header { + width: 100%; + display: flex; + flex-direction: row; +} + +.app-title { + display: flex; + justify-content: center; + flex-grow: 1; +} + +.app-link-home > * { + margin-left: 2rem; + width: 2rem; + height: 2rem; + background-image: url("/static/common/gallery.png"); + background-size: contain; +} + +.icon { + display: inline-block; + width: 2rem; + height: 2rem; + background-size: contain; +} + ul.app-list { list-style: none; } @@ -61,7 +88,8 @@ ul.app-list > li { } ul.app-list > li > a { - display: block; + display: flex; + gap: 0.25rem; padding: 0.5rem 2rem; text-decoration: none; color: inherit; diff --git a/gallery/easel/route/view/common/templates/index.html b/gallery/easel/route/view/common/templates/index.html new file mode 100644 index 0000000..a9d16c3 --- /dev/null +++ b/gallery/easel/route/view/common/templates/index.html @@ -0,0 +1,41 @@ + + + + + + + + Информация + + + + + +

+ +
+
+
+ Информация +
+

+ + + + \ No newline at end of file diff --git a/gallery/easel/route/view/schedule/static/favicon.ico b/gallery/easel/route/view/schedule/static/favicon.ico new file mode 100644 index 0000000..e93ba79 Binary files /dev/null and b/gallery/easel/route/view/schedule/static/favicon.ico differ diff --git a/gallery/easel/route/view/schedule/static/schedule.png b/gallery/easel/route/view/schedule/static/schedule.png new file mode 100644 index 0000000..6d70e36 Binary files /dev/null and b/gallery/easel/route/view/schedule/static/schedule.png differ diff --git a/gallery/easel/route/view/schedule/static/style.css b/gallery/easel/route/view/schedule/static/style.css index 3c7ecdf..3d7778a 100644 --- a/gallery/easel/route/view/schedule/static/style.css +++ b/gallery/easel/route/view/schedule/static/style.css @@ -1,3 +1,7 @@ +tr { + border-bottom: 1px solid lightgray; +} + td { text-align: left; } diff --git a/gallery/easel/route/view/schedule/templates/channel.html b/gallery/easel/route/view/schedule/templates/channel.html index 11d53c1..6e49e7f 100644 --- a/gallery/easel/route/view/schedule/templates/channel.html +++ b/gallery/easel/route/view/schedule/templates/channel.html @@ -13,19 +13,25 @@ -

- ⬅️ - ⬆️ - {{response.channel.name}} | {{response.date.strftime('%a, %d %B %Y')}} - ➡️ +

+ +
+
+
+ ⬅️ + ⬆️ + {{response.channel.name}} | {{response.date.strftime('%a, %d %B %Y')}} + ➡️ +

diff --git a/gallery/easel/route/view/schedule/templates/index.html b/gallery/easel/route/view/schedule/templates/index.html index b9c64fa..45a3e0e 100644 --- a/gallery/easel/route/view/schedule/templates/index.html +++ b/gallery/easel/route/view/schedule/templates/index.html @@ -13,12 +13,22 @@ +

+ +
+
+
+ Телепрограмма +
+

diff --git a/gallery/easel/route/view/weather/static/favicon.ico b/gallery/easel/route/view/weather/static/favicon.ico new file mode 100644 index 0000000..a283ecb Binary files /dev/null and b/gallery/easel/route/view/weather/static/favicon.ico differ diff --git a/gallery/easel/route/view/weather/static/weather.png b/gallery/easel/route/view/weather/static/weather.png new file mode 100644 index 0000000..7e8bc49 Binary files /dev/null and b/gallery/easel/route/view/weather/static/weather.png differ diff --git a/gallery/easel/route/view/weather/templates/index.html b/gallery/easel/route/view/weather/templates/index.html index 7530eb6..512d05a 100644 --- a/gallery/easel/route/view/weather/templates/index.html +++ b/gallery/easel/route/view/weather/templates/index.html @@ -13,11 +13,20 @@ +

+ +
+
+
+ Погода +
+