import { EmptyState } from '@xenia/ui' import { useTranslation } from '@xenia/i18n' import { useCan, useModule } from './hooks.js' /** * Show children only to users holding the key(s). * * }>… (any of them) * … (all of them) */ export function Can({ perm, all = false, fallback = null, children }) { return useCan(perm, { all }) ? children : fallback } /** * Render children only if the module is licensed and on; otherwise `fallback` * (default: a "this feature is turned off" screen). * } /> */ export function RequireModule({ module, fallback, children }) { const on = useModule(module) if (on) return children return fallback === undefined ? : fallback } export function ModuleOff() { const { t } = useTranslation('common') return } export function NoAccess() { const { t } = useTranslation('common') return }