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