Skip to content
Closed
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
17 changes: 15 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 81 additions & 3 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,84 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
width: 100%;
}

.app-container {
min-height: 100vh;
min-height: 100dvh;

display: flex;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial | 💤 Low value

Address Stylelint formatting warnings.

Stylelint is flagging empty lines before declarations throughout the file. While these are minor style issues, consider running stylelint --fix to auto-correct them for consistency with your project's linting rules.

Also applies to: 13-13, 15-15, 34-34, 37-37, 43-43, 46-46, 48-48, 55-55, 57-57, 59-59, 61-61

🧰 Tools
🪛 Stylelint (17.11.0)

[error] 9-9: Expected no empty line before declaration (declaration-empty-line-before)

(declaration-empty-line-before)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/App.css` at line 9, Stylelint is flagging extra empty lines before CSS
declarations in App.css (e.g., the rule containing "display: flex;" and other
declarations at the lines referenced); fix by removing the blank lines that
precede each declaration so declarations immediately follow their selector or
previous property, or run stylelint --fix to auto-correct; update the
selectors/rules that include "display: flex;" and the other noted declarations
so they conform to the project's Stylelint formatting rules.

flex-direction: column;
align-items: center;

padding: 40px;

background-color: #111;
color: white;
}

.app-container h1 {
margin-bottom: 30px;
font-size: 3rem;
}

form {
display: flex;
gap: 12px;
margin-bottom: 30px;
}

input {
padding: 12px;
width: 300px;

border: none;
border-radius: 10px;

font-size: 16px;
}

button {
padding: 12px 20px;

border: none;
border-radius: 10px;

cursor: pointer;

font-size: 16px;
font-weight: bold;
}

.org-card {
max-width: 500px;

padding: 30px;

border-radius: 16px;

background-color: #1d1d1d;

text-align: center;
}

.org-card img {
border-radius: 50%;
margin-bottom: 20px;
}

.org-card h2 {
margin-bottom: 10px;
}

.org-card p {
margin-bottom: 12px;
}

.org-card a {
color: #4ea1ff;
text-decoration: none;
}

.org-card a:hover {
text-decoration: underline;
}
54 changes: 50 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,58 @@
import { useState } from 'react'

import './App.css'

import OrgCard from './components/orgcard'
import SearchBar from "./components/searchbar";

import { fetchOrganization } from './services/githubapi'

import type { GitHubOrg } from './types/github'

function App() {
const [organization, setOrganization] =
useState<GitHubOrg | null>(null)

const [loading, setLoading] = useState(false)

const [error, setError] = useState('')

async function handleSearch(orgName: string) {
try {
setLoading(true)
setError('')

const data = await fetchOrganization(orgName)

setOrganization(data)
} catch (error) {
setOrganization(null)

if (error instanceof Error) {
setError(error.message)
} else {
setError('Something went wrong')
}
} finally {
setLoading(false)
}
}

return (
<>
<h1>Hello, OrgExplorer!</h1>
</>
<div className="app-container">
<h1>OrgExplorer</h1>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Externalize user-facing strings for internationalization.

The title "OrgExplorer", loading message "Loading...", and error messages are hardcoded. As per coding guidelines, user-visible strings should be externalized to resource files for i18n support.

Also applies to: 42-42, 44-44

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/App.tsx` at line 38, Hardcoded user-facing strings in the App component
(the <h1>OrgExplorer</h1>, the "Loading..." text and the error messages shown in
render) must be moved to i18n resource keys and referenced from code; replace
the literal strings in App (the h1 element and wherever loading/error messages
are rendered) with calls to your localization API (e.g.,
useTranslation()/t('...') or a getString('...') helper) using clear keys like
title.orgExplorer, loading.message, and error.fetchFailed, and add those keys
with appropriate values to the locale resource file(s); update any imports
(e.g., import { useTranslation } from 'react-i18next' or your project
equivalent) and ensure the component uses the translation function to render the
strings.


<SearchBar onSearch={handleSearch} />

{loading && <p>Loading...</p>}

{error && <p>{error}</p>}

{organization && (
<OrgCard organization={organization} />
)}
</div>
)
}

export default App
export default App
38 changes: 38 additions & 0 deletions src/components/orgcard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import type { GitHubOrg } from '../types/github'

interface OrgCardProps {
organization: GitHubOrg
}

function OrgCard({ organization }: OrgCardProps) {
return (
<div className="org-card">
<img
src={organization.avatar_url}
alt={organization.login}
width={120}
height={120}
/>

<h2>{organization.login}</h2>

<p>
{organization.description ?? 'No description available'}
</p>

<p>Followers: {organization.followers}</p>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Externalize user-facing strings for internationalization.

Labels like "Followers:", "Public Repositories:", and "Visit GitHub Profile" are hardcoded. As per coding guidelines, user-visible strings should be externalized to resource files for i18n support.

Also applies to: 22-22, 29-29

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/orgcard.tsx` at line 20, The hardcoded user-facing labels in
the OrgCard component (e.g., the JSX lines rendering "Followers:", "Public
Repositories:" and "Visit GitHub Profile") must be externalized for i18n;
replace those literal strings in the OrgCard (component/function name: OrgCard
or OrganizationCard where it renders organization.followers,
organization.public_repos and the GitHub link) with lookups to the localization
resource (e.g., import a locale/strings object or use the app's t() translator)
and update the JSX to use those keys (followers, publicRepositories,
visitGitHubProfile), ensuring the organization props remain unchanged.


<p>Public Repositories: {organization.public_repos}</p>

<a
href={organization.html_url}
target="_blank"
rel="noreferrer"
>
Visit GitHub Profile
</a>
</div>
)
}

export default OrgCard
35 changes: 35 additions & 0 deletions src/components/searchbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { useState } from 'react'

interface SearchBarProps {
onSearch: (orgName: string) => void
}

function SearchBar({ onSearch }: SearchBarProps) {
const [input, setInput] = useState('')

function handleSubmit(event: React.FormEvent) {
event.preventDefault()

if (!input.trim()) {
return
}

onSearch(input)
setInput('')
}

return (
<form onSubmit={handleSubmit}>
<input
type="text"
placeholder="Enter GitHub organization"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Externalize user-facing strings for internationalization.

The placeholder text and button label are hardcoded. As per coding guidelines, user-visible strings should be externalized to resource files for i18n support.

Consider using an i18n library like react-i18next or externalizing these strings to a constants/localization file.

Also applies to: 30-30

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/serachbar.tsx` at line 25, The hardcoded user-facing strings
in the SearchBar component (placeholder="Enter GitHub organization" and the
button label) must be externalized for i18n; add a localization
resource/constant (or use react-i18next) and replace the literal placeholder and
button text in the serachbar.tsx component with references to those localized
keys (e.g., t('search.placeholder') or LOCAL_STRINGS.SEARCH_PLACEHOLDER) and
ensure the component imports and uses the localization helper (hook or
constants) so both the input placeholder and the button label are driven from
the resource file.

value={input}
onChange={(event) => setInput(event.target.value)}
/>

<button type="submit">Search</button>
</form>
)
}

export default SearchBar
Comment thread
coderabbitai[bot] marked this conversation as resolved.
22 changes: 9 additions & 13 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
:root {
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;

color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;

font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: Arial, sans-serif;
background-color: #111;
color: white;
}
3 changes: 2 additions & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'

import './index.css'
import App from './App.tsx'

createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
)
)
Loading
Loading