Apple design (plans/gtm/APPLE-DESIGN-RULES-2026-11-17.md): rewrote theme tokens in globals.css/tailwind.config.js to neutral black/white + one accent (#0071E3), replacing the GitHub-dark blue+green dual-accent theme; mechanically swept every raw inline hex/rgba literal across app/components that bypassed the CSS vars (506 hex + 326 rgb(a) replacements) since most of the app hardcoded colors rather than using tokens; removed all emoji, decorative gradients (Tailwind bg-gradient-to-* and raw linear/radial- gradient() in inline styles), confetti, and glow/blur decorative orbs; converted Navbar/Navigation to icon-only with aria-label+title. Finished two stopped agents' in-progress work: deleted the fake AnimatedStats/ LiveActivity/ProjectShowcase/Testimonials auth-panel components and cleaned up the emoji-laden feature list in (auth)/layout.tsx. Removed remaining fabricated stats (topics/topics/[slug] posts-per-week/ contributors/followers) per the no-fake-numbers rule. Rithub sign-in: added "Continue with Rithub" as an icon-only OAuth2 button (RithubMark component) on login/register, hidden "Continue with GitHub" when GITHUB_CLIENT_ID is unset (confirmed unset in prod). Backend: authenticateWithGitea in oauthService.ts exchanges the Gitea OAuth2 code, resolves identity via the existing ForgeConnection table (no schema migration needed), issues the same JWT/session as GitHub/Google login. OAuth2 app created live on rithub.dev via its REST API as admin user caelum0x; client id/secret stored in railyard-box's compose file (env files don't ship to the runtime image, so the actual wiring lives in docker-compose.yml, not backend/.env) and in ~/products/.env. Critical bug found and fixed while verifying: services/api.ts's global 401 interceptor redirected every anonymous visitor to /login a couple seconds after ANY page load -- including /login and /register themselves -- because the AuthBootstrap's background GET /auth/me (expected to 401 for signed-out visitors) was treated the same as a real session-expiry 401, triggering a refresh attempt, another 401, and a hard window.location.href redirect, which re-ran AuthBootstrap and repeated. Fixed by excluding /auth/me and /auth/refresh from that redirect path. Verified live with a fresh, cookie-less browser: previously looped /register -> /login forever; now stable after 6s. Also fixed: production CORS/API origin mismatch -- the frontend was built with NEXT_PUBLIC_API_URL pointing at ritgram.ereboslab.com while served from ritgram.rithub.dev, so every API call (login, register, etc.) was blocked by CORS; rebuilt with rithub.dev as canonical and CORS_ORIGIN allowing both domains. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
105 lines
3.1 KiB
TypeScript
105 lines
3.1 KiB
TypeScript
'use client';
|
|
|
|
import { useState } from 'react';
|
|
import Link from 'next/link';
|
|
import { repoService } from '@/services/repoService';
|
|
import { buildRepoPath } from '@/utils/repositoryRouting';
|
|
import RepoTextQuickActions from '@/components/repo/RepoTextQuickActions';
|
|
import { forgeBadgeText } from '@/lib/forge';
|
|
|
|
interface RepoCardProps {
|
|
repo: {
|
|
id: string;
|
|
owner: string;
|
|
name: string;
|
|
fullName: string;
|
|
description?: string;
|
|
stars: number;
|
|
forks: number;
|
|
language?: string;
|
|
isFollowing?: boolean;
|
|
/** Which forge this repo lives on — 'github' (default) or 'gitea' (Rithub). */
|
|
forge?: string;
|
|
};
|
|
}
|
|
|
|
export default function RepoCard({ repo }: RepoCardProps) {
|
|
const [isFollowing, setIsFollowing] = useState(repo.isFollowing || false);
|
|
const badgeText = forgeBadgeText(repo.forge);
|
|
|
|
const handleFollow = async (e: React.MouseEvent) => {
|
|
e.preventDefault();
|
|
try {
|
|
if (isFollowing) {
|
|
await repoService.unfollow(repo.owner, repo.name);
|
|
} else {
|
|
await repoService.follow(repo.owner, repo.name);
|
|
}
|
|
setIsFollowing(!isFollowing);
|
|
} catch (err) {
|
|
console.error('Follow error', err);
|
|
}
|
|
};
|
|
|
|
const handleShare = async (e: React.MouseEvent) => {
|
|
e.preventDefault();
|
|
try {
|
|
await repoService.shareRepo(repo.owner, repo.name);
|
|
} catch (err) {
|
|
console.error('Share error', err);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<div className="bg-white dark:bg-gray-800 rounded-lg p-4 border border-gray-200 dark:border-gray-700 hover:border-primary transition">
|
|
<div className="flex items-center gap-3">
|
|
<div className="w-11 h-11 rounded-full bg-primary flex items-center justify-center text-xl">
|
|
|
|
</div>
|
|
<div className="flex-1 min-w-0">
|
|
<div className="flex items-center gap-2">
|
|
<Link href={buildRepoPath(repo.owner, repo.name)} className="font-semibold hover:underline">
|
|
{repo.fullName}
|
|
</Link>
|
|
{badgeText && (
|
|
<span className="shrink-0 px-2 py-0.5 rounded-full text-[11px] font-medium bg-emerald-50 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300 border border-emerald-200 dark:border-emerald-800">
|
|
{badgeText}
|
|
</span>
|
|
)}
|
|
</div>
|
|
{repo.description && (
|
|
<p className="text-sm text-gray-500 truncate">{repo.description}</p>
|
|
)}
|
|
</div>
|
|
<button
|
|
onClick={handleFollow}
|
|
className={`px-4 py-2 rounded-lg text-sm font-medium ${
|
|
isFollowing
|
|
? 'bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200'
|
|
: 'bg-blue-500 text-white hover:bg-blue-600'
|
|
}`}
|
|
>
|
|
{isFollowing ? 'Following' : 'Follow'}
|
|
</button>
|
|
</div>
|
|
<div className="flex gap-4 mt-3 pt-3 border-t border-gray-100 dark:border-gray-700 text-sm text-gray-500">
|
|
<span> {repo.stars >= 1000 ? `${(repo.stars/1000).toFixed(0)}k` : repo.stars}</span>
|
|
<span> {repo.forks >= 1000 ? `${(repo.forks/1000).toFixed(0)}k` : repo.forks}</span>
|
|
{repo.language && <span> {repo.language}</span>}
|
|
<RepoTextQuickActions
|
|
owner={repo.owner}
|
|
name={repo.name}
|
|
className="ml-auto"
|
|
buttonClassName="border-gray-200 bg-gray-50 text-gray-600 hover:border-blue-300 hover:text-blue-600 dark:border-gray-600 dark:bg-gray-700/60 dark:text-gray-300 dark:hover:border-blue-400 dark:hover:text-blue-300"
|
|
/>
|
|
<button
|
|
onClick={handleShare}
|
|
className="hover:text-blue-500"
|
|
>
|
|
|
|
</button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|