- Added `isCustomerBanned` function to determine if a customer is banned based on the `bannedUntil` field. - Updated the `BaseService` to throw an error if a banned customer attempts to access certain functionalities. - Enhanced the GraphQL operations to include the `bannedUntil` field in customer queries and mutations, improving data integrity and user experience. - Integrated the `CheckBanned` component in the layout to manage banned customer states effectively.
58 lines
2.4 KiB
TypeScript
58 lines
2.4 KiB
TypeScript
'use client';
|
||
|
||
import { Container } from '@/components/layout';
|
||
import { Button } from '@repo/ui/components/ui/button';
|
||
import {
|
||
Card,
|
||
CardContent,
|
||
CardDescription,
|
||
CardHeader,
|
||
CardTitle,
|
||
} from '@repo/ui/components/ui/card';
|
||
import { AlertTriangle, Ban } from 'lucide-react';
|
||
import { signOut } from 'next-auth/react';
|
||
|
||
const handleSignOut = () => {
|
||
signOut({ callbackUrl: '/' });
|
||
};
|
||
|
||
export default function BannedPage() {
|
||
return (
|
||
<Container>
|
||
<div className="flex min-h-screen items-center justify-center">
|
||
<Card className="w-full max-w-md">
|
||
<CardHeader className="text-center">
|
||
<div className="mx-auto mb-4 flex size-16 items-center justify-center rounded-full bg-destructive/10">
|
||
<Ban className="size-8 text-destructive" />
|
||
</div>
|
||
<CardTitle className="text-xl">Аккаунт заблокирован</CardTitle>
|
||
<CardDescription>
|
||
Ваш аккаунт был заблокирован администратором. Для получения дополнительной информации
|
||
обратитесь в поддержку.
|
||
</CardDescription>
|
||
</CardHeader>
|
||
<CardContent className="space-y-4">
|
||
<div className="rounded-lg bg-muted p-4">
|
||
<div className="flex items-start gap-3">
|
||
<AlertTriangle className="mt-0.5 size-5 text-yellow-500" />
|
||
<div className="text-sm text-muted-foreground">
|
||
<p className="mb-1 font-medium text-foreground">Возможные причины блокировки:</p>
|
||
<ul className="list-inside list-disc space-y-1">
|
||
<li>Нарушение правил использования сервиса</li>
|
||
<li>Спам или нежелательная активность</li>
|
||
<li>Множественные жалобы от других пользователей</li>
|
||
<li>Технические проблемы с аккаунтом</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<Button className="w-full" onClick={handleSignOut} variant="outline">
|
||
Выйти из аккаунта
|
||
</Button>
|
||
</CardContent>
|
||
</Card>
|
||
</div>
|
||
</Container>
|
||
);
|
||
}
|