import React from "react"; import { Checkbox } from "@/components/ui/checkbox"; import { Label } from "@/components/ui/label"; import { Separator } from "@/components/ui/separator"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; import { Info, GitBranch, Star, Lock, Archive, GitPullRequest, Tag, FileText, MessageSquare, Target, BookOpen, GitFork, ChevronDown, Funnel } from "lucide-react"; import type { GitHubConfig, MirrorOptions, AdvancedOptions } from "@/types/config"; import { cn } from "@/lib/utils"; interface GitHubMirrorSettingsProps { githubConfig: GitHubConfig; mirrorOptions: MirrorOptions; advancedOptions: AdvancedOptions; onGitHubConfigChange: (config: GitHubConfig) => void; onMirrorOptionsChange: (options: MirrorOptions) => void; onAdvancedOptionsChange: (options: AdvancedOptions) => void; } export function GitHubMirrorSettings({ githubConfig, mirrorOptions, advancedOptions, onGitHubConfigChange, onMirrorOptionsChange, onAdvancedOptionsChange, }: GitHubMirrorSettingsProps) { const handleGitHubChange = (field: keyof GitHubConfig, value: boolean) => { onGitHubConfigChange({ ...githubConfig, [field]: value }); }; const handleMirrorChange = (field: keyof MirrorOptions, value: boolean) => { onMirrorOptionsChange({ ...mirrorOptions, [field]: value }); }; const handleMetadataComponentChange = (component: keyof MirrorOptions['metadataComponents'], value: boolean) => { onMirrorOptionsChange({ ...mirrorOptions, metadataComponents: { ...mirrorOptions.metadataComponents, [component]: value, }, }); }; const handleAdvancedChange = (field: keyof AdvancedOptions, value: boolean) => { onAdvancedOptionsChange({ ...advancedOptions, [field]: value }); }; // When metadata is disabled, all components should be disabled const isMetadataEnabled = mirrorOptions.mirrorMetadata; // Calculate what content is included for starred repos const starredRepoContent = { code: true, // Always included releases: !advancedOptions.skipStarredIssues && mirrorOptions.mirrorReleases, issues: !advancedOptions.skipStarredIssues && mirrorOptions.mirrorMetadata && mirrorOptions.metadataComponents.issues, pullRequests: !advancedOptions.skipStarredIssues && mirrorOptions.mirrorMetadata && mirrorOptions.metadataComponents.pullRequests, wiki: !advancedOptions.skipStarredIssues && mirrorOptions.mirrorMetadata && mirrorOptions.metadataComponents.wiki, }; const starredContentCount = Object.entries(starredRepoContent).filter(([key, value]) => key !== 'code' && value).length; const totalStarredOptions = 4; // releases, issues, PRs, wiki return (
{/* Repository Selection Section */}

Repository Selection

Choose which repositories to include in mirroring

handleGitHubChange('privateRepositories', !!checked)} />

Mirror your private repositories

handleGitHubChange('mirrorStarred', !!checked)} />

Include repositories you've starred on GitHub

{/* Starred repos content selection - responsive layout */}
{/* Content & Data Section */}

Content & Data

Select what content to mirror from each repository

{/* Code is always mirrored - shown as info */}

Source code & branches

Always included

Default
handleMirrorChange('mirrorReleases', !!checked)} />

Include GitHub releases, tags, and associated assets

handleMirrorChange('mirrorMetadata', !!checked)} />

Mirror issues, pull requests, and other repository data

{/* Metadata multi-select - responsive layout */}
{/* Filtering & Behavior Section */}

Filtering & Behavior

Fine-tune what gets excluded from mirroring

handleAdvancedChange('skipForks', !!checked)} />

Exclude repositories that are forks of other projects

); }