From 364e903d5f22c233f5c3f6fc087aabe8c729a619 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Fri, 27 Feb 2026 02:29:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=87=8D=E6=9E=84=20openInCNB=20?= =?UTF-8?q?=E5=87=BD=E6=95=B0=EF=BC=8C=E7=AE=80=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=B9=B6=E4=BC=98=E5=8C=96=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/repos/components/RepoCard.tsx | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/pages/repos/components/RepoCard.tsx b/src/pages/repos/components/RepoCard.tsx index a3f17a6..04893e1 100644 --- a/src/pages/repos/components/RepoCard.tsx +++ b/src/pages/repos/components/RepoCard.tsx @@ -72,11 +72,16 @@ export function RepoCard({ showReturn = false, repo }: RepoCardProps) { const handleIssue = (repo: any) => { window.open(`https://cnb.cool/${repo.path}/-/issues`) } - const handleSettings = (repo: any) => { window.open(`https://cnb.cool/${repo.path}/-/settings`) } - + const openInCNB = (isDetail = true) => { + if (!showReturn && isDetail) { + navigate({ to: `/repo?repo=${repo.path}` }) + } else { + window.open(`https://cnb.cool/${repo.path}`, '_blank') + } + } return ( <> @@ -94,11 +99,7 @@ export function RepoCard({ showReturn = false, repo }: RepoCardProps) {
{ - if (!showReturn) { - navigate({ to: `/repo?repo=${repo.path}` }) - } else { - window.open(`https://cnb.cool/${repo.path}`, '_blank') - } + openInCNB() }} > {repo.path} @@ -299,10 +300,8 @@ export function RepoCard({ showReturn = false, repo }: RepoCardProps) { )} {repo.visibility_level}
-
{ - if (!showReturn) { - window.open(repo.site, '_blank') - } +
{ + { !showReturn && openInCNB(false) } }}> {repo.site && (