feat(app): update manage servers dialog styling and behavior
This commit is contained in:
@@ -66,7 +66,7 @@
|
||||
|
||||
[data-slot="dialog-header"] {
|
||||
display: flex;
|
||||
padding: 16px 16px 16px 24px;
|
||||
padding: 20px;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
|
||||
@@ -13,6 +13,7 @@ export interface FilteredListProps<T> {
|
||||
sortBy?: (a: T, b: T) => number
|
||||
sortGroupsBy?: (a: { category: string; items: T[] }, b: { category: string; items: T[] }) => number
|
||||
onSelect?: (value: T | undefined, index: number) => void
|
||||
noInitialSelection?: boolean
|
||||
}
|
||||
|
||||
export function useFilteredList<T>(props: FilteredListProps<T>) {
|
||||
@@ -57,6 +58,7 @@ export function useFilteredList<T>(props: FilteredListProps<T>) {
|
||||
})
|
||||
|
||||
function initialActive() {
|
||||
if (props.noInitialSelection) return ""
|
||||
if (props.current) return props.key(props.current)
|
||||
|
||||
const items = flat()
|
||||
@@ -71,6 +73,10 @@ export function useFilteredList<T>(props: FilteredListProps<T>) {
|
||||
})
|
||||
|
||||
const reset = () => {
|
||||
if (props.noInitialSelection) {
|
||||
list.setActive("")
|
||||
return
|
||||
}
|
||||
const all = flat()
|
||||
if (all.length === 0) return
|
||||
list.setActive(props.key(all[0]))
|
||||
|
||||
Reference in New Issue
Block a user