From 9c11d398e9ee67889348edd698f70351923337af Mon Sep 17 00:00:00 2001 From: ARUNAVO RAY Date: Wed, 16 Sep 2026 07:31:48 +0530 Subject: [PATCH] fix(ui): name the configured destination on organization cards (#432) The organization cards hardcoded the Gitea icon, the Gitea button label and the View on Gitea tooltip, while the repository table already named the configured destination. A Forgejo user saw Gitea on every card (#430). Both card layouts now use the destination icon and label, and the tooltip text follows the destination too. --- .../organizations/OrganizationsList.tsx | 62 +++++++------------ 1 file changed, 22 insertions(+), 40 deletions(-) diff --git a/src/components/organizations/OrganizationsList.tsx b/src/components/organizations/OrganizationsList.tsx index 7156d19..7a81bf2 100644 --- a/src/components/organizations/OrganizationsList.tsx +++ b/src/components/organizations/OrganizationsList.tsx @@ -3,7 +3,6 @@ import { Card } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Plus, RefreshCw, Building2, Check, AlertCircle, Clock, MoreVertical, Ban, SlidersHorizontal, Trash2, Layers } from "lucide-react"; -import { SiGitea } from "react-icons/si"; import { toast } from "sonner"; import type { MirrorOverrides, Organization } from "@/lib/db/schema"; import type { FilterParams } from "@/types/filter"; @@ -13,7 +12,7 @@ import { Skeleton } from "@/components/ui/skeleton"; import { cn } from "@/lib/utils"; import { buildGiteaWebUrl } from "@/lib/gitea-url"; import { MirrorDestinationEditor } from "./MirrorDestinationEditor"; -import { destinationInfo } from "@/components/destination/DestinationIcon"; +import { DestinationIcon, destinationInfo } from "@/components/destination/DestinationIcon"; import type { OrganizationMoveResult } from "@/lib/destination-transfer"; import { MirrorOverridesDialog } from "@/components/config/MirrorOverridesDialog"; import { hasMirrorOverrides, mirrorOptionsToFlags } from "@/lib/utils/mirror-overrides"; @@ -272,6 +271,17 @@ export function OrganizationList({ // GitHub and GitLab destinations are pushed to; only Gitea and Forgejo can transfer a repository. const destination = destinationInfo(giteaConfig); + // Tooltip for the destination link on a card. Named after the configured + // destination, so a Forgejo user is not told to view the org on Gitea (#430). + const destinationLinkTooltip = (org: Organization, orgUrl: string | null): string => { + if (!giteaConfig?.url) return `${destination.label} not configured`; + if (org.status === "imported") return `Organization not yet mirrored to ${destination.label}`; + if (org.status === "failed") return "Organization mirroring failed"; + if (org.status === "mirroring") return `Organization is being mirrored to ${destination.label}`; + if (orgUrl) return `View on ${destination.label}`; + return `${destination.label} organization not available`; + }; + // Where an organization's repositories land with no override, which is what // the mirror strategy produces for organization repositories (see // getGiteaRepoOwner in src/lib/gitea.ts). Only "preserve" and "mixed" make @@ -749,21 +759,7 @@ export function OrganizationList({ {(() => { const giteaUrl = getGiteaOrgUrl(org); - // Determine tooltip based on status and configuration - let tooltip: string; - if (!giteaConfig?.url) { - tooltip = "Gitea not configured"; - } else if (org.status === 'imported') { - tooltip = "Organization not yet mirrored to Gitea"; - } else if (org.status === 'failed') { - tooltip = "Organization mirroring failed"; - } else if (org.status === 'mirroring') { - tooltip = "Organization is being mirrored to Gitea"; - } else if (giteaUrl) { - tooltip = "View on Gitea"; - } else { - tooltip = "Gitea organization not available"; - } + const tooltip = destinationLinkTooltip(org, giteaUrl); return giteaUrl ? ( ) : ( ); })()} @@ -914,21 +910,7 @@ export function OrganizationList({ {(() => { const giteaUrl = getGiteaOrgUrl(org); - // Determine tooltip based on status and configuration - let tooltip: string; - if (!giteaConfig?.url) { - tooltip = "Gitea not configured"; - } else if (org.status === 'imported') { - tooltip = "Organization not yet mirrored to Gitea"; - } else if (org.status === 'failed') { - tooltip = "Organization mirroring failed"; - } else if (org.status === 'mirroring') { - tooltip = "Organization is being mirrored to Gitea"; - } else if (giteaUrl) { - tooltip = "View on Gitea"; - } else { - tooltip = "Gitea organization not available"; - } + const tooltip = destinationLinkTooltip(org, giteaUrl); return (
@@ -946,13 +928,13 @@ export function OrganizationList({ target="_blank" rel="noopener noreferrer" > - - Gitea + + {destination.label} ) : ( <> - - Gitea + + {destination.label} )}