mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-05-30 03:09:26 -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 = '',
|
||||
children,
|
||||
}: {
|
||||
value: string;
|
||||
value: string | null;
|
||||
checkboxId: string;
|
||||
inputId: string;
|
||||
label: string;
|
||||
@@ -21,7 +21,11 @@
|
||||
children?: Snippet;
|
||||
} = $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);
|
||||
|
||||
function handle_checkbox_change(e: Event) {
|
||||
@@ -34,7 +38,7 @@
|
||||
}
|
||||
|
||||
function handle_input_blur() {
|
||||
if (value.trim() === '') {
|
||||
if (!has_value(value)) {
|
||||
expanded = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ export interface Config {
|
||||
ui_level: number;
|
||||
colorblind_mode: boolean;
|
||||
key_input_mode: number;
|
||||
ntfy_url: string;
|
||||
ntfy_url: string | null;
|
||||
enabled_notifications: enabled_notifications[];
|
||||
analyzers: AnalyzerConfig;
|
||||
min_space_to_start_recording_mb: number;
|
||||
|
||||
Reference in New Issue
Block a user