algospaced-dsa / algospaced-ui /src /components /GitHubSyncWindow.tsx
iamfebin's picture
feat: GitHub solutions sync, auto-commit, and journey review navigation fixes
7676842
Raw History Blame Contribute Delete
29.7 kB
import React, { useState, useEffect } from 'react';
import {
GitBranch,
GitCommit,
FolderGit2,
CheckCircle2,
AlertCircle,
ExternalLink,
RefreshCw,
Eye,
EyeOff,
LogOut,
UploadCloud,
Check,
Zap,
} from 'lucide-react';
import {
getGitHubConfig,
getStoredGitHubUser,
saveGitHubConfig,
clearGitHubConfig,
connectWithGitHubOAuth,
verifyGitHubToken,
initGitHubRepo,
syncAllSolutionsToGitHub,
pushSolutionToGitHub,
} from '../services/githubSyncService';
import type { GitHubConfig, GitHubUser, PushSolutionPayload } from '../types/githubTypes';
interface GitHubSyncWindowProps {
onClose: () => void;
currentProblem?: {
id?: string;
problem_number?: number | null;
name?: string;
difficulty?: string;
pattern?: string;
optimal_time?: string;
optimal_space?: string;
description?: string;
reference_code?: string;
code?: string;
} | null;
}
export const GitHubSyncWindow: React.FC<GitHubSyncWindowProps> = ({
onClose,
currentProblem,
}) => {
const [config, setConfig] = useState<GitHubConfig>(() => getGitHubConfig());
const [user, setUser] = useState<GitHubUser | null>(() => getStoredGitHubUser());
const [manualToken, setManualToken] = useState('');
const [showManualInput, setShowManualInput] = useState(false);
const [showToken, setShowToken] = useState(false);
// States
const [connectingOAuth, setConnectingOAuth] = useState(false);
const [verifyingToken, setVerifyingToken] = useState(false);
const [initializingRepo, setInitializingRepo] = useState(false);
const [syncingAll, setSyncingAll] = useState(false);
const [pushingCurrent, setPushingCurrent] = useState(false);
const [statusMessage, setStatusMessage] = useState<{
type: 'success' | 'error' | 'info';
text: string;
linkUrl?: string;
} | null>(null);
const isConnected = Boolean(config.token && (config.username || user?.login));
// Sync state if user changes
useEffect(() => {
if (config.token && !user) {
void verifyGitHubToken(config.token).then((res) => {
if (res.valid && res.user) {
setUser(res.user);
saveGitHubConfig({ username: res.user.login }, res.user);
}
});
}
}, [config.token, user]);
const handleOAuthConnect = async () => {
setConnectingOAuth(true);
setStatusMessage(null);
try {
const { token, user: ghUser } = await connectWithGitHubOAuth();
setUser(ghUser);
const updatedConfig = getGitHubConfig();
setConfig(updatedConfig);
// Auto-initialize repository if not created
try {
await initGitHubRepo(token, updatedConfig.repoName, updatedConfig.isPrivate);
} catch {
// Safe fallback if repo check times out
}
setStatusMessage({
type: 'success',
text: `Connected successfully to GitHub as @${ghUser.login}!`,
linkUrl: ghUser.html_url,
});
} catch (err: unknown) {
const error = err as Error;
setStatusMessage({
type: 'error',
text: error.message || 'GitHub OAuth authorization failed.',
});
} finally {
setConnectingOAuth(false);
}
};
const handleManualTokenSubmit = async () => {
const trimmed = manualToken.trim();
if (!trimmed) {
setStatusMessage({ type: 'error', text: 'Please enter a valid GitHub token.' });
return;
}
setVerifyingToken(true);
setStatusMessage(null);
try {
const res = await verifyGitHubToken(trimmed);
if (res.valid && res.user) {
setUser(res.user);
saveGitHubConfig(
{
token: trimmed,
username: res.user.login,
},
res.user
);
setConfig(getGitHubConfig());
// Initialize repository
try {
await initGitHubRepo(trimmed, config.repoName, config.isPrivate);
} catch {
// Ignore
}
setManualToken('');
setShowManualInput(false);
setStatusMessage({
type: 'success',
text: `Verified and connected as @${res.user.login}!`,
linkUrl: res.user.html_url,
});
} else {
setStatusMessage({
type: 'error',
text: res.error || 'Token verification failed. Please check permissions.',
});
}
} catch (err: unknown) {
const error = err as Error;
setStatusMessage({
type: 'error',
text: error.message || 'Failed to connect with token.',
});
} finally {
setVerifyingToken(false);
}
};
const handleInitRepo = async () => {
if (!config.token) return;
setInitializingRepo(true);
setStatusMessage(null);
try {
const res = await initGitHubRepo(config.token, config.repoName, config.isPrivate);
saveGitHubConfig({ repoName: config.repoName });
setStatusMessage({
type: 'success',
text: res.created
? `Created new repository ${res.full_name} on GitHub!`
: `Connected to existing repository ${res.full_name}!`,
linkUrl: res.html_url,
});
} catch (err: unknown) {
const error = err as Error;
setStatusMessage({
type: 'error',
text: error.message || 'Failed to initialize repository.',
});
} finally {
setInitializingRepo(false);
}
};
const handleSyncAll = async () => {
if (!config.token || !config.repoName) return;
setSyncingAll(true);
setStatusMessage(null);
try {
const res = await syncAllSolutionsToGitHub(config.token, config.repoName, config.branch);
setStatusMessage({
type: 'success',
text: res.message || `Synced ${res.synced_count} solutions to ${config.repoName}!`,
linkUrl: res.repo_url,
});
} catch (err: unknown) {
const error = err as Error;
setStatusMessage({
type: 'error',
text: error.message || 'Batch sync failed.',
});
} finally {
setSyncingAll(false);
}
};
const handlePushCurrent = async () => {
if (!currentProblem || !config.token) return;
const code = currentProblem.code || currentProblem.reference_code;
if (!code || !code.trim()) {
setStatusMessage({
type: 'error',
text: 'Current problem has no code to push. Write or save code first!',
});
return;
}
setPushingCurrent(true);
setStatusMessage(null);
try {
const payload: PushSolutionPayload = {
token: config.token,
repo: config.repoName,
branch: config.branch,
problem_number: currentProblem.problem_number,
problem_name: currentProblem.name || 'Algorithm Problem',
difficulty: currentProblem.difficulty || 'Medium',
pattern: currentProblem.pattern || 'Algorithms',
optimal_time: currentProblem.optimal_time || 'O(N)',
optimal_space: currentProblem.optimal_space || 'O(1)',
description: currentProblem.description || '',
code,
};
const res = await pushSolutionToGitHub(payload);
setStatusMessage({
type: 'success',
text: `Committed ${currentProblem.name} to GitHub!`,
linkUrl: res.html_url,
});
} catch (err: unknown) {
const error = err as Error;
setStatusMessage({
type: 'error',
text: error.message || 'Failed to push current solution.',
});
} finally {
setPushingCurrent(false);
}
};
const handleToggleAutoCommit = (enabled: boolean) => {
saveGitHubConfig({ autoCommit: enabled });
setConfig((prev) => ({ ...prev, autoCommit: enabled }));
setStatusMessage({
type: 'info',
text: enabled
? 'Auto-commit ENABLED: Solutions will sync automatically on submission.'
: 'Auto-commit DISABLED: You can still push manually any time.',
});
};
const handleDisconnect = () => {
if (window.confirm('Disconnect your GitHub account from AlgoSpaced?')) {
clearGitHubConfig();
setConfig(getGitHubConfig());
setUser(null);
setStatusMessage({ type: 'info', text: 'Disconnected from GitHub.' });
}
};
return (
<div className="w-full h-full bg-[#fdf8e1] p-4 sm:p-6 flex flex-col justify-between select-none font-sans text-ink-black overflow-y-auto custom-scrollbar">
<div className="space-y-4">
{/* Header Strip */}
<div className="flex items-center justify-between border-b-[3px] border-ink-black pb-3">
<div className="flex items-center gap-3">
<div className="w-9 h-9 bg-ink-black rounded border-2 border-ink-black flex items-center justify-center text-white shadow-[2px_2px_0px_0px_rgba(0,0,0,0.15)]">
<svg className="w-5 h-5 fill-white" viewBox="0 0 19 19">
<path
fillRule="evenodd"
d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844"
clipRule="evenodd"
/>
</svg>
</div>
<div>
<h3 className="font-headline-md font-bold text-sm uppercase m-0 flex items-center gap-2">
GitHub Solutions Station
</h3>
<p className="text-[11px] text-trash-gray font-semibold m-0">
Sync algorithm solutions &amp; auto-commit to your personal portfolio repository
</p>
</div>
</div>
<div className="flex items-center gap-2">
<span
className={`px-2.5 py-1 text-[9px] font-bold font-arcade uppercase border-2 border-ink-black ${
isConnected
? 'bg-emerald-300 text-emerald-950'
: 'bg-amber-200 text-amber-950'
}`}
>
{isConnected ? 'CONNECTED' : 'DISCONNECTED'}
</span>
</div>
</div>
{/* CONNECTED VIEW */}
{isConnected ? (
<div className="space-y-4">
{/* User Profile & Repo Banner */}
<div className="bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3">
<div className="flex items-center gap-3">
{user?.avatar_url ? (
<img
src={user.avatar_url}
alt={user.login}
className="w-10 h-10 rounded-full border-2 border-ink-black shadow-[1px_1px_0px_0px_#1E293B]"
/>
) : (
<div className="w-10 h-10 bg-slate-200 rounded-full border-2 border-ink-black flex items-center justify-center font-bold">
GH
</div>
)}
<div>
<div className="flex items-center gap-1.5">
<span className="font-bold text-xs text-ink-black">
{user?.name || user?.login || config.username}
</span>
<span className="text-[10px] text-trash-gray font-mono">
(@{user?.login || config.username})
</span>
</div>
<div className="text-[11px] text-slate-600 font-medium flex items-center gap-1 mt-0.5">
<FolderGit2 className="w-3.5 h-3.5 text-blue-600 shrink-0" />
<span className="font-semibold text-ink-black">
{config.username || user?.login}/{config.repoName}
</span>
<span className="text-slate-400">({config.branch})</span>
</div>
</div>
</div>
<div className="flex items-center gap-2">
<a
href={`https://github.com/${config.username || user?.login}/${config.repoName}`}
target="_blank"
rel="noopener noreferrer"
className="px-3 py-1.5 bg-slate-50 hover:bg-slate-100 border-2 border-ink-black text-xs font-bold text-ink-black flex items-center gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none no-underline cursor-pointer"
>
<ExternalLink className="w-3.5 h-3.5" />
<span>View Repo</span>
</a>
<button
onClick={handleDisconnect}
className="px-3 py-1.5 bg-white hover:bg-rose-50 border-2 border-rose-300 text-rose-700 text-xs font-bold flex items-center gap-1 cursor-pointer transition-all"
title="Disconnect GitHub"
>
<LogOut className="w-3 h-3" />
<span>Disconnect</span>
</button>
</div>
</div>
{/* Repository Configuration Card */}
<div className="bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] space-y-3">
<div className="flex items-center justify-between border-b pb-2 border-slate-200">
<span className="font-headline-md font-bold text-xs uppercase text-ink-black flex items-center gap-1.5">
<GitBranch className="w-3.5 h-3.5 text-ink-black" />
Target Repository &amp; Branch
</span>
<button
onClick={handleInitRepo}
disabled={initializingRepo}
className="px-2.5 py-1 bg-yellow-100 hover:bg-yellow-200 border border-ink-black text-[10px] font-bold text-ink-black flex items-center gap-1 cursor-pointer disabled:opacity-50 shadow-[1px_1px_0px_0px_#1E293B]"
>
{initializingRepo ? (
<RefreshCw className="w-3 h-3 animate-spin" />
) : (
<Check className="w-3 h-3 text-emerald-700" />
)}
<span>Verify / Init Repo</span>
</button>
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div>
<label className="block text-[10px] font-bold text-trash-gray uppercase mb-1">
Repository Name
</label>
<input
type="text"
value={config.repoName}
onChange={(e) => {
const val = e.target.value;
setConfig((p) => ({ ...p, repoName: val }));
saveGitHubConfig({ repoName: val });
}}
placeholder="algospaced-solutions"
className="w-full bg-slate-50 border-2 border-ink-black rounded py-1.5 px-2.5 text-xs font-mono font-medium focus:outline-none focus:bg-white"
/>
</div>
<div>
<label className="block text-[10px] font-bold text-trash-gray uppercase mb-1">
Branch Name
</label>
<input
type="text"
value={config.branch}
onChange={(e) => {
const val = e.target.value;
setConfig((p) => ({ ...p, branch: val }));
saveGitHubConfig({ branch: val });
}}
placeholder="main"
className="w-full bg-slate-50 border-2 border-ink-black rounded py-1.5 px-2.5 text-xs font-mono font-medium focus:outline-none focus:bg-white"
/>
</div>
</div>
{/* Auto-Commit Toggle */}
<div className="pt-2 border-t border-slate-100 flex items-center justify-between">
<div className="flex items-start gap-2.5">
<Zap className="w-4 h-4 text-amber-500 shrink-0 mt-0.5" />
<div>
<span className="text-xs font-bold text-ink-black block">
Auto-commit on every submission
</span>
<span className="text-[10px] text-trash-gray font-medium">
Automatically push code to your repo when grading a review card or saving a solution.
</span>
</div>
</div>
<label className="relative inline-flex items-center cursor-pointer select-none">
<input
type="checkbox"
checked={config.autoCommit}
onChange={(e) => handleToggleAutoCommit(e.target.checked)}
className="sr-only peer"
/>
<div className="w-9 h-5 bg-slate-300 peer-focus:outline-none border-2 border-ink-black rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-2 after:border-ink-black after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-emerald-500"></div>
</label>
</div>
</div>
{/* Sync & Push Operations Card */}
<div className="bg-[#fffdf0] border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] space-y-3">
<span className="font-headline-md font-bold text-xs uppercase text-ink-black flex items-center gap-1.5">
<UploadCloud className="w-3.5 h-3.5 text-ink-black" />
Manual Push &amp; Sync Operations
</span>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
{/* Push Current Problem */}
<button
onClick={handlePushCurrent}
disabled={pushingCurrent || !currentProblem}
className="p-3 bg-white hover:bg-emerald-50 border-2 border-ink-black text-left flex flex-col justify-between gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer transition-all disabled:opacity-50"
>
<div className="flex items-center justify-between w-full">
<span className="font-bold text-xs text-ink-black font-headline-md flex items-center gap-1.5">
{pushingCurrent ? (
<RefreshCw className="w-3.5 h-3.5 animate-spin text-emerald-600" />
) : (
<GitCommit className="w-3.5 h-3.5 text-emerald-600" />
)}
Push Active Problem
</span>
{currentProblem?.problem_number && (
<span className="text-[9px] font-mono px-1.5 py-0.5 bg-emerald-100 text-emerald-800 rounded font-bold">
#{currentProblem.problem_number}
</span>
)}
</div>
<span className="text-[10px] text-slate-500 line-clamp-1">
{currentProblem?.name || 'No active problem open in review'}
</span>
</button>
{/* Batch Sync Entire Library */}
<button
onClick={handleSyncAll}
disabled={syncingAll}
className="p-3 bg-[#ffe24c] hover:bg-yellow-300 border-2 border-ink-black text-left flex flex-col justify-between gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer transition-all disabled:opacity-50"
>
<div className="flex items-center justify-between w-full">
<span className="font-bold text-xs text-ink-black font-headline-md flex items-center gap-1.5">
{syncingAll ? (
<RefreshCw className="w-3.5 h-3.5 animate-spin text-ink-black" />
) : (
<FolderGit2 className="w-3.5 h-3.5 text-ink-black" />
)}
Sync Entire Library
</span>
<span className="text-[8px] font-arcade uppercase font-bold bg-white px-1.5 py-0.5 border border-ink-black">
BATCH
</span>
</div>
<span className="text-[10px] text-slate-700">
Push all solved problems + generate root README index
</span>
</button>
</div>
</div>
</div>
) : (
/* DISCONNECTED VIEW */
<div className="space-y-4">
{/* 1-Click Connect Button Card */}
<div className="bg-white border-[3px] border-ink-black p-5 sm:p-6 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] text-center space-y-4">
<div className="max-w-md mx-auto space-y-2">
<h4 className="font-headline-md font-bold text-sm uppercase text-ink-black m-0">
Connect Your GitHub Account
</h4>
<p className="text-xs text-trash-gray font-medium leading-relaxed m-0">
Sync all your DSA solutions directly to your GitHub repository. Commit automatically on review completion or push anytime with 1-click.
</p>
</div>
{/* Native OAuth Button */}
<div className="pt-2 flex flex-col items-center">
<button
onClick={handleOAuthConnect}
disabled={connectingOAuth}
className="w-full sm:w-auto px-6 py-3 bg-[#24292e] hover:bg-black text-white font-bold text-xs uppercase font-headline-md border-[3px] border-ink-black shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none flex items-center justify-center gap-2.5 transition-all cursor-pointer disabled:opacity-50"
>
{connectingOAuth ? (
<>
<RefreshCw className="w-4 h-4 animate-spin text-yellow-300" />
<span>AUTHORIZING WITH GITHUB...</span>
</>
) : (
<>
<svg className="w-4 h-4 fill-white" viewBox="0 0 19 19">
<path
fillRule="evenodd"
d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844"
clipRule="evenodd"
/>
</svg>
<span>CONNECT WITH GITHUB (1-CLICK)</span>
</>
)}
</button>
<span className="text-[10px] text-trash-gray mt-2">
Direct 1-click OAuth (works for guest and signed-in users). Requests <code>repo</code> access.
</span>
</div>
</div>
{/* Manual Token Fallback Accordion */}
<div className="bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)]">
<button
type="button"
onClick={() => setShowManualInput(!showManualInput)}
className="w-full flex items-center justify-between text-left text-xs font-bold text-ink-black font-headline-md uppercase cursor-pointer bg-transparent border-0 p-0"
>
<span>Or connect via Personal Access Token (PAT)</span>
<span className="text-slate-500">{showManualInput ? '▲ Hide' : '▼ Show'}</span>
</button>
{showManualInput && (
<div className="mt-3 pt-3 border-t border-slate-200 space-y-3">
<div className="flex items-center justify-between text-[11px]">
<span className="font-semibold text-slate-700">Personal Access Token:</span>
<a
href="https://github.com/settings/tokens/new?scopes=repo&description=AlgoSpaced%20Solutions%20Sync"
target="_blank"
rel="noopener noreferrer"
className="text-blue-600 hover:text-blue-800 font-bold flex items-center gap-1 no-underline text-[10px]"
>
<span>Generate token with repo scope</span>
<ExternalLink className="w-3 h-3" />
</a>
</div>
<div className="relative">
<input
type={showToken ? 'text' : 'password'}
value={manualToken}
onChange={(e) => setManualToken(e.target.value)}
placeholder="ghp_... or github_pat_..."
className="w-full bg-slate-50 border-2 border-ink-black rounded py-2 pl-3 pr-9 text-xs font-mono focus:outline-none focus:bg-white"
/>
<button
type="button"
onClick={() => setShowToken(!showToken)}
className="absolute right-2.5 top-1/2 -translate-y-1/2 text-slate-400 hover:text-ink-black cursor-pointer bg-transparent border-0 p-1"
>
{showToken ? <EyeOff className="w-3.5 h-3.5" /> : <Eye className="w-3.5 h-3.5" />}
</button>
</div>
<button
onClick={handleManualTokenSubmit}
disabled={verifyingToken || !manualToken.trim()}
className="px-4 py-2 bg-[#ffe24c] hover:bg-yellow-300 text-ink-black font-bold text-xs uppercase border-2 border-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer disabled:opacity-50 flex items-center gap-1.5"
>
{verifyingToken ? (
<>
<RefreshCw className="w-3.5 h-3.5 animate-spin" />
<span>VERIFYING TOKEN...</span>
</>
) : (
<>
<Check className="w-3.5 h-3.5" />
<span>SAVE &amp; CONNECT TOKEN</span>
</>
)}
</button>
</div>
)}
</div>
</div>
)}
{/* Feedback Alert Banner */}
{statusMessage && (
<div
className={`p-3 border-[2px] border-ink-black text-xs font-semibold rounded flex items-center justify-between gap-2 ${
statusMessage.type === 'success'
? 'bg-emerald-100 text-emerald-900 border-emerald-600'
: statusMessage.type === 'error'
? 'bg-rose-100 text-rose-900 border-rose-600'
: 'bg-sky-100 text-sky-900 border-sky-600'
}`}
>
<div className="flex items-center gap-2">
{statusMessage.type === 'success' ? (
<CheckCircle2 className="w-4 h-4 shrink-0" />
) : (
<AlertCircle className="w-4 h-4 shrink-0" />
)}
<span>{statusMessage.text}</span>
</div>
{statusMessage.linkUrl && (
<a
href={statusMessage.linkUrl}
target="_blank"
rel="noopener noreferrer"
className="px-2 py-0.5 bg-white border border-ink-black text-[10px] font-bold text-ink-black hover:bg-slate-50 no-underline shrink-0 flex items-center gap-1"
>
<span>Open</span>
<ExternalLink className="w-3 h-3" />
</a>
)}
</div>
)}
</div>
{/* Footer Close Button */}
<div className="pt-4 border-t border-slate-300 flex justify-end">
<button
onClick={onClose}
className="px-4 py-2 bg-white hover:bg-slate-100 border-[2px] border-ink-black text-xs font-bold text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer uppercase"
>
CLOSE
</button>
</div>
</div>
);
};
export default GitHubSyncWindow;