mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-10 02:39:56 +00:00
Theme selector UX (current theme indicator and easier selection) (#4623)
Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
@@ -50,6 +50,15 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
|
||||
filter: "",
|
||||
})
|
||||
|
||||
createEffect(() => {
|
||||
if (props.current) {
|
||||
const currentIndex = flat().findIndex((opt) => isDeepEqual(opt.value, props.current))
|
||||
if (currentIndex >= 0) {
|
||||
setStore("selected", currentIndex)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
let input: InputRenderable
|
||||
|
||||
const filtered = createMemo(() => {
|
||||
@@ -88,7 +97,14 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
|
||||
|
||||
createEffect(() => {
|
||||
store.filter
|
||||
setStore("selected", 0)
|
||||
if (store.filter.length > 0) {
|
||||
setStore("selected", 0)
|
||||
} else if (props.current) {
|
||||
const currentIndex = flat().findIndex((opt) => isDeepEqual(opt.value, props.current))
|
||||
if (currentIndex >= 0) {
|
||||
setStore("selected", currentIndex)
|
||||
}
|
||||
}
|
||||
scroll.scrollTo(0)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user