Skip to content

add crate search page and crate info page.update CVE info page styling#1309

Merged
benjamin-747 merged 1 commit into
gitmono-dev:mainfrom
martinwq997:main
Aug 6, 2025
Merged

add crate search page and crate info page.update CVE info page styling#1309
benjamin-747 merged 1 commit into
gitmono-dev:mainfrom
martinwq997:main

Conversation

@martinwq997

Copy link
Copy Markdown
Contributor

No description provided.

@vercel

vercel Bot commented Aug 5, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mega ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 5, 2025 8:06pm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive search functionality to the Rust ecosystem with new crate search and detail pages, while also updating the styling of CVE information pages.

  • Implements a new search results page for crates with filtering and pagination
  • Creates a detailed crate information page displaying dependencies, security advisories, and licensing details
  • Adds functional search navigation from the main ecosystem page
  • Updates CVE detail page styling for improved readability and consistency

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 8 comments.

File Description
pages/[org]/rust/rust-ecosystem/search/index.tsx New search results page with tabbed filtering and mock crate data display
pages/[org]/rust/rust-ecosystem/search/crate-info/index.tsx New comprehensive crate detail page showing security, dependencies, and metadata
pages/[org]/rust/rust-ecosystem/index.tsx Added search functionality to navigate to search results page
pages/[org]/rust/rust-ecosystem/ecosystem-cve/cve-info/[cve-id]/index.tsx Updated CVE page styling with improved typography and layout

import { MagnifyingGlassIcon } from '@heroicons/react/24/outline'
import { useRouter } from 'next/router'

// 模拟搜索结果数据 - 移到组件外部

Copilot AI Aug 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mock data contains identical duplicate entries that may not provide realistic testing scenarios. Consider varying the mock data entries to better simulate real search results with different packages, versions, and metadata.

Copilot uses AI. Check for mistakes.
const mockSearchResults = [
{
id: 1,
type: 'NuGet',

Copilot AI Aug 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mock data shows 'NuGet' package types in a Rust ecosystem search page. This appears inconsistent - Rust packages should typically be 'Cargo' or 'crates.io' packages.

Suggested change
type: 'NuGet',
type: 'Cargo',

Copilot uses AI. Check for mistakes.
export default function SearchResultsPage() {
const [search, setSearch] = useState('')
const [activeTab, setActiveTab] = useState('All')
const [searchResults, setSearchResults] = useState<any[]>([])

Copilot AI Aug 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'any[]' type reduces type safety. Consider defining a proper interface for search results to improve type checking and code maintainability.

Suggested change
const [searchResults, setSearchResults] = useState<any[]>([])
const [searchResults, setSearchResults] = useState<SearchResult[]>([])

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,915 @@
// crate-info页面
"use client";

Copilot AI Aug 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'use client' directive is not valid in Next.js pages router. This directive is only used in the app router architecture. Remove this line as it may cause unexpected behavior.

Suggested change
"use client";

Copilot uses AI. Check for mistakes.
import React, { useEffect, useState } from 'react';
import { Link } from '@gitmono/ui/Link';
import Head from 'next/head';
import { useParams } from 'next/navigation';

Copilot AI Aug 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'useParams' hook from 'next/navigation' is for the app router. In pages router, use 'useRouter' from 'next/router' and access params via router.query instead.

Suggested change
import { useParams } from 'next/navigation';

Copilot uses AI. Check for mistakes.
<div className="flex space-x-8 mb-0">
{[
{ id: 'overview', label: 'overview' },
{ id: 'dependencis', label: 'dependencis' },

Copilot AI Aug 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The label 'dependencis' should be 'dependencies' to correct the spelling error.

Suggested change
{ id: 'dependencis', label: 'dependencis' },
{ id: 'dependencies', label: 'dependencies' },

Copilot uses AI. Check for mistakes.
{[
{ id: 'overview', label: 'overview' },
{ id: 'dependencis', label: 'dependencis' },
{ id: 'depentes', label: 'depentes' },

Copilot AI Aug 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The label 'depentes' should be 'dependents' to correct the spelling error.

Suggested change
{ id: 'depentes', label: 'depentes' },
{ id: 'dependents', label: 'dependents' },

Copilot uses AI. Check for mistakes.


const CratePage = () => {
const params = useParams();

Copilot AI Aug 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since useParams is from the app router and shouldn't be used in pages router, this will likely cause runtime errors. Use router.query instead to access dynamic route parameters.

Suggested change
const params = useParams();

Copilot uses AI. Check for mistakes.
@benjamin-747
benjamin-747 added this pull request to the merge queue Aug 6, 2025
Merged via the queue into gitmono-dev:main with commit 3503f86 Aug 6, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants