feat(library): botón Importar BPMN visible para client_editor; empty state diferenciado

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-07 22:18:25 -03:00
parent bff71f0f29
commit 789e9a34ea
2 changed files with 22 additions and 3 deletions

View File

@@ -383,6 +383,25 @@ function HomeView({
// Empty state: sin grupos ni procesos (ya terminó de cargar)
if (groups.length === 0 && processes.length === 0) {
if (isClientRole) {
if (user?.platformRole === 'client_editor') {
return (
<div className="flex flex-col items-center justify-center py-24 gap-4">
<Building2 className="h-16 w-16 text-muted-foreground/30" />
<p className="text-base font-medium">Tu biblioteca está vacía</p>
<p className="text-[13px] text-muted-foreground">
Importá tu primer BPMN para empezar a cuantificar costos
</p>
<button
onClick={() => onImport()}
className="flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium text-white transition-opacity hover:opacity-90"
style={{ background: '#F59845' }}
>
<Upload className="h-4 w-4" />
Importar BPMN
</button>
</div>
)
}
return (
<div className="flex flex-col items-center justify-center py-24 gap-4">
<Building2 className="h-16 w-16 text-muted-foreground/30" />
@@ -847,7 +866,7 @@ export function LibraryPage() {
<Settings className="h-4 w-4" />
</button>
)}
{!isClientRole && (
{user.platformRole !== 'client_viewer' && (
<button
onClick={handleImport}
className="flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium text-white transition-opacity hover:opacity-90"

View File

@@ -134,9 +134,9 @@ describe('LibraryPage — visibilidad de controles según rol', () => {
authUserRef.current = { ...authUserRef.current, platformRole: 'client_editor' }
})
it('NO muestra el botón "Importar BPMN"', () => {
it('muestra el botón "Importar BPMN"', () => {
render(<LibraryPage />)
expect(screen.queryByText('Importar BPMN')).not.toBeInTheDocument()
expect(screen.getByText('Importar BPMN')).toBeInTheDocument()
})
it('NO muestra el panel de grupos', () => {