diff --git a/frontend/src/pages/ProjectDetail.tsx b/frontend/src/pages/ProjectDetail.tsx index 0d809ed..28ea711 100644 --- a/frontend/src/pages/ProjectDetail.tsx +++ b/frontend/src/pages/ProjectDetail.tsx @@ -40,7 +40,7 @@ import CreateTaskDialog from "@/components/audit/CreateTaskDialog"; import FileSelectionDialog from "@/components/audit/FileSelectionDialog"; import TerminalProgressDialog from "@/components/audit/TerminalProgressDialog"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog"; -import { SUPPORTED_LANGUAGES } from "@/shared/constants"; +import { SUPPORTED_LANGUAGES, REPOSITORY_PLATFORMS } from "@/shared/constants"; export default function ProjectDetail() { const { id } = useParams<{ id: string }>(); @@ -529,9 +529,9 @@ export default function ProjectDetail() { >
{getStatusIcon(task.status)}
@@ -578,9 +578,9 @@ export default function ProjectDetail() {
{getStatusIcon(task.status)}
@@ -674,9 +674,9 @@ export default function ProjectDetail() {
@@ -779,10 +779,11 @@ export default function ProjectDetail() { - GitHub - GitLab - Gitea - 其他 + {REPOSITORY_PLATFORMS.map((platform) => ( + + {platform.label} + + ))}
diff --git a/frontend/src/pages/Projects.tsx b/frontend/src/pages/Projects.tsx index 8ad4c30..4e3cb0c 100644 --- a/frontend/src/pages/Projects.tsx +++ b/frontend/src/pages/Projects.tsx @@ -44,7 +44,7 @@ import { Link } from "react-router-dom"; import { toast } from "sonner"; import CreateTaskDialog from "@/components/audit/CreateTaskDialog"; import TerminalProgressDialog from "@/components/audit/TerminalProgressDialog"; -import { SUPPORTED_LANGUAGES } from "@/shared/constants"; +import { SUPPORTED_LANGUAGES, REPOSITORY_PLATFORMS } from "@/shared/constants"; export default function Projects() { const [projects, setProjects] = useState([]); @@ -485,10 +485,11 @@ export default function Projects() { - GitHub - GitLab - Gitea - 其他 + {REPOSITORY_PLATFORMS.map((platform) => ( + + {platform.label} + + ))}
@@ -1016,10 +1017,11 @@ export default function Projects() { - GitHub - GitLab - Gitea - 其他 + {REPOSITORY_PLATFORMS.map((platform) => ( + + {platform.label} + + ))}
diff --git a/frontend/src/shared/constants/index.ts b/frontend/src/shared/constants/index.ts index 2f48818..401ecb2 100644 --- a/frontend/src/shared/constants/index.ts +++ b/frontend/src/shared/constants/index.ts @@ -62,13 +62,6 @@ export const PROJECT_SOURCE_TYPES = { ZIP: 'zip', } as const; -// 仓库平台类型 -export const REPOSITORY_TYPES = { - GITHUB: 'github', - GITLAB: 'gitlab', - OTHER: 'other', -} as const; - // 分析深度 export const ANALYSIS_DEPTH = { BASIC: 'basic', diff --git a/frontend/src/shared/constants/projectTypes.ts b/frontend/src/shared/constants/projectTypes.ts index 55e6d47..4e78e9b 100644 --- a/frontend/src/shared/constants/projectTypes.ts +++ b/frontend/src/shared/constants/projectTypes.ts @@ -22,17 +22,23 @@ export const PROJECT_SOURCE_TYPES: Array<{ } ]; +// 仓库平台显示名称 +export const REPOSITORY_PLATFORM_LABELS: Record = { + github: 'GitHub', + gitlab: 'GitLab', + gitea: 'Gitea', + other: '其他', +}; + // 仓库平台选项 export const REPOSITORY_PLATFORMS: Array<{ value: RepositoryPlatform; label: string; icon?: string; -}> = [ - { value: 'github', label: 'GitHub' }, - { value: 'gitlab', label: 'GitLab' }, - { value: 'gitea', label: 'Gitea' }, - { value: 'other', label: '其他' } - ]; +}> = Object.entries(REPOSITORY_PLATFORM_LABELS).map(([value, label]) => ({ + value: value as RepositoryPlatform, + label +})); // 项目来源类型的颜色配置 export const SOURCE_TYPE_COLORS: Record = { - github: 'GitHub', - gitlab: 'GitLab', - gitea: 'Gitea', - other: '其他' - }; - return labels[platform || 'other'] || '其他'; + return REPOSITORY_PLATFORM_LABELS[platform as keyof typeof REPOSITORY_PLATFORM_LABELS] || REPOSITORY_PLATFORM_LABELS.other; } /**