chore: add loading page for suspense

This commit is contained in:
iCrawl 2023-11-13 11:23:59 +01:00
parent 356cadb382
commit 8d04cbc203
No known key found for this signature in database
GPG key ID: 1AB888B16355FBB2
2 changed files with 22 additions and 4 deletions

View file

@ -0,0 +1,20 @@
export default function Loading() {
return (
<div className="relative top-6 mx-4 min-h-xl flex flex-col items-center justify-center gap-4">
<svg
className="h-9 w-9 animate-spin text-black dark:text-white"
fill="none"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
<path
className="opacity-75 dark:opacity-100"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
fill="currentColor"
/>
</svg>
<div className="text-lg font-medium">Loading...</div>
</div>
);
}

View file

@ -122,7 +122,7 @@ export async function generateStaticParams({ params: { package: packageName, ver
const modelJSON = await fetchModelJSON(packageName, version);
if (!modelJSON) {
return [{ package: packageName, version, item: '' }];
return [{ item: '' }];
}
const model = addPackageToModel(new ApiModel(), modelJSON);
@ -131,12 +131,10 @@ export async function generateStaticParams({ params: { package: packageName, ver
const entry = pkg?.entryPoints[0];
if (!entry) {
return [{ package: packageName, version, item: '' }];
return [{ item: '' }];
}
return entry.members.map((member: ApiItem) => ({
package: packageName,
version,
item: `${member.displayName}${OVERLOAD_SEPARATOR}${member.kind}`,
}));
}