a lightweight, interval-based utility to combat digital strain through "Ma" (intentional pauses) for the eyes and body.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 74 lines 2.4 kB view raw
1import { Button, LineEdit } from "std-widgets.slint"; 2import { Theme } from "theme.slint"; 3import "../assets/fonts/Nunito-Regular.ttf"; 4import "../assets/fonts/Nunito-Medium.ttf"; 5import "../assets/fonts/Nunito-SemiBold.ttf"; 6import "../assets/fonts/Nunito-Bold.ttf"; 7 8export component PasswordSetupWindow inherits Window { 9 title: root.verify-mode ? "ioma — Verify Password" : "ioma — Set Emergency Password"; 10 width: 420px; 11 height: 260px; 12 default-font-family: "Nunito"; 13 14 in property <bool> verify-mode: false; 15 in-out property <string> error-text: ""; 16 17 callback submit-clicked(string /* password */); 18 callback cancel-clicked(); 19 20 VerticalLayout { 21 alignment: start; 22 padding: 24px * Theme.font-scale; 23 spacing: 12px * Theme.font-scale; 24 25 Text { 26 text: root.verify-mode 27 ? "Enter the emergency unlock password to turn off enforced mode." 28 : "Have someone you trust set an emergency unlock password."; 29 wrap: word-wrap; 30 color: #888888; 31 font-size: Theme.font_body; 32 } 33 34 password-field := LineEdit { 35 placeholder-text: "Password"; 36 input-type: password; 37 } 38 39 confirm-field := LineEdit { 40 placeholder-text: "Confirm password"; 41 input-type: password; 42 visible: !root.verify-mode; 43 } 44 45 if error-text != "" : Text { 46 text: error-text; 47 color: #ff6b6b; 48 font-size: Theme.font_body; 49 } 50 51 HorizontalLayout { 52 alignment: end; 53 spacing: 8px * Theme.font-scale; 54 55 Button { 56 text: "Cancel"; 57 clicked => { root.cancel-clicked(); } 58 } 59 Button { 60 text: root.verify-mode ? "Verify" : "Set Password"; 61 clicked => { 62 if password-field.text == "" { 63 root.error-text = "Password cannot be empty."; 64 } else if !root.verify-mode && password-field.text != confirm-field.text { 65 root.error-text = "Passwords do not match."; 66 } else { 67 root.error-text = ""; 68 root.submit-clicked(password-field.text); 69 } 70 } 71 } 72 } 73 } 74}