From 645d495e803dbe09a6a19c4341999f8d24bf0344 Mon Sep 17 00:00:00 2001 From: Arunavo Ray Date: Sat, 24 May 2025 10:48:43 +0530 Subject: [PATCH] refactor: remove Docker configuration generation and clipboard copy functionality from ConfigTabs component --- src/components/config/ConfigTabs.tsx | 80 +--------------------------- 1 file changed, 1 insertion(+), 79 deletions(-) diff --git a/src/components/config/ConfigTabs.tsx b/src/components/config/ConfigTabs.tsx index 852f267..15c7584 100644 --- a/src/components/config/ConfigTabs.tsx +++ b/src/components/config/ConfigTabs.tsx @@ -20,7 +20,7 @@ import type { import { Button } from '../ui/button'; import { useAuth } from '@/hooks/useAuth'; import { apiRequest } from '@/lib/utils'; -import { Copy, CopyCheck, RefreshCw } from 'lucide-react'; +import { RefreshCw } from 'lucide-react'; import { toast } from 'sonner'; import { Skeleton } from '@/components/ui/skeleton'; @@ -57,8 +57,6 @@ export function ConfigTabs() { }); const { user, refreshUser } = useAuth(); const [isLoading, setIsLoading] = useState(true); - const [dockerCode, setDockerCode] = useState(''); - const [isCopied, setIsCopied] = useState(false); const [isSyncing, setIsSyncing] = useState(false); const [isConfigSaved, setIsConfigSaved] = useState(false); @@ -192,41 +190,6 @@ export function ConfigTabs() { fetchConfig(); }, [user]); - useEffect(() => { - const generateDockerCode = () => ` -services: - gitea-mirror: - image: arunavo4/gitea-mirror:latest - restart: unless-stopped - container_name: gitea-mirror - environment: - - GITHUB_USERNAME=${config.githubConfig.username} - - GITEA_URL=${config.giteaConfig.url} - - GITEA_TOKEN=${config.giteaConfig.token} - - GITHUB_TOKEN=${config.githubConfig.token} - - SKIP_FORKS=${config.githubConfig.skipForks} - - PRIVATE_REPOSITORIES=${config.githubConfig.privateRepositories} - - MIRROR_ISSUES=${config.githubConfig.mirrorIssues} - - MIRROR_STARRED=${config.githubConfig.mirrorStarred} - - PRESERVE_ORG_STRUCTURE=${config.githubConfig.preserveOrgStructure} - - SKIP_STARRED_ISSUES=${config.githubConfig.skipStarredIssues} - - GITEA_ORGANIZATION=${config.giteaConfig.organization} - - GITEA_ORG_VISIBILITY=${config.giteaConfig.visibility} - - DELAY=${config.scheduleConfig.interval}`; - setDockerCode(generateDockerCode()); - }, [config]); - - const handleCopyToClipboard = (text: string) => { - navigator.clipboard.writeText(text).then( - () => { - setIsCopied(true); - toast.success('Docker configuration copied to clipboard!'); - setTimeout(() => setIsCopied(false), 2000); - }, - () => toast.error('Could not copy text to clipboard.'), - ); - }; - function ConfigCardSkeleton() { return ( @@ -280,25 +243,9 @@ services: ); } - function DockerConfigSkeleton() { - return ( - - - - - - - - - - - ); - } - return isLoading ? (
-
) : (
@@ -391,31 +338,6 @@ services:
- - - Docker Configuration - - Equivalent Docker configuration for your current settings. - - - - -
-            {dockerCode}
-          
-
-
); }