-
Notifications
You must be signed in to change notification settings - Fork 62
Feat: Added MetricCard component and updated routes #145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,5 @@ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import Metrics from "../components/MetricCard.tsx"; | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix incorrect import path for Metrics component. The import is trying to import -import Metrics from "../components/MetricCard.tsx";
+import Metrics from "../page/Metrics/Metrics";📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| import { Navigate, Route, Routes } from "react-router-dom"; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import Home from "../pages/Home/Home"; // Import the Home component | ||||||||||||||||||||||
|
|
@@ -7,6 +9,7 @@ import Contributors from "../pages/Contributors/Contributors"; | |||||||||||||||||||||
| import Signup from "../pages/Signup/Signup.tsx"; | ||||||||||||||||||||||
| import Login from "../pages/Login/Login.tsx"; | ||||||||||||||||||||||
| import UserProfile from "../pages/UserProfile/UserProfile.tsx"; | ||||||||||||||||||||||
| import MetricCard from "../components/MetricCard.tsx"; | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Remove unused MetricCard import. The -import MetricCard from "../components/MetricCard.tsx";📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| const Router = () => { | ||||||||||||||||||||||
| return ( | ||||||||||||||||||||||
|
|
@@ -20,6 +23,8 @@ const Router = () => { | |||||||||||||||||||||
| <Route path="/home" element={<Home />} /> | ||||||||||||||||||||||
| <Route path="/contributors" element={<Contributors />} /> | ||||||||||||||||||||||
| <Route path="/user/:username" element={<UserProfile />} /> | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| <Route path="/metrics" element={<Metrics />} /> | ||||||||||||||||||||||
| </Routes> | ||||||||||||||||||||||
| ); | ||||||||||||||||||||||
| }; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
|
|
||
| import React from "react"; | ||
|
|
||
| function MetricCard({ username="md-jasim123" }) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add TypeScript interface for component props. The component is missing TypeScript type definitions for its props, which reduces type safety and IDE support. +interface MetricCardProps {
+ username?: string;
+}
+
-function MetricCard({ username="md-jasim123" }) {
+function MetricCard({ username = "md-jasim123" }: MetricCardProps) {🤖 Prompt for AI Agents |
||
| const ProfileUrl = `https://metrics.lecoq.io/${username}`; | ||
| return ( | ||
| <div className="flex justify-center mt-10"> | ||
| <div className="bg-white shadow-md p-8 rounded-lg text-center"> | ||
| <h2 className="text-2xl font-semibold mb-4">GitHub Metric</h2> | ||
| <p className="mb-4"> | ||
| Click the button below to view the Github metrics of <strong>{username}</strong> | ||
| </p> | ||
| <a | ||
| href={ProfileUrl} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className="bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded" | ||
| > | ||
| View Metrics | ||
| </a> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| export default MetricCard; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import React from "react"; | ||
|
|
||
| import MetricCard from "../../components/MetricCard"; | ||
|
|
||
| const Metrics: React.FC = () => { | ||
| return ( | ||
| <div className="mt-10 flex justify-center"> | ||
| <MetricCard /> | ||
| </div> | ||
| ); | ||
|
|
||
| }; | ||
|
|
||
| export default Metrics; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Remove unused import.
The
MetricCardcomponent is imported but never used in this file. Since it's properly utilized in theMetricspage component, this import should be removed.-import MetricCard from "./components/MetricCard";📝 Committable suggestion
🤖 Prompt for AI Agents