Skip to content

Commit

Permalink
fix: The key of the plugin list may be duplicated
Browse files Browse the repository at this point in the history
  • Loading branch information
harry-xi committed Jan 12, 2025
1 parent 6c09902 commit 8867bda
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ export default function Page({
},
}}
>
{packages.items.map((item) => (
{packages.items.map((item, index) => (
<motion.div
key={item.updated}
key={index}
transition={{ duration: 0.5 }}
variants={{
hidden: { opacity: 0, y: 20 },
Expand Down
12 changes: 6 additions & 6 deletions components/plugin/install-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ import { Version } from "@/lib/api";
function commandBuilder(
verInfo: Version,
pkg: GetPackageResponse,
version?: string
version?: string,
): Result<string, string> {
if (verInfo.packageManager == "lip") {
if (verInfo.source == "github") {
// lip--github
return Result.Ok(
`lip install ${pkg.identifier}${version ? `@${version}` : ""}`
`lip install ${pkg.identifier}${version ? `@${version}` : ""}`,
);
}
} else if (verInfo.packageManager == "pip") {
if (verInfo.source == "pypi") {
// pip--pypi
return Result.Ok(
`pip install ${pkg.identifier}${version ? `==${version}` : ""}`
`pip install ${pkg.identifier}${version ? `==${version}` : ""}`,
);
} else if (verInfo.source == "github") {
// pip--github
return Result.Ok(
`pip install git+https://${pkg.identifier}${
version ? `@${version}` : ""
}`
}`,
);
}
} else if (verInfo.packageManager == "none") {
Expand Down Expand Up @@ -58,13 +58,13 @@ export default function InstallModal({
const version = pkg?.versions.find((t) => t.version === versionStr);

const releaseTimeString = new Date(
version?.releasedAt || ""
version?.releasedAt || "",
).toLocaleString();

const installCmd = commandBuilder(
version as Version,
pkg,
isVersionSelected ? versionStr : ""
isVersionSelected ? versionStr : "",
);

return (
Expand Down

0 comments on commit 8867bda

Please sign in to comment.