|
@@ -18,6 +18,7 @@ export type AppContextValue = {
|
|
|
mutateUserProfile: VoidFunction
|
|
|
currentWorkspace: ICurrentWorkspace
|
|
|
isCurrentWorkspaceManager: boolean
|
|
|
+ isCurrentWorkspaceOwner: boolean
|
|
|
mutateCurrentWorkspace: VoidFunction
|
|
|
pageContainerRef: React.RefObject<HTMLDivElement>
|
|
|
langeniusVersionInfo: LangGeniusVersionResponse
|
|
@@ -83,7 +84,7 @@ export const AppContextProvider: FC<AppContextProviderProps> = ({ children }) =>
|
|
|
const [langeniusVersionInfo, setLangeniusVersionInfo] = useState<LangGeniusVersionResponse>(initialLangeniusVersionInfo)
|
|
|
const [currentWorkspace, setCurrentWorkspace] = useState<ICurrentWorkspace>(initialWorkspaceInfo)
|
|
|
const isCurrentWorkspaceManager = useMemo(() => ['owner', 'admin'].includes(currentWorkspace.role), [currentWorkspace.role])
|
|
|
-
|
|
|
+ const isCurrentWorkspaceOwner = useMemo(() => currentWorkspace.role === 'owner', [currentWorkspace.role])
|
|
|
const updateUserProfileAndVersion = useCallback(async () => {
|
|
|
if (userProfileResponse && !userProfileResponse.bodyUsed) {
|
|
|
const result = await userProfileResponse.json()
|
|
@@ -118,6 +119,7 @@ export const AppContextProvider: FC<AppContextProviderProps> = ({ children }) =>
|
|
|
useSelector,
|
|
|
currentWorkspace,
|
|
|
isCurrentWorkspaceManager,
|
|
|
+ isCurrentWorkspaceOwner,
|
|
|
mutateCurrentWorkspace,
|
|
|
}}>
|
|
|
<div className='flex flex-col h-full overflow-y-auto'>
|