From ba97e8700ee89e9fb9f4c619ca6620231735671a Mon Sep 17 00:00:00 2001
From: token <239573049@qq.com>
Date: Sun, 1 Dec 2024 21:37:55 +0800
Subject: [PATCH] Refactor package download link handling in PackageDetails
component
- Simplified the construction of the download URL for packages.
- Moved the URL generation logic directly into the onClick handler for better readability.
- Ensured the download functionality remains intact while improving code clarity.
---
web/src/app/packages/details/index.tsx | 22 ++++----
web/src/app/welcome/index.tsx | 73 ++++++++++++++++----------
2 files changed, 57 insertions(+), 38 deletions(-)
diff --git a/web/src/app/packages/details/index.tsx b/web/src/app/packages/details/index.tsx
index c2443a8..8290179 100644
--- a/web/src/app/packages/details/index.tsx
+++ b/web/src/app/packages/details/index.tsx
@@ -296,19 +296,23 @@ const PackageDetails = () => {
)}
- {
-
- const url = detail.packageDownloadUrl ?? location.origin + '/v3/package/' +
+ {
+ const url = detail.packageDownloadUrl ?? location.origin + '/v3/package/' +
+ detail.package.id + '/' +
+ detail.package.normalizedVersionString + '/' +
+ `${detail.package.id}.${detail.package.normalizedVersionString}.nupkg`;
- const a = document.createElement('a');
- a.href = url;
- a.download = `${detail.package.id}.${detail.package.normalizedVersionString}.nupkg`;
- a.click();
+ const a = document.createElement('a');
+ a.href = url;
+ a.download = `${detail.package.id}.${detail.package.normalizedVersionString}.nupkg`;
+ a.click();
- }}>下载
+ }}>下载
diff --git a/web/src/app/welcome/index.tsx b/web/src/app/welcome/index.tsx
index 9811c88..e2a2093 100644
--- a/web/src/app/welcome/index.tsx
+++ b/web/src/app/welcome/index.tsx
@@ -1,33 +1,48 @@
-import { GridShowcase, Input } from "@lobehub/ui";
-import { Button } from 'antd';
-import { useState } from "react";
-import { useNavigate } from "react-router-dom";
-const Welcome = () => {
- const [search, setSearch] = useState("");
+import React from 'react';
+import { Button, Typography, Card } from 'antd';
+import { useNavigate } from 'react-router-dom';
+import { Flexbox } from 'react-layout-kit';
+
+const { Title, Paragraph } = Typography;
+
+const WelcomePage = () => {
const navigate = useNavigate();
- return <>
-
-
- 使用NuGet Next 更快创建 .NET 程序。
-
-
- >;
-}
+ onClick={() => navigate('/upload')}
+ style={{ marginTop: '20px' }}
+ >
+ 开始上传
+
+
+
+ );
+};
-export default Welcome;
\ No newline at end of file
+export default WelcomePage;
\ No newline at end of file