Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env.example

This file was deleted.

Binary file modified bun.lockb
Binary file not shown.
1,375 changes: 913 additions & 462 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@vitejs/plugin-react": "^4.3.1",
"axios": "^1.7.2",
"camelcase-keys": "^9.1.3",
"caniuse-lite": "^1.0.30001741",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

What is this for?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

caniuse-lite = a lightweight dataset of browser feature support, powering Autoprefixer/Browserslist so your CSS/JS works consistently across browsers.

"lodash": "^4.17.21",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down Expand Up @@ -53,6 +54,7 @@
},
"devDependencies": {
"autoprefixer": "^10.4.19",
"browserslist": "^4.25.4",
"postcss": "^8.4.39",
"prettier": "^3.3.2",
"tailwindcss": "^3.4.4"
Expand Down
5 changes: 3 additions & 2 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { render } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
38 changes: 17 additions & 21 deletions src/components/IssueList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Popover from "./Popover";
import UserProfilePopoverContent from "./popover/UserProfilePopoverContent";
import StarIcon from "../icons/StartIcon";
import IssueOpenedIcon from "../icons/IssueOpenedIcon";
import IssuePopoverContent from "./popover/IssuePopoverContent";

interface IssueListI {
issues: GitHubIssue[] | null;
Expand Down Expand Up @@ -97,19 +98,12 @@ export default function IssueList(props: IssueListI) {
<div className="flex items-start justify-between gap-4 px-4 pt-3">
<div className="min-w-0">
<div className="flex items-center text-sm">
<Popover trigger="hover" content={UserProfilePopoverContent(issue)}>
<a
className="truncate font-medium hover:underline"
target="_blank"
rel="noreferrer"
href={`https://github.com/${profile}`}
>
{profile}
</a>
<Popover trigger="hover" content={<UserProfilePopoverContent issue={issue} users={issue.user} />}>
<span className="text-blue-600 hover:underline cursor-pointer">
{issue.user.login}
</span>
</Popover>

<span className="mx-1 text-gray-400">/</span>

<a
className="truncate font-medium hover:underline"
target="_blank"
Expand Down Expand Up @@ -139,17 +133,19 @@ export default function IssueList(props: IssueListI) {
{/* Issue title row */}
<div className="mt-1 flex items-center gap-2 px-4">
<IssueOpenedIcon className="shrink-0 text-green-600" />
<a
target="_blank"
rel="noreferrer"
href={issue.html_url}
className="truncate font-semibold leading-6 text-gray-900 hover:text-blue-600"
title={issue.title}
>
{issue.title}
</a>
<Popover trigger="hover" content={<IssuePopoverContent issue={issue} />}>
<a
target="_blank"
rel="noreferrer"
href={issue.html_url}
className="truncate font-semibold leading-6 text-gray-900 hover:text-blue-600"
title={issue.title}
>
{issue.title}
</a>
</Popover>
</div>

{/* Optional description */}
{issue.body && (
<p className="mt-1 line-clamp-2 px-8 pr-4 text-sm text-gray-700">
Expand Down
38 changes: 38 additions & 0 deletions src/components/popover/IssuePopoverContent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from "react";
import { GitHubIssue } from "../../types";

interface IssuePopoverContentProps {
issue: GitHubIssue;
}

export default function IssuePopoverContent({ issue }: IssuePopoverContentProps) {
return (
<div className="bg-white border border-gray-200 shadow-lg rounded-xl p-4 w-72">
{/* Title */}
<h3 className="font-semibold text-gray-900 mb-2 line-clamp-2">{issue.title}</h3>

{/* State + Created */}
<div className="flex justify-between text-xs text-gray-600 mb-2">
<span
className={`px-2 py-0.5 rounded-full text-white ${
issue.state === "open" ? "bg-green-600" : "bg-red-600"
}`}
>
{issue.state}
</span>
<span>Opened on {new Date(issue.created_at).toLocaleDateString()}</span>
</div>

{/* Body (short) */}
{issue.body && (
<p className="text-sm text-gray-700 line-clamp-3">{issue.body}</p>
)}

{/* Comments + Updated */}
<div className="flex justify-between mt-3 text-xs text-gray-500">
<span>💬 {issue.comments} comments</span>
<span>Updated {new Date(issue.updated_at).toLocaleDateString()}</span>
</div>
</div>
);
}
71 changes: 61 additions & 10 deletions src/components/popover/UserProfilePopoverContent.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,69 @@
import React from "react";
import { GitHubIssue } from "../../types";
import React, { useEffect, useState } from "react";
import { GitHubIssue, GitHubUser } from "../../types";

export interface UserProfilePopoverContentI {
interface UserProfilePopoverContentProps {
issue: GitHubIssue;
users: GitHubUser;
}

export default function UserProfilePopoverContent(props: GitHubIssue) {
export default function UserProfilePopoverContent({ issue }: UserProfilePopoverContentProps) {
const { user } = issue;
const [userStats, setUserStats] = useState<{ repos: number; followers: number; following: number; bio: string | null } | null>(null);

useEffect(() => {
if (user?.login) {
fetch(`https://api.github.com/users/${user.login}`)
.then((res) => res.json())
.then((data) => {
console.log("Fetched user data:", data);
setUserStats({
repos: data.public_repos,
followers: data.followers,
following: data.following,
bio: data.bio,
});
})
.catch((err) => console.error("Error fetching user stats:", err));
}
}, [user?.login]);

return (
<div className={"bg-gray-200 text-black rounded p-1 flex flex-col w-20"}>
<img
alt={props.user.login}
className={"rounded w-full mx-auto"}
src={props.user.avatar_url}
/>
<div className="bg-white border border-gray-200 shadow-lg rounded-xl p-4 w-64">
{/* Avatar + Username */}
<div className="flex items-center gap-3">
<img
alt={user.login}
src={user.avatar_url}
className="w-12 h-12 rounded-full border"
/>
<div>
<p className="font-semibold text-gray-900">{user.login}</p>
{user.html_url && (
<a
href={user.html_url}
target="_blank"
rel="noreferrer"
className="text-sm text-blue-600 hover:underline"
>
View Profile
</a>
)}
</div>
</div>

{/* Bio */}
{userStats && (
<p className="mt-3 text-sm text-gray-700 line-clamp-3">
{userStats.bio ?? "No bio available"}
</p>
)}

{/* Stats */}
<div className="flex justify-between mt-4 text-xs text-gray-600">
<span>Repos: {userStats?.repos ?? "-"}</span>
<span>Followers: {userStats?.followers ?? "-"}</span>
<span>Following: {userStats?.following ?? "-"}</span>
</div>
</div>
);
}
8 changes: 5 additions & 3 deletions src/services/apiServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ const apiService = {
items: GitHubIssue[] | null;
}> => {
const labelQueryParam = 'label:"good first issue" ';
let languageQueryParam = ''
languages?.forEach(language => languageQueryParam += `language:${language.toLowerCase()} `)
const stateQueryParam = "state:open ";
let languageQueryParam = "";
if (languages && languages.length > 0) {
languageQueryParam = languages.map(lang => `language:${lang}`).join(" OR ") + " ";
}
const stateQueryParam = "is:issue state:open ";
const searchQueryParam = searchString ? `${searchString} ` : "";

try {
Expand Down