import React from "react"; import { showToast } from "../../../toast/toastUtils"; import { usePermissions } from "../hooks/usePermissionManagement"; import { useTranslation } from "react-i18next"; function PermissionOverview({ refreshTrigger, onRefresh }) { const { permissions, loading, error, reload } = usePermissions(); const { t } = useTranslation('permission_management'); React.useEffect(() => { reload(); }, [refreshTrigger, reload]); React.useEffect(() => { if (!loading && !error) { showToast({ type: "success", message: t('messages.loadSuccess') }); } if (error) { showToast({ type: "error", message: error }); } }, [loading, error]); if (loading) { return (
{t('headings.loading')}
); } return (

{t('headings.currentPermissions')}

{t('table.total', { count: permissions.length })}
{permissions.length === 0 ? (

{t('headings.noPermissionsTitle')}

{t('headings.noPermissionsDesc')}

) : (
{permissions.map(p => ( ))}
{t('table.name')} {t('table.description')} {t('table.status')}
{p.name}
{p.description || t('table.noDescription')}
{p.is_active ? t('status.active') : t('status.inactive')}
)}
); } export default PermissionOverview;