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, HardDrive, FileCode2 } from "lucide-react"; import type { GitHubConfig, MirrorOptions, AdvancedOptions, DuplicateNameStrategy } from "@/types/config"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; 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 | string) => { onGitHubConfigChange({ ...githubConfig, [field]: value }); }; const handleMirrorChange = (field: keyof MirrorOptions, value: boolean | number) => { 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.starredCodeOnly && mirrorOptions.mirrorReleases, issues: !advancedOptions.starredCodeOnly && mirrorOptions.mirrorMetadata && mirrorOptions.metadataComponents.issues, pullRequests: !advancedOptions.starredCodeOnly && mirrorOptions.mirrorMetadata && mirrorOptions.metadataComponents.pullRequests, wiki: !advancedOptions.starredCodeOnly && 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 (
Choose which repositories to include in mirroring
Mirror your private repositories
Include repositories you've starred on GitHub
Choose what content to mirror from starred repositories. Selecting "Lightweight mode" will only mirror code for better performance.
Content included for starred repos:
To include more content, enable them in the Content & Data section below
When disabled, starred repos are imported for browsing but not automatically mirrored. You can still mirror individual repos manually.
Name collision strategy
How to handle repos with the same name from different owners
Select what content to mirror from each repository
Source code & branches
Always included
Include GitHub releases, tags, and associated assets
Mirror Git LFS objects. Requires LFS to be enabled on your Gitea server and Git v2.1.2+
Mirror issues, pull requests, and other repository data
Fine-tune what gets excluded from mirroring
Exclude repositories that are forks of other projects