refactor: simplify button enablement logic for ID upload and additional info
This commit is contained in:
parent
d4f5196146
commit
db0a8707d3
@ -92,8 +92,6 @@ export default function QuickActionDashboardPage() {
|
|||||||
router.push(`/quickaction-dashboard/register-sign-contract/${userType}`)
|
router.push(`/quickaction-dashboard/register-sign-contract/${userType}`)
|
||||||
}, [router, user])
|
}, [router, user])
|
||||||
|
|
||||||
const canUploadId = emailVerified
|
|
||||||
const canCompleteInfo = emailVerified && idUploaded
|
|
||||||
const canSignContract = emailVerified && idUploaded && additionalInfo
|
const canSignContract = emailVerified && idUploaded && additionalInfo
|
||||||
|
|
||||||
// NEW: resend cooldown tracking (10 minutes like verify page)
|
// NEW: resend cooldown tracking (10 minutes like verify page)
|
||||||
@ -242,14 +240,11 @@ export default function QuickActionDashboardPage() {
|
|||||||
{/* ID Upload */}
|
{/* ID Upload */}
|
||||||
<button
|
<button
|
||||||
onClick={handleUploadId}
|
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 ${
|
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
|
idUploaded
|
||||||
? 'bg-emerald-50 border-emerald-100 text-emerald-600 cursor-default'
|
? '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-blue-600 hover:bg-blue-500 text-white border-blue-600 shadow'
|
}`}
|
||||||
: 'bg-gray-200 text-gray-500 border-gray-200 cursor-not-allowed'
|
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
<ArrowUpOnSquareIcon className="h-6 w-6 mb-2" />
|
<ArrowUpOnSquareIcon className="h-6 w-6 mb-2" />
|
||||||
{idUploaded ? 'ID Uploaded' : 'Upload ID Document'}
|
{idUploaded ? 'ID Uploaded' : 'Upload ID Document'}
|
||||||
@ -258,13 +253,10 @@ export default function QuickActionDashboardPage() {
|
|||||||
{/* Additional Info */}
|
{/* Additional Info */}
|
||||||
<button
|
<button
|
||||||
onClick={handleCompleteInfo}
|
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 ${
|
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
|
additionalInfo
|
||||||
? 'bg-emerald-50 border-emerald-100 text-emerald-600 cursor-default'
|
? '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-blue-600 hover:bg-blue-500 text-white border-blue-600 shadow'
|
|
||||||
: 'bg-gray-200 text-gray-500 border-gray-200 cursor-not-allowed'
|
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<PencilSquareIcon className="h-6 w-6 mb-2" />
|
<PencilSquareIcon className="h-6 w-6 mb-2" />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user