roles update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { Copy, ExternalLink, KeyRound, RefreshCw } from 'lucide-react';
|
||||
import { Copy, ExternalLink, KeyRound, RefreshCw, Trash2 } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import { OAuthClient } from '@/lib/api';
|
||||
@@ -27,7 +27,8 @@ export function OAuthClientDetailDialog({
|
||||
onOpenChange,
|
||||
onCopy,
|
||||
onRotateSecret,
|
||||
onToggleActive
|
||||
onToggleActive,
|
||||
onDelete
|
||||
}: {
|
||||
client: OAuthClient | null;
|
||||
endpoints: OAuthEndpoints;
|
||||
@@ -36,6 +37,7 @@ export function OAuthClientDetailDialog({
|
||||
onCopy: (value: string, label: string) => void;
|
||||
onRotateSecret: (clientId: string) => void;
|
||||
onToggleActive: (client: OAuthClient) => void;
|
||||
onDelete: (client: OAuthClient) => void;
|
||||
}) {
|
||||
if (!client) return null;
|
||||
|
||||
@@ -125,6 +127,15 @@ export function OAuthClientDetailDialog({
|
||||
<Button variant="secondary" size="sm" onClick={() => onToggleActive(client)}>
|
||||
{client.isActive ? 'Отключить' : 'Включить'}
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
className="text-red-600 hover:text-red-700"
|
||||
onClick={() => onDelete(client)}
|
||||
>
|
||||
<Trash2 className="h-4 w-4" />
|
||||
Удалить
|
||||
</Button>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
@@ -63,6 +63,9 @@ export function NotificationBell() {
|
||||
if (event.type === 'family_invite') {
|
||||
showToast(event.message || 'Новое приглашение в семью');
|
||||
}
|
||||
if (event.type === 'role_assigned' || event.type === 'role_removed') {
|
||||
showToast(event.message || 'Изменение ролей');
|
||||
}
|
||||
});
|
||||
}, [load, showToast, subscribe]);
|
||||
|
||||
@@ -80,6 +83,11 @@ export function NotificationBell() {
|
||||
if (payload.groupId) {
|
||||
setOpen(false);
|
||||
router.push(`/family/${payload.groupId}`);
|
||||
return;
|
||||
}
|
||||
if (item.type === 'role_assigned' || item.type === 'role_removed') {
|
||||
setOpen(false);
|
||||
router.push('/admin');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,12 @@ export function RealtimeProvider({ children }: { children: React.ReactNode }) {
|
||||
try {
|
||||
const data = JSON.parse(event.data as string) as RealtimeEvent;
|
||||
emit(data);
|
||||
if (data.type === 'family_invite' || (data.type === 'chat_message' && data.payload?.notificationId)) {
|
||||
if (
|
||||
data.type === 'family_invite' ||
|
||||
data.type === 'role_assigned' ||
|
||||
data.type === 'role_removed' ||
|
||||
(data.type === 'chat_message' && data.payload?.notificationId)
|
||||
) {
|
||||
setUnreadCount((count) => count + 1);
|
||||
}
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user