Add *very* basic login flow
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { AboutSlint, Button, Palette, HorizontalBox, ScrollView } from "std-widgets.slint";
|
||||
import { Timeline } from "timeline.slint";
|
||||
import { ImageViewer } from "image-viewer.slint";
|
||||
import { LoginView } from "login.slint";
|
||||
|
||||
import { Global } from "global.slint";
|
||||
export { Global }
|
||||
@@ -34,7 +35,8 @@ export component AppWindow inherits Window {
|
||||
|
||||
Header {}
|
||||
|
||||
Timeline {}
|
||||
if !Global.logged-in: LoginView {}
|
||||
if Global.logged-in: Timeline {}
|
||||
}
|
||||
|
||||
if Global.previewed-image.asset-id != "" : ImageViewer {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ImageBucket, ImagePreview } from "types.slint";
|
||||
|
||||
export global Global {
|
||||
in-out property <bool> logged-in: false;
|
||||
in-out property <length> min-image-size: 160px;
|
||||
in-out property <length> image-margin: 2px;
|
||||
in-out property <ImagePreview> previewed-image;
|
||||
@@ -12,6 +13,7 @@ export global Global {
|
||||
in property <length> timeline-height;
|
||||
in property <length> timeline-width;
|
||||
in property <length> timeline-scroll;
|
||||
callback login-api-key(url: string, api_key: string);
|
||||
callback set-timeline-width(length);
|
||||
callback timeline-scrolled(length);
|
||||
}
|
||||
|
||||
35
ui/login.slint
Normal file
35
ui/login.slint
Normal file
@@ -0,0 +1,35 @@
|
||||
import { TextEdit, LineEdit, Button } from "std-widgets.slint";
|
||||
import { Global } from "global.slint";
|
||||
|
||||
export component LoginView inherits VerticalLayout {
|
||||
padding: 16px;
|
||||
alignment: center;
|
||||
spacing: 8px;
|
||||
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
Image {
|
||||
width: 128px;
|
||||
height: self.width;
|
||||
source: @image-url("../assets/immich-logo.svg");
|
||||
}
|
||||
}
|
||||
|
||||
url := LineEdit {
|
||||
placeholder-text: "immich url";
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
api-key := LineEdit {
|
||||
placeholder-text: "immich api key";
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Login";
|
||||
height: 40px;
|
||||
clicked => {
|
||||
Global.login-api-key(url.text, api-key.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user