generated from kevisual/vite-react-template
feat: 添加 CLI 按钮以支持在 CNB 环境中打开 CLI 中心
This commit is contained in:
@@ -8,7 +8,7 @@ import { WorkspaceDetailDialog } from './modules/WorkspaceDetailDialog'
|
||||
import { SyncRepoDialog } from './modules/SyncRepoDialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Plus, RefreshCw, Search, Settings } from 'lucide-react'
|
||||
import { ExternalLinkIcon, Plus, RefreshCw, Search, Settings } from 'lucide-react'
|
||||
import Fuse from 'fuse.js'
|
||||
import { useNavigate } from '@tanstack/react-router'
|
||||
|
||||
@@ -53,15 +53,15 @@ export const App = () => {
|
||||
return results.map(result => result.item)
|
||||
}, [list, workspaceList, searchQuery])
|
||||
|
||||
|
||||
const isCNB = location.hostname.includes('cnb.run')
|
||||
return (
|
||||
<div className="min-h-screen bg-neutral-50 flex flex-col">
|
||||
<div className="container mx-auto p-6 max-w-7xl flex-1">
|
||||
<div className="mb-8 flex items-center justify-between">
|
||||
<div >
|
||||
<h1 className="text-4xl font-bold text-neutral-900 mb-2 flex gap-1 items-center">
|
||||
<h1 className="text-4xl font-bold text-neutral-900 mb-2 flex gap-2 items-center">
|
||||
仓库列表
|
||||
<Settings className="inline-block h-5 w-5 ml-2 text-neutral-400 hover:text-neutral-600 cursor-pointer" onClick={() => navigate({ to: '/config' })} />
|
||||
<Settings className="inline-block h-5 w-5 text-neutral-400 hover:text-neutral-600 cursor-pointer" onClick={() => navigate({ to: '/config' })} />
|
||||
</h1>
|
||||
<p className="text-neutral-600">共 {list.length} 个仓库</p>
|
||||
</div>
|
||||
@@ -81,6 +81,16 @@ export const App = () => {
|
||||
<Plus className="h-4 w-4" />
|
||||
新建仓库
|
||||
</Button>
|
||||
|
||||
{isCNB && <Button
|
||||
onClick={() => {
|
||||
window.open('/root/cli-center', '_blank')
|
||||
}}
|
||||
className="gap-2"
|
||||
>
|
||||
<ExternalLinkIcon className="h-4 w-4" />
|
||||
CLI
|
||||
</Button>}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user