import React from 'react';

// 基于角色的UI控制组件
const RoleBasedControl = ({ allowedRoles, children }) => {
  const user = JSON.parse(localStorage.getItem('user') || '{}');
  const userRole = user.role || 'guest';
  
  if (allowedRoles.includes(userRole)) {
    return <>{children}</>;
  }
  
  return null;
};

export default RoleBasedControl;