|
2 | 2 | import LucideCircleX from "~icons/lucide/circle-x"; |
3 | 3 | import LucidePackageCheck from "~icons/lucide/package-check"; |
4 | 4 | import LucideTriangleAlert from "~icons/lucide/triangle-alert"; |
5 | | -import type { PackagePageHandlerProps } from "../../lib/package-page-handler"; |
| 5 | +import type { HandlePackageData } from "../../lib/handlers/package/handle-package"; |
6 | 6 |
|
7 | | -type Props = PackagePageHandlerProps; |
| 7 | +type Props = HandlePackageData; |
8 | 8 |
|
9 | | -const { status, pkgId } = Astro.props; |
| 9 | +const { status, pkgInfo } = Astro.props; |
10 | 10 | --- |
11 | 11 |
|
12 | 12 | { |
13 | | - ["invalid-license", "no-types", "definitely-typed", "no-api"].includes(status) && ( |
| 13 | + status !== "pkg-has-api" && ( |
14 | 14 | <div role="alert" class="alert col-span-full justify-self-center text-balance lg:w-fit"> |
15 | | - {status === "invalid-license" && ( |
| 15 | + {status === "pkg-has-invalid-license" && ( |
16 | 16 | <> |
17 | 17 | <LucideTriangleAlert class="size-6" /> |
18 | 18 | <span> |
19 | | - Documentation is unavailable because package {pkgId} is unlicensed or has a proprietary |
20 | | - license. |
| 19 | + Documentation is unavailable because package {pkgInfo.pkgId} is unlicensed or has a |
| 20 | + proprietary license. |
21 | 21 | </span> |
22 | 22 | </> |
23 | 23 | )} |
24 | 24 |
|
25 | | - {status === "no-types" && ( |
| 25 | + {status === "pkg-has-no-types" && ( |
26 | 26 | <> |
27 | 27 | <LucideTriangleAlert class="size-6" /> |
28 | 28 | <span> |
29 | | - Documentation is unavailable because package {pkgId} doesn't export type definitions. |
| 29 | + Documentation is unavailable because package {pkgInfo.pkgId} doesn't export type |
| 30 | + definitions. |
30 | 31 | </span> |
31 | 32 | </> |
32 | 33 | )} |
33 | 34 |
|
34 | | - {status === "definitely-typed" && ( |
| 35 | + {status === "pkg-is-deprecated-dt-pkg" && ( |
| 36 | + <> |
| 37 | + <LucideTriangleAlert class="size-6" /> |
| 38 | + <span> |
| 39 | + Documentation is unavailable because package {pkgInfo.pkgId} is a deprecated Definitely |
| 40 | + Typed package. |
| 41 | + </span> |
| 42 | + </> |
| 43 | + )} |
| 44 | + |
| 45 | + {status === "pkg-has-dt-pkg" && ( |
35 | 46 | <> |
36 | 47 | <LucidePackageCheck class="size-6" /> |
37 | 48 | <span> |
38 | | - Type definitions for {pkgId} are available in the{" "} |
39 | | - <a class="link-hover link font-bold" href={`/package/${Astro.props.dtPkgName}`}> |
40 | | - {Astro.props.dtPkgName} |
| 49 | + Type definitions for {pkgInfo.pkgId} are available in the{" "} |
| 50 | + <a class="link-hover link font-bold" href={`/package/${pkgInfo.dtPkgName}`}> |
| 51 | + {pkgInfo.dtPkgName} |
41 | 52 | </a>{" "} |
42 | 53 | package. |
43 | 54 | </span> |
44 | 55 | <a |
45 | | - href={`/package/${Astro.props.dtPkgName}`} |
| 56 | + href={`/package/${pkgInfo.dtPkgName}`} |
46 | 57 | class="btn btn-outline btn-sm border-base-content/50" |
47 | 58 | > |
48 | 59 | See documentation |
49 | 60 | </a> |
50 | 61 | </> |
51 | 62 | )} |
52 | 63 |
|
53 | | - {status === "no-api" && ( |
| 64 | + {status === "pkg-has-no-api" && ( |
54 | 65 | <> |
55 | 66 | <LucideCircleX class="size-6" /> |
56 | 67 | <span> |
57 | | - Documentation is unavailable because API extraction failed for package {pkgId}. |
| 68 | + Documentation is unavailable because API extraction failed for package {pkgInfo.pkgId}. |
58 | 69 | </span> |
59 | 70 | </> |
60 | 71 | )} |
|
0 commit comments