+16
-5
src/components/Import.tsx
+16
-5
src/components/Import.tsx
···
10
/**
11
* Basically the best equivalent to Search that i can do
12
*/
13
-
export function Import({optionaltextstring}: {optionaltextstring?: string}) {
14
-
const [textInput, setTextInput] = useState<string | undefined>(optionaltextstring);
15
const navigate = useNavigate();
16
17
const { status } = useAuth();
···
19
const lycanExists = lycandomain !== "";
20
const { data: lycanstatusdata } = useQueryLycanStatus();
21
const lycanIndexed = lycanstatusdata?.status === "finished" || false;
22
const authed = status === "signedIn";
23
24
const lycanReady = lycanExists && lycanIndexed && authed;
···
28
handleImport({
29
text: textInput,
30
navigate,
31
-
lycanReady: lycanReady,
32
});
33
};
34
···
168
// }
169
170
if (lycanReady) {
171
-
navigate({ to: "/search", search: { q: text} })
172
}
173
-
}
···
10
/**
11
* Basically the best equivalent to Search that i can do
12
*/
13
+
export function Import({
14
+
optionaltextstring,
15
+
}: {
16
+
optionaltextstring?: string;
17
+
}) {
18
+
const [textInput, setTextInput] = useState<string | undefined>(
19
+
optionaltextstring
20
+
);
21
const navigate = useNavigate();
22
23
const { status } = useAuth();
···
25
const lycanExists = lycandomain !== "";
26
const { data: lycanstatusdata } = useQueryLycanStatus();
27
const lycanIndexed = lycanstatusdata?.status === "finished" || false;
28
+
const lycanIndexing = lycanstatusdata?.status === "in_progress" || false;
29
+
const lycanIndexingProgress = lycanIndexing
30
+
? lycanstatusdata?.progress
31
+
: undefined;
32
const authed = status === "signedIn";
33
34
const lycanReady = lycanExists && lycanIndexed && authed;
···
38
handleImport({
39
text: textInput,
40
navigate,
41
+
lycanReady:
42
+
lycanReady || (!!lycanIndexingProgress && lycanIndexingProgress > 0),
43
});
44
};
45
···
179
// }
180
181
if (lycanReady) {
182
+
navigate({ to: "/search", search: { q: text } });
183
}
184
+
}