Skip to content

Commit f86b9f6

Browse files
author
Denys Dinkevych
authored
Update App.tsx
1 parent 9eb471f commit f86b9f6

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

src/App.tsx

+22-23
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
22
import { Github, Heart } from 'lucide-react';
33
import SearchBar from './components/SearchBar';
44
import UserList from './components/UserList';
5-
import { GitHubUser, SearchResults } from './types/github';
5+
import { GitHubUser } from './types/github';
66
import { ThemeProvider, useTheme } from './contexts/ThemeContext';
77
import { ThemeSwitcher } from './components/ThemeSwitcher';
88
import { Octokit } from '@octokit/rest';
@@ -19,10 +19,11 @@ function AppContent() {
1919
const [error, setError] = useState<string | null>(null);
2020
const [loading, setLoading] = useState(false);
2121

22-
// Redirect user to home screen after signing in
22+
// Redirect user to the home screen after logging in
2323
useEffect(() => {
2424
if (isAuthenticated) {
25-
window.history.replaceState({}, document.title, '/'); // Remove code from URL
25+
// Remove the OAuth code from the URL
26+
window.history.replaceState({}, document.title, '/');
2627
}
2728
}, [isAuthenticated]);
2829

@@ -131,25 +132,23 @@ function AppContent() {
131132
searchUsers(page);
132133
};
133134

134-
const renderAuthButton = () => {
135-
return (
136-
<div className="flex flex-col items-end gap-2">
137-
{authError && <div className="text-red-500 text-sm">{authError}</div>}
138-
{!isAuthenticated && (
139-
<button
140-
onClick={login}
141-
className={`px-4 py-2 rounded-md ${
142-
theme === 'dark'
143-
? 'bg-white text-black hover:bg-gray-200'
144-
: 'bg-black text-white hover:bg-gray-800'
145-
}`}
146-
>
147-
Sign in with GitHub
148-
</button>
149-
)}
150-
</div>
151-
);
152-
};
135+
const renderAuthButton = () => (
136+
<div className="flex flex-col items-end gap-2">
137+
{authError && <div className="text-red-500 text-sm">{authError}</div>}
138+
{!isAuthenticated && (
139+
<button
140+
onClick={login}
141+
className={`px-4 py-2 rounded-md ${
142+
theme === 'dark'
143+
? 'bg-white text-black hover:bg-gray-200'
144+
: 'bg-black text-white hover:bg-gray-800'
145+
}`}
146+
>
147+
Sign in with GitHub
148+
</button>
149+
)}
150+
</div>
151+
);
153152

154153
return (
155154
<div className={`min-h-screen flex flex-col ${theme === 'dark' ? 'bg-black' : 'bg-white'}`}>
@@ -166,7 +165,7 @@ function AppContent() {
166165
<h1
167166
className={`text-4xl font-bold ${theme === 'dark' ? 'text-white' : 'text-black'} tracking-tight`}
168167
>
169-
GitHub Bio Search
168+
GitHub User Search
170169
</h1>
171170
</div>
172171
<p className={`text-lg ${theme === 'dark' ? 'text-gray-400' : 'text-gray-600'}`}>

0 commit comments

Comments
 (0)