Add notification status to users table in AP
This commit is contained in:
@@ -4,7 +4,7 @@ import type { AdminUser, UserRole } from '@/types'
|
||||
import { useToast } from '@/store/toast'
|
||||
import { useConfirm } from '@/store/confirm'
|
||||
import { NeonButton } from '@/components/ui'
|
||||
import { Search, Ban, UserCheck, Shield, ShieldOff, ChevronLeft, ChevronRight, Users, X, KeyRound } from 'lucide-react'
|
||||
import { Search, Ban, UserCheck, Shield, ShieldOff, ChevronLeft, ChevronRight, Users, X, KeyRound, Bell, BellOff } from 'lucide-react'
|
||||
|
||||
export function AdminUsersPage() {
|
||||
const [users, setUsers] = useState<AdminUser[]>([])
|
||||
@@ -195,6 +195,7 @@ export function AdminUsersPage() {
|
||||
<th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Роль</th>
|
||||
<th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Telegram</th>
|
||||
<th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Марафоны</th>
|
||||
<th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Уведомления</th>
|
||||
<th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Статус</th>
|
||||
<th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Действия</th>
|
||||
</tr>
|
||||
@@ -202,13 +203,13 @@ export function AdminUsersPage() {
|
||||
<tbody className="divide-y divide-dark-600">
|
||||
{loading ? (
|
||||
<tr>
|
||||
<td colSpan={8} className="px-4 py-8 text-center">
|
||||
<td colSpan={9} className="px-4 py-8 text-center">
|
||||
<div className="animate-spin rounded-full h-6 w-6 border-2 border-accent-500 border-t-transparent mx-auto" />
|
||||
</td>
|
||||
</tr>
|
||||
) : users.length === 0 ? (
|
||||
<tr>
|
||||
<td colSpan={8} className="px-4 py-8 text-center text-gray-400">
|
||||
<td colSpan={9} className="px-4 py-8 text-center text-gray-400">
|
||||
Пользователи не найдены
|
||||
</td>
|
||||
</tr>
|
||||
@@ -236,6 +237,30 @@ export function AdminUsersPage() {
|
||||
)}
|
||||
</td>
|
||||
<td className="px-4 py-3 text-sm text-gray-400">{user.marathons_count}</td>
|
||||
<td className="px-4 py-3">
|
||||
{user.telegram_id ? (
|
||||
<div className="flex items-center gap-1" title={`События: ${user.notify_events ? 'вкл' : 'выкл'}, Споры: ${user.notify_disputes ? 'вкл' : 'выкл'}, Модерация: ${user.notify_moderation ? 'вкл' : 'выкл'}`}>
|
||||
{user.notify_events && user.notify_disputes && user.notify_moderation ? (
|
||||
<span className="inline-flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-lg bg-green-500/20 text-green-400 border border-green-500/30">
|
||||
<Bell className="w-3 h-3" />
|
||||
Все
|
||||
</span>
|
||||
) : !user.notify_events && !user.notify_disputes && !user.notify_moderation ? (
|
||||
<span className="inline-flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-lg bg-red-500/20 text-red-400 border border-red-500/30">
|
||||
<BellOff className="w-3 h-3" />
|
||||
Откл
|
||||
</span>
|
||||
) : (
|
||||
<span className="inline-flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-lg bg-yellow-500/20 text-yellow-400 border border-yellow-500/30">
|
||||
<Bell className="w-3 h-3" />
|
||||
Частично
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<span className="text-gray-600">—</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="px-4 py-3">
|
||||
{user.is_banned ? (
|
||||
<span className="inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-lg bg-red-500/20 text-red-400 border border-red-500/30">
|
||||
|
||||
@@ -489,6 +489,10 @@ export interface AdminUser {
|
||||
banned_at: string | null
|
||||
banned_until: string | null // null = permanent ban
|
||||
ban_reason: string | null
|
||||
// Notification settings
|
||||
notify_events: boolean
|
||||
notify_disputes: boolean
|
||||
notify_moderation: boolean
|
||||
}
|
||||
|
||||
export interface AdminMarathon {
|
||||
|
||||
Reference in New Issue
Block a user