|
|
|
@ -1,6 +1,6 @@
|
|
|
|
'use client'
|
|
|
|
'use client'
|
|
|
|
import cn from 'classnames'
|
|
|
|
import cn from 'classnames'
|
|
|
|
import Link from 'next/link'
|
|
|
|
import { useRouter } from 'next/navigation'
|
|
|
|
import ItemOperation from '@/app/components/explore/item-operation'
|
|
|
|
import ItemOperation from '@/app/components/explore/item-operation'
|
|
|
|
|
|
|
|
|
|
|
|
import s from './style.module.css'
|
|
|
|
import s from './style.module.css'
|
|
|
|
@ -9,36 +9,49 @@ export default function NavLink({
|
|
|
|
name,
|
|
|
|
name,
|
|
|
|
id,
|
|
|
|
id,
|
|
|
|
isSelected,
|
|
|
|
isSelected,
|
|
|
|
|
|
|
|
onDelete
|
|
|
|
}: {
|
|
|
|
}: {
|
|
|
|
name: string
|
|
|
|
name: string
|
|
|
|
id: string
|
|
|
|
id: string
|
|
|
|
isSelected: boolean
|
|
|
|
isSelected: boolean
|
|
|
|
|
|
|
|
onDelete: (id: string) => void
|
|
|
|
}) {
|
|
|
|
}) {
|
|
|
|
|
|
|
|
const router = useRouter()
|
|
|
|
const url = `/explore/installed/${id}`
|
|
|
|
const url = `/explore/installed/${id}`
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Link
|
|
|
|
<div
|
|
|
|
prefetch
|
|
|
|
key={id}
|
|
|
|
key={name}
|
|
|
|
|
|
|
|
href={url}
|
|
|
|
|
|
|
|
className={cn(
|
|
|
|
className={cn(
|
|
|
|
s.item,
|
|
|
|
s.item,
|
|
|
|
isSelected && s.active,
|
|
|
|
isSelected ? s.active : 'hover:bg-gray-200',
|
|
|
|
'flex h-8 items-center px-2 rounded-lg text-sm font-normal hover:bg-gray-200',
|
|
|
|
'flex h-8 justify-between px-2 rounded-lg text-sm font-normal ',
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
|
|
|
|
onClick={() => {
|
|
|
|
|
|
|
|
router.push(url) // use Link causes popup item always trigger jump. Can not be solved by e.stopPropagation().
|
|
|
|
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
<div className='flex items-center'>
|
|
|
|
className={cn(
|
|
|
|
<div
|
|
|
|
'shrink-0 mr-2 h-6 w-6 rounded-md border bg-[#D5F5F6]',
|
|
|
|
className={cn(
|
|
|
|
)}
|
|
|
|
'shrink-0 mr-2 h-6 w-6 rounded-md border bg-[#D5F5F6]',
|
|
|
|
style={{
|
|
|
|
)}
|
|
|
|
borderColor: '0.5px solid rgba(0, 0, 0, 0.05)'
|
|
|
|
style={{
|
|
|
|
}}
|
|
|
|
borderColor: '0.5px solid rgba(0, 0, 0, 0.05)'
|
|
|
|
/>
|
|
|
|
}}
|
|
|
|
<div className='overflow-hidden text-ellipsis whitespace-nowrap'>{name}</div>
|
|
|
|
/>
|
|
|
|
<div onClick={e => e.stopPropagation()}>
|
|
|
|
<div className='max-w-[110px] overflow-hidden text-ellipsis whitespace-nowrap'>{name}</div>
|
|
|
|
<ItemOperation className={s.opBtn} />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Link>
|
|
|
|
{
|
|
|
|
|
|
|
|
!isSelected && (
|
|
|
|
|
|
|
|
<div className={cn(s.opBtn, 'shrink-0')} onClick={e => e.stopPropagation()}>
|
|
|
|
|
|
|
|
<ItemOperation
|
|
|
|
|
|
|
|
// isShowDelete={}
|
|
|
|
|
|
|
|
onDelete={() => onDelete(id)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|