add graph in dependencies page and version selector#1357
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| "d3-selection": "catalog:", | ||
| "d3-zoom": "catalog:", | ||
| "date-fns": "catalog:", | ||
| "date-fns": "^4.1.0", |
There was a problem hiding this comment.
需要改成"date-fns": "catalog:"
| "metascraper-url": "catalog:", | ||
| "metascraper-video": "catalog:", | ||
| "metascraper-youtube": "catalog:", | ||
| "next": "catalog:", |
There was a problem hiding this comment.
需要改成"next": "catalog:",
| "remeda": "catalog:", | ||
| "slugify": "catalog:", | ||
| "styled-components": "catalog:", | ||
| "styled-jsx": "^5.1.7", |
| } | ||
| }, | ||
| "dependencies": { | ||
| "merge-stream": "^2.0.0", |
There was a problem hiding this comment.
请在pnpm-workspace 添加依赖
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: mapan-nju <2246839805@qq.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds a graph visualization for dependency data and implements an interactive version selector component. The changes enable users to view dependency relationships in both table and graph formats while providing the ability to switch between different package versions.
- Adds D3.js dependencies for graph visualization
- Implements a dependencies graph page with interactive D3 visualization
- Creates a reusable version selector dropdown component with version switching functionality
Reviewed Changes
Copilot reviewed 11 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| moon/pnpm-workspace.yaml | Adds D3.js and related type definitions to the package catalog |
| moon/apps/web/package.json | Includes new dependencies in the web app package |
| moon/apps/web/pages/[org]/rust/rust-ecosystem/crate-info/[crateName]/layout.tsx | Integrates version selector dropdown with state management and URL updates |
| moon/apps/web/pages/[org]/rust/rust-ecosystem/crate-info/[crateName]/dependencies/index.tsx | Updates dependencies page to navigate to graph view and removes local view mode state |
| moon/apps/web/pages/[org]/rust/rust-ecosystem/crate-info/[crateName]/dependencies/graph/index.tsx | New graph visualization page using D3.js for dependency relationships |
| moon/apps/web/components/Rust/VersionSelector/VersionSelectorDropdown.tsx | Reusable dropdown component for version selection |
| moon/apps/web/components/Rust/Graph/DependencyGraph.tsx | D3.js-based interactive graph component for visualizing dependencies |
Files not reviewed (1)
- moon/pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| [params?.nsfront, router.query.org] | ||
| ); | ||
|
|
||
| // 版本选择相关状态 |
There was a problem hiding this comment.
[nitpick] Comment is in Chinese. Consider using English for consistency with the rest of the codebase.
| // 版本选择相关状态 | |
| // Version selection related state |
| router.push(href, undefined, { shallow: true }); | ||
| }, [router]); | ||
|
|
||
| // 版本选择处理函数 |
There was a problem hiding this comment.
[nitpick] Comment is in Chinese. Consider using English for consistency with the rest of the codebase.
| // 版本选择处理函数 | |
| // Handler for version selection |
| // 版本选择处理函数 | ||
| const handleVersionSelect = useCallback((newVersion: string) => { | ||
| setSelectedVersion(newVersion); | ||
| // 更新URL中的版本参数 |
There was a problem hiding this comment.
[nitpick] Comment is in Chinese. Consider using English for consistency with the rest of the codebase.
| // 更新URL中的版本参数 | |
| // Update the version parameter in the URL |
|
|
||
| // 从查询参数或URL参数中获取crate信息 | ||
| const crateName = (router.query.crateName as string) || params?.crateName as string || "tokio"; | ||
| // const version = (router.query.version as string) || params?.version as string || "1.2.01"; |
There was a problem hiding this comment.
Remove commented-out code. If the version variable is not needed, delete this line entirely.
| // const version = (router.query.version as string) || params?.version as string || "1.2.01"; | |
| import React, { useEffect, useRef, useState } from 'react'; | ||
| import * as d3 from 'd3'; | ||
| // import { useParams } from "next/navigation"; | ||
|
|
There was a problem hiding this comment.
Remove commented-out import. If useParams is not needed, delete this line entirely.
| // 使用本地模拟数据替代 API 调用 | ||
| const mockData = generateMockDependencyData(); | ||
|
|
||
| // console.log('Mock data for graph:', mockData); |
There was a problem hiding this comment.
Remove commented-out console.log statement. Debug code should not be included in production.
| // console.log('Mock data for graph:', mockData); |
| <div className="border-t pt-3 mt-3"> | ||
| <button | ||
| onClick={() => { | ||
| // console.log('View all versions'); |
There was a problem hiding this comment.
Remove commented-out console.log statement. Debug code should not be included in production.
| // console.log('View all versions'); |
* add graph in dependencies page and version selector * change package.json file * debug--build * Update moon/apps/web/package.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: mapan-nju <2246839805@qq.com> * reload pnpm-lock * change pnpm-lock.yaml --------- Signed-off-by: mapan-nju <2246839805@qq.com> Co-authored-by: Quanyi Ma <eli@patch.sh> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.