fix and update

This commit is contained in:
lendry
2026-07-07 10:29:07 +03:00
parent bd6cd0d798
commit 12f46f572d
10 changed files with 115 additions and 31 deletions

View File

@@ -1,7 +1,7 @@
'use client';
import * as React from 'react';
import { KeyRound } from 'lucide-react';
import { DoorOpen, KeyRound } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
import { PinInput } from '@/components/ui/pin-input';
@@ -12,9 +12,10 @@ interface PinLockModalProps {
isSubmitting: boolean;
error?: string | null;
onSubmit: (pin: string) => Promise<void>;
onLogout?: () => void;
}
export function PinLockModal({ open, isSubmitting, error, onSubmit }: PinLockModalProps) {
export function PinLockModal({ open, isSubmitting, error, onSubmit, onLogout }: PinLockModalProps) {
const [pin, setPin] = React.useState('');
React.useEffect(() => {
@@ -30,13 +31,32 @@ export function PinLockModal({ open, isSubmitting, error, onSubmit }: PinLockMod
return (
<Dialog open={open} onOpenChange={() => undefined}>
<DialogContent className="[&>button]:hidden" onPointerDownOutside={(event) => event.preventDefault()} onEscapeKeyDown={(event) => event.preventDefault()}>
<DialogContent
className="relative [&>button]:hidden"
onPointerDownOutside={(event) => event.preventDefault()}
onEscapeKeyDown={(event) => event.preventDefault()}
>
{onLogout ? (
<button
type="button"
onClick={onLogout}
disabled={isSubmitting}
title="Выйти из аккаунта"
aria-label="Выйти из аккаунта"
className="absolute left-5 top-5 flex h-9 w-9 items-center justify-center rounded-full text-[#6b6f7b] transition hover:bg-[#f4f5f8] hover:text-[#111] disabled:opacity-50"
>
<DoorOpen className="h-4 w-4" />
</button>
) : null}
<DialogHeader>
<div className="mx-auto mb-2 flex h-14 w-14 items-center justify-center rounded-full bg-[#f4f5f8]">
<KeyRound className="h-7 w-7 text-[#111]" />
</div>
<DialogTitle className="text-center">Введите PIN-код</DialogTitle>
<p className="text-center text-sm text-[#6b6f7b]">Сессия заблокирована из-за бездействия. Подтвердите PIN, чтобы продолжить работу.</p>
<p className="text-center text-sm text-[#6b6f7b]">
Сессия заблокирована из-за бездействия. Подтвердите PIN, чтобы продолжить работу.
</p>
</DialogHeader>
<form onSubmit={handleSubmit} className="space-y-4">