Skip to content

Commit 764aefd

Browse files
authored
1 (#53)
1 parent 703e8c6 commit 764aefd

File tree

6 files changed

+453
-0
lines changed

6 files changed

+453
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import React from 'react';
2+
import Link from 'next/link';
3+
const CratePage = () => {
4+
// Other code
5+
6+
return (
7+
<div>
8+
{/* Existing header and search */}
9+
<header className="bg-white shadow p-4">
10+
<div className="flex justify-between items-center">
11+
<div className="text-xl font-bold flex flex-col items-start space-y-1">
12+
<div className="flex items-center space-x-1">
13+
<span>open</span>
14+
<span className="text-green-500">/</span>
15+
<span>source</span>
16+
<span className="text-green-500">/</span>
17+
<span>insights</span>
18+
</div>
19+
<div className="flex items-center space-x-2 mt-15">
20+
<span>tokio</span>
21+
<div className="relative">
22+
<button className="flex items-center px-4 py-2 border border-gray-300 rounded hover:bg-gray-100">
23+
1.41.1
24+
<svg
25+
className="ml-2 w-4 h-4"
26+
viewBox="0 0 20 20"
27+
fill="currentColor"
28+
>
29+
<path
30+
fillRule="evenodd"
31+
d="M5 10a1 1 0 011-1h8a1 1 0 110 2H6a1 1 0 01-1-1z"
32+
clipRule="evenodd"
33+
/>
34+
</svg>
35+
</button>
36+
{/* 这里可以添加版本选择的下拉菜单 */}
37+
</div>
38+
</div>
39+
</div>
40+
<div className="flex items-center space-x-4">
41+
<input
42+
type="text"
43+
className="p-2 border border-gray-300 rounded-l-md focus:outline-none focus:ring-2 focus:ring-blue-500"
44+
placeholder="Search..."
45+
/>
46+
<button className="bg-blue-600 text-white px-4 py-2 rounded-r-md hover:bg-blue-700">
47+
Search
48+
</button>
49+
</div>
50+
</div>
51+
52+
<nav className="mt-4">
53+
<ul className="flex space-x-4 text-gray-500 relative">
54+
<li className="cursor-pointer relative">
55+
<Link href="/homepage/search/ad">
56+
<div className="block py-2 relative z-10">Overview</div>
57+
</Link>
58+
59+
<div className="absolute bottom-0 left-0 w-full h-1 bg-blue-500"></div>
60+
</li>
61+
<li className="cursor-pointer relative">
62+
<Link href="/homepage/search/ad/dependencies">
63+
<div className="block py-2 relative z-10">Dependencies</div>
64+
</Link>
65+
66+
</li>
67+
<li className="cursor-pointer relative">
68+
<a href="#" className="block py-2 relative z-10">Dependents</a>
69+
</li>
70+
<li className="cursor-pointer relative">
71+
<a href="#" className="block py-2 relative z-10">Compare</a>
72+
</li>
73+
<li className="cursor-pointer relative">
74+
<a href="#" className="block py-2 relative z-10">Versions</a>
75+
</li>
76+
</ul>
77+
</nav>
78+
</header>
79+
80+
81+
82+
</div>
83+
);
84+
};
85+
86+
export default CratePage;
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
import React from 'react';
2+
import Link from 'next/link';
3+
const CratePage = () => {
4+
// Other code
5+
6+
return (
7+
<div>
8+
{/* Existing header and search */}
9+
<header className="bg-white shadow p-4">
10+
<div className="flex justify-between items-center">
11+
<div className="text-xl font-bold flex flex-col items-start space-y-1">
12+
<div className="flex items-center space-x-1">
13+
<span>open</span>
14+
<span className="text-green-500">/</span>
15+
<span>source</span>
16+
<span className="text-green-500">/</span>
17+
<span>insights</span>
18+
</div>
19+
<div className="flex items-center space-x-2 mt-15">
20+
<span>tokio</span>
21+
<div className="relative">
22+
<button className="flex items-center px-4 py-2 border border-gray-300 rounded hover:bg-gray-100">
23+
1.41.1
24+
<svg
25+
className="ml-2 w-4 h-4"
26+
viewBox="0 0 20 20"
27+
fill="currentColor"
28+
>
29+
<path
30+
fillRule="evenodd"
31+
d="M5 10a1 1 0 011-1h8a1 1 0 110 2H6a1 1 0 01-1-1z"
32+
clipRule="evenodd"
33+
/>
34+
</svg>
35+
</button>
36+
{/* 这里可以添加版本选择的下拉菜单 */}
37+
</div>
38+
</div>
39+
</div>
40+
<div className="flex items-center space-x-4">
41+
<input
42+
type="text"
43+
className="p-2 border border-gray-300 rounded-l-md focus:outline-none focus:ring-2 focus:ring-blue-500"
44+
placeholder="Search..."
45+
/>
46+
<button className="bg-blue-600 text-white px-4 py-2 rounded-r-md hover:bg-blue-700">
47+
Search
48+
</button>
49+
</div>
50+
</div>
51+
52+
<nav className="mt-4">
53+
<ul className="flex space-x-4 text-gray-500 relative">
54+
<li className="cursor-pointer relative">
55+
<Link href="/homepage/search/ad">
56+
<div className="block py-2 relative z-10">Overview</div>
57+
</Link>
58+
59+
<div className="absolute bottom-0 left-0 w-full h-1 bg-blue-500"></div>
60+
</li>
61+
<li className="cursor-pointer relative">
62+
<Link href="/homepage/search/ad/dependencies">
63+
<div className="block py-2 relative z-10">Dependencies</div>
64+
</Link>
65+
66+
</li>
67+
<li className="cursor-pointer relative">
68+
<a href="#" className="block py-2 relative z-10">Dependents</a>
69+
</li>
70+
<li className="cursor-pointer relative">
71+
<a href="#" className="block py-2 relative z-10">Compare</a>
72+
</li>
73+
<li className="cursor-pointer relative">
74+
<a href="#" className="block py-2 relative z-10">Versions</a>
75+
</li>
76+
</ul>
77+
</nav>
78+
</header>
79+
80+
{/* cve */}
81+
<div className="container mx-auto my-8 grid grid-cols-1 lg:grid-cols-2 gap-6">
82+
<div className="space-y-6">
83+
{/* Security Advisories */}
84+
<div className="bg-white shadow rounded-lg p-4">
85+
<h2 className="text-lg font-bold mb-2">Security Advisories</h2>
86+
<p>No advisories detected.</p>
87+
</div>
88+
{/* Licenses */}
89+
<div className="bg-white shadow rounded-lg p-4">
90+
<h2 className="text-lg font-bold mb-2">Licenses</h2>
91+
<div className="mb-2">
92+
<span className="font-bold">LICENSES:</span> MIT
93+
</div>
94+
<div className="mb-2">
95+
<span className="font-bold">DEPENDENCY LICENSES:</span>
96+
<ul className="list-disc pl-6">
97+
<li>Apache-2.0 OR MIT (116)</li>
98+
<li>MIT (27)</li>
99+
<li>MIT OR Uniclicense (7)</li>
100+
{/* Add more dependency licenses */}
101+
</ul>
102+
</div>
103+
</div>
104+
{/* Dependencies */}
105+
<div className="bg-white shadow rounded-lg p-4">
106+
<h2 className="text-lg font-bold mb-2">Dependencies</h2>
107+
<div className="mb-2">
108+
<span className="font-bold">Direct:</span> 23
109+
</div>
110+
<div className="mb-2">
111+
<span className="font-bold">Indirect:</span> 139
112+
</div>
113+
<a href="#" className="text-blue-500 hover:underline">
114+
View all dependencies
115+
</a>
116+
</div>
117+
{/* Dependents */}
118+
<div className="bg-white shadow rounded-lg p-4">
119+
<h2 className="text-lg font-bold mb-2">Dependents</h2>
120+
<div className="mb-2">
121+
<span className="font-bold">Direct:</span> 23
122+
</div>
123+
<div className="mb-2">
124+
<span className="font-bold">Indirect:</span> 139
125+
</div>
126+
<a href="#" className="text-blue-500 hover:underline">
127+
View all dependencies
128+
</a>
129+
</div>
130+
</div>
131+
<div className="bg-white shadow rounded-lg p-4">
132+
<h2 className="text-lg font-bold mb-2">OpenSSF scorecard</h2>
133+
<p>The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.</p>
134+
<a href="#" className="text-blue-500 hover:underline">
135+
View information about checks and how to fix failures.
136+
</a>
137+
<div className="flex items-center justify-between mt-4">
138+
<div className="text-3xl font-bold">8.3/10</div>
139+
<div className="text-sm text-gray-500">Scorecard as of November 11, 2024.</div>
140+
</div>
141+
<div className="mt-4 space-y-2">
142+
<div className="flex justify-between">
143+
<span>Code-Review</span>
144+
<span>10/10</span>
145+
</div>
146+
<div className="flex justify-between">
147+
<span>Maintained</span>
148+
<span>10/10</span>
149+
</div>
150+
<div className="flex justify-between">
151+
<span>CI/Best-Practices</span>
152+
<span>0/10</span>
153+
</div>
154+
<div className="flex justify-between">
155+
<span>License</span>
156+
<span>10/10</span>
157+
</div>
158+
<div className="flex justify-between">
159+
<span>Dangerous-Workflow</span>
160+
<span>10/10</span>
161+
</div>
162+
<div className="flex justify-between">
163+
<span>Security-Policy</span>
164+
<span>10/10</span>
165+
</div>
166+
<div className="flex justify-between">
167+
<span>Token-Permissions</span>
168+
<span>10/10</span>
169+
</div>
170+
<div className="flex justify-between">
171+
<span>Binary-Artifacts</span>
172+
<span>10/10</span>
173+
</div>
174+
<div className="flex justify-between">
175+
<span>Pinned-Dependencies</span>
176+
<span>0/10</span>
177+
</div>
178+
</div>
179+
</div>
180+
</div>
181+
</div>
182+
);
183+
};
184+
185+
export default CratePage;

app/homepage/layout.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import '@/app/ui/global.css';
2+
3+
4+
export const metadata = {
5+
title: 'cratespro',
6+
description: 'Generated by Next.js',
7+
}
8+
9+
export default function RootLayout({
10+
children,
11+
}: {
12+
children: React.ReactNode
13+
}) {
14+
return (
15+
<html lang="en">
16+
<body>{children}</body>
17+
</html>
18+
)
19+
}

app/homepage/page.tsx

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import React from 'react';
2+
import '@/app/ui/global.css';
3+
4+
5+
const HomePage = () => {
6+
return (
7+
//紫色渐变
8+
// <div className="min-h-screen bg-gray-900 text-white">
9+
// {/* 头部和搜索部分 */}
10+
// <div className="bg-gradient-to-b from-[#4D004D] to-white">
11+
// <header className="p-4 flex justify-between items-center">
12+
// <div className="text-2xl font-bold">open/source/insights</div>
13+
// <nav>
14+
// <ul className="flex space-x-5">
15+
// <li><a href="#" className="hover:underline">About</a></li>
16+
// <li><a href="#" className="hover:underline">Documentation</a></li>
17+
// <li><a href="#" className="hover:underline">Blog</a></li>
18+
// </ul>
19+
// </nav>
20+
// </header>
21+
// <div className="flex flex-col items-center justify-center h-80">
22+
// <h1 className="text-4xl font-bold mb-4">Understand your dependencies</h1>
23+
// <p className="text-center mb-4">Your software and your users rely not only on the code you write, but also on the code your code depends on, the code that code depends on, and so on.</p>
24+
// <div className="flex items-center mb-4">
25+
// <input
26+
// type="text"
27+
// placeholder="Search for open source packages, advisories and projects"
28+
// className="p-2 border-none rounded-md text-gray-800 w-2/3 max-w-xl"
29+
// />
30+
// <button className="bg-teal-600 text-white rounded-md p-2 ml-2 hover:bg-teal-700">Search</button>
31+
// </div>
32+
// </div>
33+
// </div>
34+
35+
36+
//绿色渐变
37+
< div className="min-h-screen bg-gray-900 text-white" >
38+
<header className="bg-teal-500 p-4 flex justify-between items-center">
39+
<div className="text-2xl font-bold">open/source/insights</div>
40+
<nav>
41+
<ul className="flex space-x-5">
42+
<li><a href="#" className="hover:underline">About</a></li>
43+
<li><a href="#" className="hover:underline">Documentation</a></li>
44+
<li><a href="#" className="hover:underline">Blog</a></li>
45+
</ul>
46+
</nav>
47+
</header>
48+
{/* 搜索部分 */}
49+
<div className="flex flex-col items-center justify-center h-80 bg-gradient-to-b from-teal-500 to-gray-800">
50+
<h1 className="text-4xl font-bold mb-4 ">Understand your dependencies</h1>
51+
<p className="text-center mb-4">Your software and your users rely not only on the code you write, but also on the code your code depends on, the code that code depends on, and so on.</p>
52+
<div className="flex items-center mb-4">
53+
<input
54+
type="text"
55+
placeholder="Search for open source crates"
56+
className="p-2 border-none rounded-md text-gray-800 w-80 max-w-2xl"
57+
/>
58+
<button className="bg-teal-600 text-white rounded-md p-2 ml-2 hover:bg-teal-700">Search</button>
59+
</div>
60+
</div>
61+
62+
63+
{/* 分割线部分 */}
64+
<div className="border-t-4 border-green-500 h-1/4"></div>
65+
66+
{/* 一些介绍 */}
67+
<div className="container mx-auto p-10">
68+
<div className="bg-gray-800 p-5 mb-6 rounded shadow-md">
69+
<h2 className="text-2xl font-semibold">New features in the deps.dev API</h2>
70+
<p className="mt-2">The deps.dev API, which provides free access to the data that powers this website, now has experimental batch and pull support, as well as a new version that comes with a stability guarantee and deprecation policy.</p>
71+
<p className="mt-2">Learn more about the new features on our blog, or get started with the API documentation, and code examples.</p>
72+
</div>
73+
74+
<div className="bg-gray-800 p-5 mb-6 rounded shadow-md">
75+
<h2 className="text-2xl font-semibold">Seeing the big picture can be difficult—but it shouldn&apos;t be</h2>
76+
<p className="mt-2">The Open Source Insights page for each package shows the full dependency graph and updates it every day. The information provided can help you make informed decisions about using, building, and maintaining your software.</p>
77+
<p className="mt-2">With Open Source Insights, you can actually see the dependency graph for a package, then isolate the paths to a particular dependency. Or see whether a vulnerability in a dependency might affect your code. Or compare two versions of a package to see how the dependencies have changed in a new release.</p>
78+
</div>
79+
80+
<div className="bg-gray-800 p-5 mb-6 rounded shadow-md">
81+
<h2 className="text-2xl font-semibold">How it works</h2>
82+
<p className="mt-2">The service repeatedly examines sites such as github.com, npmjs.com, and pkg.go.dev to find up-to-date information about open source software packages. Using that information, it builds for each package the full dependency graph from scratch—not just from package lock files—connecting it to the packages it depends on and to those that depend on it. This transitive dependency graph allows problems in any package to be made visible to the owners and users of any software they affect.</p>
83+
</div>
84+
</div>
85+
</div >
86+
);
87+
}
88+
89+
export default HomePage;

0 commit comments

Comments
 (0)