Skip to content

Conversation

@grv-saini-20
Copy link
Collaborator

@grv-saini-20 grv-saini-20 commented Nov 17, 2025

Description of change

  • Button is disabled now if verification code field is empty.
  • Cancel button working perfectly now in delete account modal.

Issue Number

closes #445
closes #442

Type of change

  • Update (a change which updates existing functionality)
  • Fix (a change which fixes an issue)

How the change has been tested

manual

Change checklist

  • I have ensured that the CI Checks pass locally
  • I have removed any unnecessary logic
  • My code is well documented
  • I have signed my commits
  • My code follows the pattern of the application
  • I have self reviewed my code

Summary by CodeRabbit

  • New Features

    • Enhanced onboarding flow with improved device capability verification and clearer initialization states.
    • Dynamic form submission buttons that reflect validation status during account setup.
  • Bug Fixes

    • Improved visibility controls for confirmation dialogs in settings.

@grv-saini-20 grv-saini-20 self-assigned this Nov 17, 2025
@grv-saini-20 grv-saini-20 requested a review from coodos as a code owner November 17, 2025 07:22
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 17, 2025

Walkthrough

This PR refactors the onboarding page's control flow from nested conditionals to explicit else-if branches with dedicated loading states, disables form buttons based on field validity, adds conditional visibility to settings drawers, and applies minor formatting adjustments to utility files.

Changes

Cohort / File(s) Summary
Onboarding Control Flow Restructure
infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte
Replaces nested conditional blocks with explicit else-if ladder for checkingHardware, showHardwareError, loading, preVerified, and content states. Adds dedicated "Checking device capabilities..." and "Initializing security keys..." loading messages. Implements dynamic button disabled states for Next (based on verificationId length) and Continue (based on demoName length) buttons. Reorganizes on-page content sequencing for pre-verification, verification, and final submission phases.
Settings Drawer Visibility
infrastructure/eid-wallet/src/routes/(app)/settings/+page.svelte
Wraps Delete and Final Confirmation drawers in conditional rendering blocks using Svelte {#if isDeleteConfirmationOpen} and {#if isFinalConfirmationOpen} directives, preserving underlying logic and action callbacks.
Formatting Adjustments
platforms/blabsy/src/components/input/image-preview.tsx, platforms/blabsy/src/lib/utils/image-utils.ts
Whitespace alignment in ImagePreview useMemo block and multi-line formatting of conditional logic in image-utils without behavioral changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Page as Onboarding Page
    participant KeyManager as Key Manager
    participant Verification as Verification Service
    
    User->>Page: Load Onboarding
    activate Page
    Page->>KeyManager: Check Hardware/Init
    
    alt Hardware Check Active (checkingHardware)
        Page->>User: Show "Checking device capabilities..."
        KeyManager-->>Page: Hardware Result
    else Hardware Error (showHardwareError)
        Page->>User: Show "Hardware Security Not Available"
        User->>Page: Trigger Pre-Verification
    else Loading (initialization)
        Page->>User: Show "Initializing security keys..."
    else Pre-Verified Path
        Page->>User: Show Pre-Verification Input
        Note over Page: Next button disabled if verificationId empty
        User->>Page: Enter Verification Code
        Page->>Verification: Submit Code
        Verification-->>Page: Verification ID
    else Final Submission
        Page->>User: Show Demo Name Input
        Note over Page: Continue button disabled if demoName empty
        User->>Page: Enter Name & Submit
        Page->>KeyManager: Create Wallet
        KeyManager-->>Page: Success
    end
    deactivate Page
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

  • Focus areas requiring extra attention:
    • Onboarding control flow branches: Verify all state transitions (checkingHardware → showHardwareError → loading → preVerified → final) are mutually exclusive and cover all paths
    • Button disabled state logic: Confirm verificationId and demoName validation aligns with form requirements and issue #445
    • Settings drawer conditionals: Ensure drawer open/close state management is properly wired and respects issue #442 (Cancel button behavior)
    • Hardware error pathway: Validate that hardware-not-available still triggers pre-verification flow correctly

Possibly related PRs

  • feat: health check #437: Modifies Drawer dismissible behavior and deletion modal flow in settings, intersecting with conditional drawer rendering changes
  • fix: eid wallet link #403: Modifies the same onboarding page with related keyManager initialization and control-flow logic
  • feat: setup hw crypto #295: Updates onboarding hardware detection and flow, complementing the control-flow restructuring in this PR

Suggested reviewers

  • coodos
  • sosweetham

Poem

🐰 Buttons now obey when fields stay bare,
Drawers peek through conditionals with care,
Hardware checks flow in branches clean,
Loading states dance in between,
A wallet takes shape, control flowing fair! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Whitespace-only changes in platforms/blabsy/src/components/image-preview.tsx and platforms/blabsy/src/lib/utils/image-utils.ts appear unrelated to the linked issues about eidwallet UI bugs. Remove unrelated blabsy formatting changes or clarify their connection to the eidwallet bugs. Focus this PR on eidwallet-specific fixes only.
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'fix: ui-bugs-eidwallet' is vague and generic, lacking specificity about which UI bugs are being addressed. Replace with a more descriptive title that highlights the primary fixes, such as 'fix: disable button when inputs empty and fix delete account cancel button'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description covers most required template sections including issue numbers, type of change, testing method, and a completed checklist.
Linked Issues check ✅ Passed The code changes address both linked issues: button disabling for empty verification code [#445] and cancel button functionality in delete modal [#442].
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ui-bugs-eidwallet

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 568f74d and 1e22980.

📒 Files selected for processing (2)
  • platforms/blabsy/src/components/input/image-preview.tsx (2 hunks)
  • platforms/blabsy/src/lib/utils/image-utils.ts (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • platforms/blabsy/src/lib/utils/image-utils.ts
  • platforms/blabsy/src/components/input/image-preview.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: lint
  • GitHub Check: build
  • GitHub Check: lint

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7281abd and 93a3f83.

📒 Files selected for processing (1)
  • infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte (1)

232-261: Loading state is never cleared in handleFinalSubmit.

The function sets loading = true at line 233 but never resets it to false. The loading spinner will remain visible for 10 seconds minimum (until navigation), and if navigation fails, the spinner persists indefinitely with no user feedback. Additionally, if any of the operations throw (e.g., setting vault data), there's no error handling.

Apply this diff to properly manage the loading state and add error handling:

 handleFinalSubmit = async () => {
-    loading = true;
-
-    const tenYearsLater = new Date();
-    tenYearsLater.setFullYear(tenYearsLater.getFullYear() + 10);
-    globalState.userController.user = {
-        name:
-            demoName ||
-            capitalize(`${falso.randFirstName()} ${falso.randLastName()}`),
-        "Date of Birth": new Date().toDateString(),
-        "ID submitted": `Passport - ${falso.randCountryCode()}`,
-        "Passport Number": generatePassportNumber(),
-    };
-    globalState.userController.isFake = true;
-    globalState.userController.document = {
-        "Valid From": new Date(Date.now()).toDateString(),
-        "Valid Until": tenYearsLater.toDateString(),
-        "Verified On": new Date().toDateString(),
-    };
-
-    // Set vault in controller - this will trigger profile creation with retry logic
-    globalState.vaultController.vault = {
-        uri,
-        ename,
-    };
-
-    setTimeout(() => {
-        goto("/register");
-    }, 10_000);
+    try {
+        loading = true;
+
+        const tenYearsLater = new Date();
+        tenYearsLater.setFullYear(tenYearsLater.getFullYear() + 10);
+        globalState.userController.user = {
+            name:
+                demoName ||
+                capitalize(`${falso.randFirstName()} ${falso.randLastName()}`),
+            "Date of Birth": new Date().toDateString(),
+            "ID submitted": `Passport - ${falso.randCountryCode()}`,
+            "Passport Number": generatePassportNumber(),
+        };
+        globalState.userController.isFake = true;
+        globalState.userController.document = {
+            "Valid From": new Date(Date.now()).toDateString(),
+            "Valid Until": tenYearsLater.toDateString(),
+            "Verified On": new Date().toDateString(),
+        };
+
+        // Set vault in controller - this will trigger profile creation with retry logic
+        globalState.vaultController.vault = {
+            uri,
+            ename,
+        };
+
+        setTimeout(() => {
+            loading = false;
+            goto("/register");
+        }, 10_000);
+    } catch (err) {
+        console.error("Failed to finalize onboarding:", err);
+        error = "Failed to complete onboarding. Please try again.";
+        loading = false;
+        setTimeout(() => {
+            error = null;
+        }, 5000);
+    }
 };
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 93a3f83 and e27f40b.

📒 Files selected for processing (1)
  • infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-14T17:54:47.711Z
Learnt from: coodos
Repo: MetaState-Prototype-Project/prototype PR: 437
File: infrastructure/eid-wallet/src/lib/global/controllers/security.ts:138-157
Timestamp: 2025-11-14T17:54:47.711Z
Learning: The `setOnboardingPin` method in `infrastructure/eid-wallet/src/lib/global/controllers/security.ts` is intentionally designed to allow overwriting existing PINs without checking if a PIN already exists. This is a workaround for Android keeping stale files around during app reinstallation or onboarding, which causes errors on some devices. Do not suggest adding guards to prevent PIN overwrites in this method.

Applied to files:

  • infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte
🔇 Additional comments (2)
infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte (2)

305-311: Button state correctly reflects hardware checking.

The disabled state and dynamic text properly prevent interaction during hardware capability checks, providing clear user feedback.


368-373: Perfect implementation of the PR objective!

The button is now correctly disabled when the verification code field is empty, preventing the error reported in issue #445. Both the disabled attribute and the variant prop provide clear visual feedback to users that the button is not actionable until they enter a code.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
infrastructure/eid-wallet/src/routes/(app)/settings/+page.svelte (1)

1-209: Major inconsistency: File doesn't match PR objective.

The PR objective states this fixes issue #445, which requires disabling the "generate ename button" when the verification code field is empty on the onboarding page. However, this file is the settings page and contains no code related to verification code inputs or the generate ename button.

Either the onboarding page changes (infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte mentioned in the AI summary) are missing from this review, or this PR contains unrelated changes that should be in a separate PR.

🧹 Nitpick comments (2)
infrastructure/eid-wallet/src/routes/(app)/settings/+page.svelte (2)

150-177: Potential state synchronization issue with conditional rendering and bind.

The pattern {#if isDeleteConfirmationOpen} + bind:isPaneOpen={isDeleteConfirmationOpen} is redundant and may cause issues:

  1. When the drawer closes, it tries to set isPaneOpen to false via the bind
  2. But the {#if} condition removes the component from the DOM when the state becomes false
  3. This race condition could prevent the bind from updating properly or cause the component to be destroyed mid-transition

Either:

  • Remove the {#if} wrapper and let the Drawer component handle visibility internally (if it supports this), OR
  • Remove the bind:isPaneOpen and handle closing purely through the cancelDelete/confirmDelete functions

Example of option 2:

-{#if isDeleteConfirmationOpen}
-    <Drawer bind:isPaneOpen={isDeleteConfirmationOpen}>
+<Drawer isPaneOpen={isDeleteConfirmationOpen} onClose={() => isDeleteConfirmationOpen = false}>

This same issue applies to the final confirmation drawer (lines 180-209).


135-145: Fragile color logic based on emoji string matching.

The color determination uses retryMessage.includes('✅') which is fragile. If the message text changes or the emoji is different, the coloring breaks.

Consider using explicit state for message type:

 let isRetrying = $state(false);
 let retryMessage = $state("");
+let retryStatus = $state<"info" | "success" | "error" | null>(null);

Then update the class binding:

-class="mt-2 text-sm {isRetrying
-    ? 'text-blue-600'
-    : retryMessage.includes('✅')
-      ? 'text-green-600'
-      : 'text-red-600'}"
+class="mt-2 text-sm {retryStatus === 'info'
+    ? 'text-blue-600'
+    : retryStatus === 'success'
+      ? 'text-green-600'
+      : 'text-red-600'}"

And set retryStatus appropriately in handleVersionTap.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e27f40b and f945c2f.

📒 Files selected for processing (2)
  • infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte (1 hunks)
  • infrastructure/eid-wallet/src/routes/(app)/settings/+page.svelte (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: lint
  • GitHub Check: build
🔇 Additional comments (2)
infrastructure/eid-wallet/src/routes/(app)/settings/+page.svelte (2)

39-44: LGTM: Proper async state reset and navigation.

The function correctly awaits the state reset, updates both the context and local state reference, then navigates to the onboarding page. The flow is clean and follows proper async patterns.


98-100: The review comment is incorrect.

Your search revealed that runtime.header.title is referenced only within the settings folder—specifically in the settings pages (which set it) and the settings layout (which reads it). Other app routes like scan-qr and ePassport pass hardcoded title values directly to AppNav, they do not read from runtime.header.title.

When navigating away from settings, the router switches layout contexts, and those pages use their own title management—there is no persistence issue. Cleanup is unnecessary.

Likely an incorrect or invalid review comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
platforms/blabsy/src/components/modal/mobile-sidebar-modal.tsx (1)

86-114: Remove unused Display modal setup.

Since the Display button is commented out (lines 245-256), the display modal setup and rendering are now dead code. Remove the unused useModal hook and the DisplayModal component to avoid rendering unnecessary components and improve maintainability.

Apply this diff:

-    const {
-        open: displayOpen,
-        openModal: displayOpenModal,
-        closeModal: displayCloseModal
-    } = useModal();
-
     const {
         open: logOutOpen,
         openModal: logOutOpenModal,
         closeModal: logOutCloseModal
     } = useModal();
 
     const allStats: Readonly<Stats[]> = [
         ['following', 'Following', following.length],
         ['followers', 'Followers', followers.length]
     ];
 
     const userLink = username ? `/user/${username}` : null;
 
     return (
         <>
-            <Modal
-                className='items-center justify-center xs:flex'
-                modalClassName='max-w-xl bg-main-background w-full p-8 rounded-2xl hover-animation'
-                open={displayOpen}
-                closeModal={displayCloseModal}
-            >
-                <DisplayModal closeModal={displayCloseModal} />
-            </Modal>
             <Modal
🧹 Nitpick comments (1)
platforms/blabsy/src/components/modal/mobile-sidebar-modal.tsx (1)

245-256: Consider fully removing instead of commenting out.

If the Display feature is being permanently removed, delete the commented code rather than leaving it in place. If it's temporarily disabled, add a TODO or FIXME comment explaining why and when it should be re-enabled.

Apply this diff if permanently removing:

-                        {/* <Button
-                            className='accent-tab accent-bg-tab flex items-center gap-2 rounded-md p-1.5 font-bold transition
-                         hover:bg-light-primary/10 focus-visible:ring-2 first:focus-visible:ring-[#878a8c]
-                         dark:hover:bg-dark-primary/10 dark:focus-visible:ring-white'
-                            onClick={displayOpenModal}
-                        >
-                            <HeroIcon
-                                className='h-5 w-5'
-                                iconName='PaintBrushIcon'
-                            />
-                            Display
-                        </Button> */}
                         <Button

Or add a comment if temporarily disabled:

+                        {/* TODO: Re-enable Display feature after [reason] */}
                         {/* <Button
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7fd3ac and 568f74d.

📒 Files selected for processing (1)
  • platforms/blabsy/src/components/modal/mobile-sidebar-modal.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Disable generate ename button No action is triggered when tapping the “Cancel” button on the Delete Account warning screen

2 participants