refactor: simplify button enablement logic for ID upload and additional info

This commit is contained in:
seaznCode 2025-10-22 18:34:13 +02:00
parent d4f5196146
commit db0a8707d3

View File

@ -92,8 +92,6 @@ export default function QuickActionDashboardPage() {
router.push(`/quickaction-dashboard/register-sign-contract/${userType}`)
}, [router, user])
const canUploadId = emailVerified
const canCompleteInfo = emailVerified && idUploaded
const canSignContract = emailVerified && idUploaded && additionalInfo
// NEW: resend cooldown tracking (10 minutes like verify page)
@ -242,13 +240,10 @@ export default function QuickActionDashboardPage() {
{/* ID Upload */}
<button
onClick={handleUploadId}
disabled={!canUploadId || idUploaded}
className={`relative flex flex-col items-center justify-center rounded-lg px-4 py-5 text-center border font-medium text-sm transition-all ${
idUploaded
? 'bg-emerald-50 border-emerald-100 text-emerald-600 cursor-default'
: canUploadId
? 'bg-blue-600 hover:bg-blue-500 text-white border-blue-600 shadow'
: 'bg-gray-200 text-gray-500 border-gray-200 cursor-not-allowed'
: 'bg-blue-600 hover:bg-blue-500 text-white border-blue-600 shadow'
}`}
>
<ArrowUpOnSquareIcon className="h-6 w-6 mb-2" />
@ -258,13 +253,10 @@ export default function QuickActionDashboardPage() {
{/* Additional Info */}
<button
onClick={handleCompleteInfo}
disabled={!canCompleteInfo || additionalInfo}
className={`relative flex flex-col items-center justify-center rounded-lg px-4 py-5 text-center border font-medium text-sm transition-all ${
additionalInfo
? 'bg-emerald-50 border-emerald-100 text-emerald-600 cursor-default'
: canCompleteInfo
? 'bg-blue-600 hover:bg-blue-500 text-white border-blue-600 shadow'
: 'bg-gray-200 text-gray-500 border-gray-200 cursor-not-allowed'
: 'bg-blue-600 hover:bg-blue-500 text-white border-blue-600 shadow'
}`}
>
<PencilSquareIcon className="h-6 w-6 mb-2" />