import { useState } from 'react'; export default function PermissionIndicator({ userRole, visibility, showTooltip = true }) { const [showDetails, setShowDetails] = useState(false); const getRoleInfo = (role) => { switch (role) { case 'owner': return { icon: '👑', label: 'Owner', color: '#f59e0b', permissions: ['View', 'Edit', 'Delete', 'Manage Users', 'Change Visibility'] }; case 'editor': return { icon: '✏️', label: 'Editor', color: '#10b981', permissions: ['View', 'Edit', 'Add/Remove Cards'] }; case 'viewer': return { icon: '👁️', label: 'Viewer', color: '#6b7280', permissions: ['View Only'] }; default: return { icon: '🔒', label: 'No Access', color: '#ef4444', permissions: [] }; } }; const getVisibilityInfo = (vis) => { switch (vis) { case 'public': return { icon: '🌍', label: 'Public', color: '#10b981', description: 'Anyone can view this collection' }; case 'invite-only': return { icon: '👥', label: 'Invite Only', color: '#f59e0b', description: 'Only invited users can access' }; case 'private': return { icon: '🔒', label: 'Private', color: '#6b7280', description: 'Only you can access this collection' }; default: return { icon: '❓', label: 'Unknown', color: '#6b7280', description: 'Visibility not set' }; } }; const roleInfo = getRoleInfo(userRole); const visibilityInfo = getVisibilityInfo(visibility); return (
{visibilityInfo.description}