diff --git a/src/components/config/GitHubConfigForm.tsx b/src/components/config/GitHubConfigForm.tsx index 6d13a20..0e248fb 100644 --- a/src/components/config/GitHubConfigForm.tsx +++ b/src/components/config/GitHubConfigForm.tsx @@ -11,7 +11,7 @@ import { githubApi } from "@/lib/api"; import type { GitHubConfig, MirrorOptions, AdvancedOptions } from "@/types/config"; import { Input } from "../ui/input"; import { toast } from "sonner"; -import { AlertTriangle, Info } from "lucide-react"; +import { Info } from "lucide-react"; import { Alert, AlertDescription } from "../ui/alert"; import { GitHubMirrorSettings } from "./GitHubMirrorSettings"; import { Separator } from "../ui/separator"; diff --git a/src/components/config/OrganizationStrategy.tsx b/src/components/config/OrganizationStrategy.tsx index 453ea94..6215f9a 100644 --- a/src/components/config/OrganizationStrategy.tsx +++ b/src/components/config/OrganizationStrategy.tsx @@ -1,9 +1,9 @@ -import React, { useState } from "react"; +import React from "react"; import { Card } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; -import { Info, GitBranch, FolderTree, Package, Star, Building2, User, ChevronDown, ChevronUp, Globe, Lock, Shield } from "lucide-react"; +import { Info, GitBranch, FolderTree, Star, Building2, User, Globe, Lock, Shield } from "lucide-react"; import { Separator } from "@/components/ui/separator"; import { Tooltip, @@ -17,11 +17,6 @@ import { PopoverTrigger, } from "@/components/ui/popover"; import { cn } from "@/lib/utils"; -import { - Collapsible, - CollapsibleContent, - CollapsibleTrigger, -} from "@/components/ui/collapsible"; import type { GiteaOrgVisibility } from "@/types/config"; export type MirrorStrategy = "preserve" | "single-org" | "flat-user"; @@ -47,11 +42,10 @@ const strategyConfig = { color: "text-blue-600 dark:text-blue-400", bgColor: "bg-blue-50 dark:bg-blue-950/20", borderColor: "border-blue-200 dark:border-blue-900", - details: [ - "Personal repos → Your Gitea username", - "Org repos → Same org name in Gitea", - "Team structure preserved" - ] + repoColors: { + bg: "bg-blue-50 dark:bg-blue-950/30", + icon: "text-blue-600 dark:text-blue-400" + } }, "single-org": { title: "Consolidate to One Org", @@ -60,11 +54,10 @@ const strategyConfig = { color: "text-purple-600 dark:text-purple-400", bgColor: "bg-purple-50 dark:bg-purple-950/20", borderColor: "border-purple-200 dark:border-purple-900", - details: [ - "All repos in one place", - "Simplified management", - "Custom organization name" - ] + repoColors: { + bg: "bg-purple-50 dark:bg-purple-950/30", + icon: "text-purple-600 dark:text-purple-400" + } }, "flat-user": { title: "Flat User Structure", @@ -73,186 +66,165 @@ const strategyConfig = { color: "text-green-600 dark:text-green-400", bgColor: "bg-green-50 dark:bg-green-950/20", borderColor: "border-green-200 dark:border-green-900", - details: [ - "All repos under your username", - "No organizations needed", - "Simple and personal" - ] + repoColors: { + bg: "bg-green-50 dark:bg-green-950/30", + icon: "text-green-600 dark:text-green-400" + } } }; -const StrategyVisualizer: React.FC<{ - strategy: MirrorStrategy; +const MappingPreview: React.FC<{ + strategy: MirrorStrategy; + config: typeof strategyConfig.preserve; destinationOrg?: string; starredReposOrg?: string; githubUsername?: string; giteaUsername?: string; -}> = ({ strategy, destinationOrg, starredReposOrg, githubUsername, giteaUsername }) => { - const [isOpen, setIsOpen] = useState(false); +}> = ({ strategy, config, destinationOrg, starredReposOrg, githubUsername, giteaUsername }) => { const displayGithubUsername = githubUsername || ""; const displayGiteaUsername = giteaUsername || ""; const isGithubPlaceholder = !githubUsername; const isGiteaPlaceholder = !giteaUsername; - const renderPreserveStructure = () => ( -
-
-
GitHub
-
-
- - {displayGithubUsername}/my-repo -
-
- - my-org/team-repo -
-
- - awesome/starred-repo -
-
-
- -
- -
- -
-
Gitea
-
-
- - {displayGiteaUsername}/my-repo -
-
- - my-org/team-repo -
-
- - {starredReposOrg || "starred"}/starred-repo -
-
-
-
- ); - - const renderSingleOrg = () => ( -
-
-
GitHub
-
-
- - {displayGithubUsername}/my-repo -
-
- - my-org/team-repo -
-
- - awesome/starred-repo -
-
-
- -
- -
- -
-
Gitea
-
-
- - {destinationOrg || "github-mirrors"}/my-repo -
-
- - {destinationOrg || "github-mirrors"}/team-repo -
-
- - {starredReposOrg || "starred"}/starred-repo -
-
-
-
- ); - - const renderFlatUser = () => ( -
-
-
GitHub
-
-
- - {displayGithubUsername}/my-repo -
-
- - my-org/team-repo -
-
- - awesome/starred-repo -
-
-
- -
- -
- -
-
Gitea
-
-
- - {displayGiteaUsername}/my-repo -
-
- - {displayGiteaUsername}/team-repo -
-
- - {starredReposOrg || "starred"}/starred-repo -
-
-
-
- ); - - return ( -
- - - -
-

- - - Repository Mapping Preview - - {isOpen ? ( - - ) : ( - - )} -

+ + if (strategy === "preserve") { + return ( +
+
+
GitHub
+
+
+ + {displayGithubUsername}/my-repo
- - - {strategy === "preserve" && renderPreserveStructure()} - {strategy === "single-org" && renderSingleOrg()} - {strategy === "flat-user" && renderFlatUser()} - - - -
- ); +
+ + my-org/team-repo +
+
+ + awesome/starred-repo +
+
+
+ +
+ +
+ +
+
Gitea
+
+
+ + {displayGiteaUsername}/my-repo +
+
+ + my-org/team-repo +
+
+ + {starredReposOrg || "starred"}/starred-repo +
+
+
+
+ ); + } + + if (strategy === "single-org") { + return ( +
+
+
GitHub
+
+
+ + {displayGithubUsername}/my-repo +
+
+ + my-org/team-repo +
+
+ + awesome/starred-repo +
+
+
+ +
+ +
+ +
+
Gitea
+
+
+ + {destinationOrg || "github-mirrors"}/my-repo +
+
+ + {destinationOrg || "github-mirrors"}/team-repo +
+
+ + {starredReposOrg || "starred"}/starred-repo +
+
+
+
+ ); + } + + if (strategy === "flat-user") { + return ( +
+
+
GitHub
+
+
+ + {displayGithubUsername}/my-repo +
+
+ + my-org/team-repo +
+
+ + awesome/starred-repo +
+
+
+ +
+ +
+ +
+
Gitea
+
+
+ + {displayGiteaUsername}/my-repo +
+
+ + {displayGiteaUsername}/team-repo +
+
+ + {starredReposOrg || "starred"}/starred-repo +
+
+
+
+ ); + } + + return null; }; export const OrganizationStrategy: React.FC = ({ @@ -334,17 +306,17 @@ export const OrganizationStrategy: React.FC = ({ - -
- {config.details.map((detail, idx) => ( -
-
- {detail} -
- ))} + +
+

Repository Mapping Preview

+
@@ -541,16 +513,6 @@ export const OrganizationStrategy: React.FC = ({
)}
- - - -
); }; \ No newline at end of file