overleaf-cep/services/web/frontend/js/shared/hooks/use-viewer-permissions.ts
Antoine Clausse 09a534f48b [web] Move scopes permissionsLevel, permissions and hasLintingError to React context (#26607)
* Move `hasLintingError` from scope to react state

* Move `permissionsLevel` to IdeReactContext states

* Get `permissionsLevel` from `useIdeReactContext()`

* Set `permissionsLevel` in mocked `IdeReactProvider`

* Replace `permissions` scope by React state

* Fixup `permission` changes

* Remove redundant type

GitOrigin-RevId: 6203c61f9ac429789624196bf67e508310f4577f
2025-07-07 08:05:36 +00:00

8 lines
251 B
TypeScript

import { useIdeReactContext } from '@/features/ide-react/context/ide-react-context'
function useViewerPermissions() {
const { permissionsLevel } = useIdeReactContext()
return permissionsLevel === 'readOnly'
}
export default useViewerPermissions