This commit is contained in:
2026-03-12 14:23:32 +01:00
parent d93f43bf01
commit 0084c5f05b
60 changed files with 7526 additions and 7522 deletions

View File

@@ -1,42 +1,42 @@
'use client'
'use client'
import { removeUserRole, updateUserRole } from '../../actions'
import { useState } from 'react'
export function UserRoleActions({ ur, orgId }: { ur: { id: string, role: string, user: { email: string } }, orgId: string }) {
const [isPending, setIsPending] = useState(false)
const handleRemove = async () => {
if (!confirm(`Möchten Sie den Zugriff für ${ur.user.email} wirklich entfernen?`)) return
setIsPending(true)
await removeUserRole(ur.id, orgId)
setIsPending(false)
}
const handleToggleRole = async () => {
const newRole = ur.role === 'admin' ? 'member' : 'admin'
setIsPending(true)
await updateUserRole(ur.id, orgId, newRole)
setIsPending(false)
}
return (
<div className="flex items-center gap-2">
<button
onClick={handleToggleRole}
disabled={isPending}
className="text-xs text-gray-600 hover:text-brand-600 font-medium transition-colors"
title={ur.role === 'admin' ? 'Zum Mitglied machen' : 'Zum Admin machen'}
>
{ur.role === 'admin' ? 'Rolle: Admin' : 'Rolle: Mitglied'}
</button>
<button
onClick={handleRemove}
disabled={isPending}
className="text-xs text-red-600 hover:text-red-700 font-medium transition-colors"
>
Entfernen
</button>
</div>
)
}
import { useState } from 'react'
export function UserRoleActions({ ur, orgId }: { ur: { id: string, role: string, user: { email: string } }, orgId: string }) {
const [isPending, setIsPending] = useState(false)
const handleRemove = async () => {
if (!confirm(`Möchten Sie den Zugriff für ${ur.user.email} wirklich entfernen?`)) return
setIsPending(true)
await removeUserRole(ur.id, orgId)
setIsPending(false)
}
const handleToggleRole = async () => {
const newRole = ur.role === 'admin' ? 'member' : 'admin'
setIsPending(true)
await updateUserRole(ur.id, orgId, newRole)
setIsPending(false)
}
return (
<div className="flex items-center gap-2">
<button
onClick={handleToggleRole}
disabled={isPending}
className="text-xs text-gray-600 hover:text-brand-600 font-medium transition-colors"
title={ur.role === 'admin' ? 'Zum Mitglied machen' : 'Zum Admin machen'}
>
{ur.role === 'admin' ? 'Rolle: Admin' : 'Rolle: Mitglied'}
</button>
<button
onClick={handleRemove}
disabled={isPending}
className="text-xs text-red-600 hover:text-red-700 font-medium transition-colors"
>
Entfernen
</button>
</div>
)
}