From 799aebb49c0a51a15a31855c536069a57438cf7f Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Thu, 4 Jun 2026 00:11:04 +0200 Subject: [PATCH] Add footer buttons --- assets/album.svg | 1 + assets/photos.svg | 1 + assets/search.svg | 1 + ui/app-window.slint | 40 +++++++++++++++++++++--------- ui/footer.slint | 59 +++++++++++++++++++++++++++++++++++++++++++++ ui/header.slint | 14 +++++++++++ 6 files changed, 104 insertions(+), 12 deletions(-) create mode 100644 assets/album.svg create mode 100644 assets/photos.svg create mode 100644 assets/search.svg create mode 100644 ui/footer.slint create mode 100644 ui/header.slint diff --git a/assets/album.svg b/assets/album.svg new file mode 100644 index 0000000..02f2356 --- /dev/null +++ b/assets/album.svg @@ -0,0 +1 @@ + diff --git a/assets/photos.svg b/assets/photos.svg new file mode 100644 index 0000000..6736817 --- /dev/null +++ b/assets/photos.svg @@ -0,0 +1 @@ + diff --git a/assets/search.svg b/assets/search.svg new file mode 100644 index 0000000..a679a70 --- /dev/null +++ b/assets/search.svg @@ -0,0 +1 @@ + diff --git a/ui/app-window.slint b/ui/app-window.slint index 42fca21..40db3a0 100644 --- a/ui/app-window.slint +++ b/ui/app-window.slint @@ -2,25 +2,20 @@ import { AboutSlint, Button, Palette, HorizontalBox, ScrollView } from "std-widg import { Timeline } from "timeline.slint"; import { ImageViewer } from "image-viewer.slint"; import { LoginView } from "login.slint"; +import { Header } from "header.slint"; +import { Footer, FooterButton } from "footer.slint"; import { Global } from "global.slint"; export { Global } -component Header inherits Rectangle { - width: 100%; - height: 48px; - background: Palette.alternate-background; - - HorizontalBox { - height: parent.height; - Text { - text: "immich"; - } - } +enum View { + Timeline, + Albums } export component AppWindow inherits Window { out property window-height: self.height; + out property view: View.Timeline; // Do not base preferred-width on children preferred-width: 480px; @@ -36,7 +31,28 @@ export component AppWindow inherits Window { Header {} if !Global.logged-in: LoginView {} - if Global.logged-in: Timeline {} + if Global.logged-in && view == View.Timeline: Timeline {} + + Footer { + FooterButton { + title: "Photos"; + icon: @image-url("../assets/photos.svg"); + clicked => { view = View.Timeline } + } + FooterButton { + title: "Search"; + icon: @image-url("../assets/search.svg"); + } + FooterButton { + title: "Album"; + icon: @image-url("../assets/album.svg"); + clicked => { view = View.Albums} + } + FooterButton { + title: "Library"; + icon: @image-url("../assets/album.svg"); // TODO + } + } } if Global.viewed-image.asset-id != "" : ImageViewer { diff --git a/ui/footer.slint b/ui/footer.slint new file mode 100644 index 0000000..96d2834 --- /dev/null +++ b/ui/footer.slint @@ -0,0 +1,59 @@ +import { Palette } from "std-widgets.slint"; + +export component FooterButton inherits Rectangle { + in property title: "Button"; + in property icon; + callback clicked <=> touch.clicked; + + states [ + pressed when touch.pressed: { + background: #0000ff30; + } + hovered when touch.has-hover: { + background: #0000ff15; + } + default: { + background: #0000; + } + ] + + animate background { + duration: 0.1s; + easing: ease-in-out; + } + + border-radius: 20px; + + VerticalLayout { + padding: 10px; + padding-left: 20px; + padding-right: 20px; + Image { + source: icon; + colorize: #accbfa; + } + Text { + text: title; + horizontal-alignment: center; + } + } + + touch := TouchArea {} +} + +export component Footer inherits Rectangle { + width: 100%; + height: 88px; + background: Palette.alternate-background; + + HorizontalLayout { + height: parent.height; + spacing: 16px; + padding-top: 8px; + padding-bottom: 16px; + padding-left: 16px; + padding-right: 16px; + + @children + } +} diff --git a/ui/header.slint b/ui/header.slint new file mode 100644 index 0000000..16196ec --- /dev/null +++ b/ui/header.slint @@ -0,0 +1,14 @@ +import { HorizontalBox, Palette } from "std-widgets.slint"; + +export component Header inherits Rectangle { + width: 100%; + height: 48px; + background: Palette.alternate-background; + + HorizontalBox { + height: parent.height; + Text { + text: "immich"; + } + } +}