From 7419b49dbd9495f40f09d43bb26115a788d455d6 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Mon, 18 Aug 2025 15:50:57 +0800 Subject: refactor(launcher:components): better handle defaults --- launcher/components/App.qml | 2 +- launcher/components/IComponent.qml | 4 ++-- launcher/components/Spell.qml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/launcher/components/App.qml b/launcher/components/App.qml index 259a494..0bb5fd9 100644 --- a/launcher/components/App.qml +++ b/launcher/components/App.qml @@ -34,7 +34,7 @@ IComponent { return { valid: isValid, priority: isValid, - answer: selected ? selected.icon : "" + answer: selected?.icon || "" }; } diff --git a/launcher/components/IComponent.qml b/launcher/components/IComponent.qml index 4ff3f2f..4f47b88 100644 --- a/launcher/components/IComponent.qml +++ b/launcher/components/IComponent.qml @@ -15,8 +15,8 @@ IRect { readonly property string inputCleaned: input.toLowerCase().trim() property string prefix property bool active: !standalone ? input && _input.startsWith(prefix) : true - property bool valid: processed?.valid || false - property bool priority: valid && processed?.priority || false // please set priority to false if it's invalid + property bool valid: !standalone ? processed?.valid || false : true + property bool priority: !standalone ? valid && processed?.priority || false : true // please set priority to false if it's invalid property string answer: processed?.answer || "" property Component preview: Component { IText { diff --git a/launcher/components/Spell.qml b/launcher/components/Spell.qml index d4f505b..fe01c3f 100644 --- a/launcher/components/Spell.qml +++ b/launcher/components/Spell.qml @@ -63,8 +63,8 @@ IComponent { return { valid: isValid, priority: isValid, - answer: isValid ? answer : "", - predictiveCompletion: isValid ? answer.slice(input.length) : "" + answer: answer || "", + predictiveCompletion: answer?.slice(input.length) || "" }; } -- cgit v1.2.3