mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-03-01 12:44:17 +00:00
* fix typeexport via rollup plugin by using the correct input The rollup plugin dts requires a d.ts tree as input not the txs sources. This change points the plugin into the right direction and removes the type export hacks. * corrected types path apparently this was not properly adjusted accross the board when moving the folder * fix rollup config properly export types * use export * where needed Since we now export types alongside with defintions we use the `export * from` syntax to simplify things * export types alongside with interfaces export types so we can properly use them in external projects alongside the exported function/module/... * fix type-problems uncovered by utopia-map When including types properly in the utopia-map several missing typings showed up. * fix typing fix an inhereted type * dummy restructure code to properly be able to compile things we are not allowed to have unsed parameters/props * assigne types to category types
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import { useEffect } from 'react'
|
|
|
|
import { useAuth } from '#components/Auth/useAuth'
|
|
|
|
import { useSetPermissionData, useSetPermissionApi, useSetAdminRole } from './hooks/usePermissions'
|
|
|
|
import type { ItemsApi } from '#types/ItemsApi'
|
|
import type { Permission } from '#types/Permission'
|
|
|
|
/**
|
|
* @category Types
|
|
*/
|
|
export interface PermissionsProps {
|
|
data?: Permission[]
|
|
api?: ItemsApi<Permission>
|
|
adminRole?: string
|
|
}
|
|
export type { Permission } from '#types/Permission'
|
|
export type { ItemsApi } from '#types/ItemsApi'
|
|
|
|
/**
|
|
* @category Map
|
|
*/
|
|
export function Permissions({ data, api, adminRole }: PermissionsProps) {
|
|
const setPermissionData = useSetPermissionData()
|
|
const setPermissionApi = useSetPermissionApi()
|
|
const setAdminRole = useSetAdminRole()
|
|
const { user } = useAuth()
|
|
|
|
useEffect(() => {
|
|
adminRole && setAdminRole(adminRole)
|
|
data && setPermissionData(data)
|
|
api && setPermissionApi(api)
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, [api, data, adminRole, user])
|
|
|
|
return <></>
|
|
}
|