fix: frontend permission check (#784)

This commit is contained in:
Matri
2023-08-15 13:35:47 +08:00
committed by GitHub
parent 440cf63317
commit 2c77a74c40
19 changed files with 186 additions and 74 deletions

View File

@@ -6,6 +6,7 @@ import { useRouter } from 'next/navigation'
import { debounce } from 'lodash-es'
import Indicator from '../../indicator'
import AppIcon from '@/app/components/base/app-icon'
import { useAppContext } from '@/context/app-context'
type NavItem = {
id: string
@@ -29,6 +30,7 @@ const itemClassName = `
const NavSelector = ({ curNav, navs, createText, onCreate, onLoadmore }: INavSelectorProps) => {
const router = useRouter()
const { isCurrentWorkspaceManager } = useAppContext()
const handleScroll = useCallback(debounce((e) => {
if (typeof onLoadmore === 'function') {
@@ -81,7 +83,7 @@ const NavSelector = ({ curNav, navs, createText, onCreate, onLoadmore }: INavSel
))
}
</div>
<Menu.Item>
{isCurrentWorkspaceManager && <Menu.Item>
<div className='p-1' onClick={onCreate}>
<div
className='flex items-center h-12 rounded-lg cursor-pointer hover:bg-gray-100'
@@ -98,7 +100,7 @@ const NavSelector = ({ curNav, navs, createText, onCreate, onLoadmore }: INavSel
<div className='font-normal text-[14px] text-gray-700'>{createText}</div>
</div>
</div>
</Menu.Item>
</Menu.Item>}
</Menu.Items>
</Menu>
</div>