mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-06-05 20:51:53 -07:00
frontend bugfix: Handle null input in ExpandableInput, make ntfy_url nullable (#1055)
* handle `null` input in `ExpandableInput` * correct `ntfy_url` config type * remove extra space
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
inputHelp = '',
|
inputHelp = '',
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
value: string;
|
value: string | null;
|
||||||
checkboxId: string;
|
checkboxId: string;
|
||||||
inputId: string;
|
inputId: string;
|
||||||
label: string;
|
label: string;
|
||||||
@@ -21,7 +21,11 @@
|
|||||||
children?: Snippet;
|
children?: Snippet;
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
let expanded = $state(value.trim() !== '');
|
function has_value(text: string | null) {
|
||||||
|
return text !== null && text.trim() !== '';
|
||||||
|
}
|
||||||
|
|
||||||
|
let expanded = $state(has_value(value));
|
||||||
let inputElement = $state<HTMLInputElement | null>(null);
|
let inputElement = $state<HTMLInputElement | null>(null);
|
||||||
|
|
||||||
function handle_checkbox_change(e: Event) {
|
function handle_checkbox_change(e: Event) {
|
||||||
@@ -34,7 +38,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handle_input_blur() {
|
function handle_input_blur() {
|
||||||
if (value.trim() === '') {
|
if (!has_value(value)) {
|
||||||
expanded = false;
|
expanded = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export interface Config {
|
|||||||
ui_level: number;
|
ui_level: number;
|
||||||
colorblind_mode: boolean;
|
colorblind_mode: boolean;
|
||||||
key_input_mode: number;
|
key_input_mode: number;
|
||||||
ntfy_url: string;
|
ntfy_url: string | null;
|
||||||
enabled_notifications: enabled_notifications[];
|
enabled_notifications: enabled_notifications[];
|
||||||
analyzers: AnalyzerConfig;
|
analyzers: AnalyzerConfig;
|
||||||
min_space_to_start_recording_mb: number;
|
min_space_to_start_recording_mb: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user