Update ConnectionsTab.tsx
Browse files
app/components/settings/connections/ConnectionsTab.tsx
CHANGED
|
@@ -75,13 +75,13 @@ export default function ConnectionsTab() {
|
|
| 75 |
|
| 76 |
if (!reposResponse.ok) throw new Error('Failed to fetch repositories');
|
| 77 |
|
| 78 |
-
const repos = await reposResponse.json() as GitHubRepoInfo[];
|
| 79 |
|
| 80 |
// Calculate total stats
|
| 81 |
const totalStars = repos.reduce((acc, repo) => acc + repo.stargazers_count, 0);
|
| 82 |
const totalForks = repos.reduce((acc, repo) => acc + repo.forks_count, 0);
|
| 83 |
|
| 84 |
-
setConnection(prev => ({
|
| 85 |
...prev,
|
| 86 |
stats: {
|
| 87 |
repos,
|
|
@@ -89,7 +89,6 @@ export default function ConnectionsTab() {
|
|
| 89 |
totalForks,
|
| 90 |
},
|
| 91 |
}));
|
| 92 |
-
|
| 93 |
} catch (error) {
|
| 94 |
logStore.logError('Failed to fetch GitHub stats', { error });
|
| 95 |
toast.error('Failed to fetch GitHub statistics');
|
|
@@ -110,7 +109,7 @@ export default function ConnectionsTab() {
|
|
| 110 |
|
| 111 |
if (!response.ok) throw new Error('Invalid token or unauthorized');
|
| 112 |
|
| 113 |
-
const data = await response.json() as GitHubUserResponse;
|
| 114 |
const newConnection = { user: data, token };
|
| 115 |
|
| 116 |
// Save connection
|
|
@@ -290,9 +289,7 @@ export default function ConnectionsTab() {
|
|
| 290 |
</div>
|
| 291 |
</div>
|
| 292 |
|
| 293 |
-
<h4 className="text-sm font-medium text-bolt-elements-textPrimary mb-3">
|
| 294 |
-
Recent Repositories
|
| 295 |
-
</h4>
|
| 296 |
<div className="space-y-3">
|
| 297 |
{connection.stats.repos.map((repo) => (
|
| 298 |
<a
|
|
@@ -304,13 +301,9 @@ export default function ConnectionsTab() {
|
|
| 304 |
>
|
| 305 |
<div className="flex items-center justify-between">
|
| 306 |
<div>
|
| 307 |
-
<h5 className="text-sm font-medium text-bolt-elements-textPrimary">
|
| 308 |
-
{repo.name}
|
| 309 |
-
</h5>
|
| 310 |
{repo.description && (
|
| 311 |
-
<p className="text-xs text-bolt-elements-textSecondary mt-1">
|
| 312 |
-
{repo.description}
|
| 313 |
-
</p>
|
| 314 |
)}
|
| 315 |
</div>
|
| 316 |
<div className="flex items-center gap-3 text-xs text-bolt-elements-textSecondary">
|
|
|
|
| 75 |
|
| 76 |
if (!reposResponse.ok) throw new Error('Failed to fetch repositories');
|
| 77 |
|
| 78 |
+
const repos = (await reposResponse.json()) as GitHubRepoInfo[];
|
| 79 |
|
| 80 |
// Calculate total stats
|
| 81 |
const totalStars = repos.reduce((acc, repo) => acc + repo.stargazers_count, 0);
|
| 82 |
const totalForks = repos.reduce((acc, repo) => acc + repo.forks_count, 0);
|
| 83 |
|
| 84 |
+
setConnection((prev) => ({
|
| 85 |
...prev,
|
| 86 |
stats: {
|
| 87 |
repos,
|
|
|
|
| 89 |
totalForks,
|
| 90 |
},
|
| 91 |
}));
|
|
|
|
| 92 |
} catch (error) {
|
| 93 |
logStore.logError('Failed to fetch GitHub stats', { error });
|
| 94 |
toast.error('Failed to fetch GitHub statistics');
|
|
|
|
| 109 |
|
| 110 |
if (!response.ok) throw new Error('Invalid token or unauthorized');
|
| 111 |
|
| 112 |
+
const data = (await response.json()) as GitHubUserResponse;
|
| 113 |
const newConnection = { user: data, token };
|
| 114 |
|
| 115 |
// Save connection
|
|
|
|
| 289 |
</div>
|
| 290 |
</div>
|
| 291 |
|
| 292 |
+
<h4 className="text-sm font-medium text-bolt-elements-textPrimary mb-3">Recent Repositories</h4>
|
|
|
|
|
|
|
| 293 |
<div className="space-y-3">
|
| 294 |
{connection.stats.repos.map((repo) => (
|
| 295 |
<a
|
|
|
|
| 301 |
>
|
| 302 |
<div className="flex items-center justify-between">
|
| 303 |
<div>
|
| 304 |
+
<h5 className="text-sm font-medium text-bolt-elements-textPrimary">{repo.name}</h5>
|
|
|
|
|
|
|
| 305 |
{repo.description && (
|
| 306 |
+
<p className="text-xs text-bolt-elements-textSecondary mt-1">{repo.description}</p>
|
|
|
|
|
|
|
| 307 |
)}
|
| 308 |
</div>
|
| 309 |
<div className="flex items-center gap-3 text-xs text-bolt-elements-textSecondary">
|