Skip to content

Conversation

@transphorm
Copy link
Member

@transphorm transphorm commented Oct 2, 2025

Summary by CodeRabbit

  • New Features

    • New reusable UI: logs panel, menu button, screen layout, and placeholder screens for consistent mobile UX.
    • Improved registration flow with status messages and toggleable logs shown in the UI.
    • Better document display: human-friendly type names, masked IDs, and concise data previews.
  • Refactor

    • Multiple screens now use shared layout/components and centralized hooks for document management.
  • Tests

    • Added tests covering catalog behavior and document-formatting utilities.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 2, 2025

Walkthrough

Adds reusable UI components, two hooks for document and registration flows, utilities for document formatting and catalog mutation, refactors multiple screens to use the new components/hooks, and adds unit tests for catalog and document utilities.

Changes

Cohort / File(s) Summary
UI Components
packages/mobile-sdk-demo/src/components/LogsPanel.tsx, packages/mobile-sdk-demo/src/components/MenuButton.tsx, packages/mobile-sdk-demo/src/components/PlaceholderScreen.tsx, packages/mobile-sdk-demo/src/components/ScreenLayout.tsx
Adds LogsPanel (toggleable log view), MenuButton (reusable action tile), PlaceholderScreen (info/placeholder layout), and ScreenLayout (SafeArea wrapper + header + content area).
Hooks
packages/mobile-sdk-demo/src/hooks/useDocuments.ts, packages/mobile-sdk-demo/src/hooks/useRegistration.ts
Adds useDocuments (load/delete documents, manages catalog updates) and useRegistration (orchestrates proving/registration state, logs, PROOF_EVENT handling, start/toggle/reset actions).
Utilities / Lib
packages/mobile-sdk-demo/src/utils/document.ts, packages/mobile-sdk-demo/src/lib/catalog.ts
New helpers: humanizeDocumentType, formatDataPreview, maskId; catalog utilities updateAfterDelete and selectDocument.
Screens — placeholder refactor
packages/mobile-sdk-demo/src/screens/DocumentCamera.tsx, packages/mobile-sdk-demo/src/screens/DocumentNFCScan.tsx, packages/mobile-sdk-demo/src/screens/QRCodeViewFinder.tsx
Replace bespoke layouts with PlaceholderScreen and move static content into props.
Screens — data & flow refactor
packages/mobile-sdk-demo/src/screens/DocumentsList.tsx
Moves document loading/deletion to useDocuments, swaps to ScreenLayout, uses new document utils, centralizes refresh/delete flows.
Screens — registration refactor
packages/mobile-sdk-demo/src/screens/RegisterDocument.tsx
Replaces inline proving logic with useRegistration, integrates LogsPanel, simplifies state and completion handling, refreshes catalog on success.
Home screen
packages/mobile-sdk-demo/src/screens/HomeScreen.tsx
Replaces local MenuButton implementation with shared MenuButton component.
Tests
packages/mobile-sdk-demo/tests/lib/catalog.test.ts, packages/mobile-sdk-demo/tests/utils/document.test.ts
Adds unit tests for catalog utilities and document helpers (humanizeDocumentType, formatDataPreview, maskId).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Screen as RegisterDocument
  participant Hook as useRegistration
  participant Client as SelfClient
  participant Store as ProvingStore
  participant UI as LogsPanel

  User->>Screen: Tap "Start Registration"
  Screen->>Hook: actions.start(documentId, document)
  Hook->>Client: init(chosenCircuitType)
  Client-->>Store: start proving state machine
  Note over Hook,Store: Hook subscribes to SdkEvents.PROOF_EVENT
  Store-->>Hook: PROOF_EVENT updates
  Hook->>Hook: addLog(), update statusMessage/currentState
  alt ready_to_prove (auto/confirm)
    Hook->>Client: setUserConfirmed(documentId)
  end
  Hook-->>Screen: state {registering,statusMessage,currentState,logs,showLogs}
  Screen->>UI: render logs + toggle
  UI->>Screen: onToggle()
Loading
sequenceDiagram
  autonumber
  participant Screen as DocumentsList
  participant Hook as useDocuments
  participant Client as SelfClient
  participant Lib as catalog.ts

  Screen->>Hook: mount -> refresh()
  Hook->>Client: getAllDocuments()
  Client-->>Hook: documents[]
  Hook-->>Screen: {documents,loading,error}

  Screen->>Hook: deleteDocument(id)
  Hook->>Client: deleteDocument(id)
  Hook->>Client: loadDocumentCatalog()
  Hook->>Lib: updateAfterDelete(catalog, id)
  Hook->>Client: saveDocumentCatalog(updated)
  Hook->>Hook: refresh()
  Hook-->>Screen: updated state
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

codex

Suggested reviewers

  • remicolin
  • aaronmgdr

Poem

Logs in monospace sing the tale,
Buttons steady on the trail.
Placeholders stand where gaps once grew,
Docs and hooks now thread anew. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “simplify mobile demo app screens” succinctly captures the primary focus of the changeset, which refactors and consolidates multiple screen components in the mobile demo app using shared layouts and placeholders. It is clear, concise, and directly related to the main scope of work without extraneous detail.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch justin/chore-simplify-demo-app-screens

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 45dc2f0 and b09c3e7.

📒 Files selected for processing (1)
  • packages/mobile-sdk-demo/src/hooks/useRegistration.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,jsx,sol,nr}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{js,ts,tsx,jsx,sol,nr}: NEVER log sensitive data including PII (names, DOB, passport numbers, addresses), credentials, tokens, API keys, private keys, or session identifiers.
ALWAYS redact/mask sensitive fields in logs using consistent patterns (e.g., ***-***-1234 for passport numbers, J*** D*** for names).

Files:

  • packages/mobile-sdk-demo/src/hooks/useRegistration.ts
🧬 Code graph analysis (1)
packages/mobile-sdk-demo/src/hooks/useRegistration.ts (1)
packages/mobile-sdk-alpha/src/proving/provingMachine.ts (1)
  • useProvingStore (367-1417)
🔇 Additional comments (7)
packages/mobile-sdk-demo/src/hooks/useRegistration.ts (7)

1-16: LGTM! Clean imports and type definitions.

The SPDX headers, imports, and RegistrationState type definition are well-structured and appropriate for the hook's functionality.


18-30: LGTM! Proper hook setup with ref for timer management.

The hook correctly initializes the proving store selectors and local state. The autoConfirmTimer ref (line 25) provides a clean way to manage the timeout lifecycle.


32-36: LGTM! Well-implemented logging utility.

The addLog callback is properly memoized, formats logs clearly with timestamps and emojis, and bounds memory by keeping only the last 50 entries.


38-46: LGTM! Proper event subscription with cleanup.

The effect correctly subscribes to proof events only when registering is active, maps event levels appropriately, and cleans up the subscription to prevent memory leaks.


48-105: Timer cleanup correctly implemented, addressing past review concern.

The auto-confirm timer (lines 66-72) now properly:

  • Stores the timer ID in a ref (line 66)
  • Guards against race conditions by checking the current state before confirming (line 68)
  • Clears the timer in the cleanup function (lines 100-104)

This implementation addresses the previous review concern about the timer firing after cancellation or state transitions. The guard at line 68 ensures that confirmation only happens if the flow is still in the ready_to_prove state when the timeout fires.


107-119: LGTM! Start callback correctly initializes registration flow.

The start callback properly:

  • Resets state and prepares for a new registration
  • Truncates documentId in logs (line 112) for privacy
  • Selects the appropriate circuit type based on document properties (line 113)
  • Initializes the proving state machine

No sensitive data is logged, complying with coding guidelines.


121-134: LGTM! Clean API surface with state and actions.

The hook returns a well-structured object separating state from actions. The reset action correctly clears local UI state, while the proving store manages its own lifecycle independently.


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.

@transphorm transphorm marked this pull request as ready for review October 2, 2025 02:31
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

🧹 Nitpick comments (5)
packages/mobile-sdk-demo/src/components/MenuButton.tsx (2)

18-27: Consider adding accessibility props.

The TouchableOpacity lacks accessibility labels and hints. For better screen reader support, add accessibilityRole="button" and accessibilityLabel props.

Apply this diff:

     <TouchableOpacity
       style={[
         styles.menuButton,
         isWorking ? styles.workingButton : styles.placeholderButton,
         disabled && styles.disabledButton,
       ]}
       onPress={onPress}
       activeOpacity={0.7}
       disabled={disabled}
+      accessibilityRole="button"
+      accessibilityLabel={title}
+      accessibilityState={{ disabled }}
     >

71-80: Duplicate backgroundColor and border styles.

The workingButton and placeholderButton styles are identical. Consider extracting to a shared base style to reduce duplication.

Apply this diff:

+  baseButton: {
+    backgroundColor: '#ffffff',
+    borderWidth: 1,
+    borderColor: '#d1d9e0',
+  },
   workingButton: {
-    backgroundColor: '#ffffff',
-    borderWidth: 1,
-    borderColor: '#d1d9e0',
   },
   placeholderButton: {
-    backgroundColor: '#ffffff',
-    borderWidth: 1,
-    borderColor: '#d1d9e0',
   },

Then update the style array on Line 19-23 to include styles.baseButton.

packages/mobile-sdk-demo/tests/lib/catalog.test.ts (1)

25-44: Consider adding edge case tests.

The current tests cover primary scenarios well. Consider adding tests for:

  • Empty catalog (no documents)
  • Deleting a non-existent document ID
  • Catalog with undefined documents array

Example additional test cases:

it('handles empty catalog gracefully', () => {
  const catalog = makeCatalog([], undefined);
  const result = updateAfterDelete(catalog, 'nonexistent');
  expect(result.documents).toEqual([]);
  expect(result.selectedDocumentId).toBeUndefined();
});

it('handles deleting non-existent document', () => {
  const catalog = makeCatalog(['a', 'b'], 'a');
  const result = updateAfterDelete(catalog, 'z');
  expect(result.documents.map(d => d.id)).toEqual(['a', 'b']);
  expect(result.selectedDocumentId).toBe('a');
});
packages/mobile-sdk-demo/src/components/LogsPanel.tsx (2)

18-20: Add accessibility props to toggle.

The toggle button should have accessibility labels for screen reader support.

Apply this diff:

       <TouchableOpacity 
         onPress={onToggle} 
         style={styles.toggle}
+        accessibilityRole="button"
+        accessibilityLabel={show ? `Hide ${logs.length} log entries` : `Show ${logs.length} log entries`}
       >

22-28: Consider virtualization for large log lists.

With maxHeight: 200 and unbounded log arrays, rendering many logs could impact performance. Consider using FlatList instead of ScrollView with .map() for better performance with large log sets.

Example refactor:

{show && (
  <FlatList
    data={logs}
    style={styles.logs}
    nestedScrollEnabled
    renderItem={({ item, index }) => (
      <Text key={index} style={styles.entry}>
        {item}
      </Text>
    )}
    keyExtractor={(_, idx) => idx.toString()}
  />
)}
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 79fdd04 and 072c67d.

📒 Files selected for processing (16)
  • packages/mobile-sdk-demo/src/components/LogsPanel.tsx (1 hunks)
  • packages/mobile-sdk-demo/src/components/MenuButton.tsx (1 hunks)
  • packages/mobile-sdk-demo/src/components/PlaceholderScreen.tsx (1 hunks)
  • packages/mobile-sdk-demo/src/components/ScreenLayout.tsx (1 hunks)
  • packages/mobile-sdk-demo/src/hooks/useDocuments.ts (1 hunks)
  • packages/mobile-sdk-demo/src/hooks/useRegistration.ts (1 hunks)
  • packages/mobile-sdk-demo/src/lib/catalog.ts (1 hunks)
  • packages/mobile-sdk-demo/src/screens/DocumentCamera.tsx (1 hunks)
  • packages/mobile-sdk-demo/src/screens/DocumentNFCScan.tsx (1 hunks)
  • packages/mobile-sdk-demo/src/screens/DocumentsList.tsx (4 hunks)
  • packages/mobile-sdk-demo/src/screens/HomeScreen.tsx (3 hunks)
  • packages/mobile-sdk-demo/src/screens/QRCodeViewFinder.tsx (1 hunks)
  • packages/mobile-sdk-demo/src/screens/RegisterDocument.tsx (5 hunks)
  • packages/mobile-sdk-demo/src/utils/document.ts (1 hunks)
  • packages/mobile-sdk-demo/tests/lib/catalog.test.ts (1 hunks)
  • packages/mobile-sdk-demo/tests/utils/document.test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,ts,tsx,jsx,sol,nr}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{js,ts,tsx,jsx,sol,nr}: NEVER log sensitive data including PII (names, DOB, passport numbers, addresses), credentials, tokens, API keys, private keys, or session identifiers.
ALWAYS redact/mask sensitive fields in logs using consistent patterns (e.g., ***-***-1234 for passport numbers, J*** D*** for names).

Files:

  • packages/mobile-sdk-demo/src/components/LogsPanel.tsx
  • packages/mobile-sdk-demo/src/screens/DocumentNFCScan.tsx
  • packages/mobile-sdk-demo/src/lib/catalog.ts
  • packages/mobile-sdk-demo/src/hooks/useDocuments.ts
  • packages/mobile-sdk-demo/src/components/PlaceholderScreen.tsx
  • packages/mobile-sdk-demo/src/components/MenuButton.tsx
  • packages/mobile-sdk-demo/src/components/ScreenLayout.tsx
  • packages/mobile-sdk-demo/src/utils/document.ts
  • packages/mobile-sdk-demo/src/hooks/useRegistration.ts
  • packages/mobile-sdk-demo/src/screens/RegisterDocument.tsx
  • packages/mobile-sdk-demo/tests/lib/catalog.test.ts
  • packages/mobile-sdk-demo/src/screens/QRCodeViewFinder.tsx
  • packages/mobile-sdk-demo/src/screens/DocumentCamera.tsx
  • packages/mobile-sdk-demo/src/screens/DocumentsList.tsx
  • packages/mobile-sdk-demo/src/screens/HomeScreen.tsx
  • packages/mobile-sdk-demo/tests/utils/document.test.ts
**/*.{test,spec}.{ts,js,tsx,jsx}

⚙️ CodeRabbit configuration file

**/*.{test,spec}.{ts,js,tsx,jsx}: Review test files for:

  • Test coverage completeness
  • Test case quality and edge cases
  • Mock usage appropriateness
  • Test readability and maintainability

Files:

  • packages/mobile-sdk-demo/tests/lib/catalog.test.ts
  • packages/mobile-sdk-demo/tests/utils/document.test.ts
🧠 Learnings (2)
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Test isPassportDataValid() with realistic synthetic passport data (never real user data)

Applied to files:

  • packages/mobile-sdk-demo/tests/utils/document.test.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Verify extractMRZInfo() using published sample MRZ strings (e.g., ICAO examples)

Applied to files:

  • packages/mobile-sdk-demo/tests/utils/document.test.ts
🧬 Code graph analysis (11)
packages/mobile-sdk-demo/src/screens/DocumentNFCScan.tsx (1)
packages/mobile-sdk-demo/src/components/PlaceholderScreen.tsx (1)
  • PlaceholderScreen (17-34)
packages/mobile-sdk-demo/src/hooks/useDocuments.ts (1)
packages/mobile-sdk-demo/src/lib/catalog.ts (1)
  • updateAfterDelete (7-22)
packages/mobile-sdk-demo/src/components/PlaceholderScreen.tsx (1)
packages/mobile-sdk-demo/src/components/ScreenLayout.tsx (1)
  • ScreenLayout (18-25)
packages/mobile-sdk-demo/src/components/ScreenLayout.tsx (2)
packages/mobile-sdk-demo/src/components/SafeAreaScrollView.tsx (1)
  • SafeAreaScrollView (13-27)
packages/mobile-sdk-demo/src/components/StandardHeader.tsx (1)
  • StandardHeader (14-24)
packages/mobile-sdk-demo/src/hooks/useRegistration.ts (1)
packages/mobile-sdk-alpha/src/proving/provingMachine.ts (1)
  • useProvingStore (367-1417)
packages/mobile-sdk-demo/src/screens/RegisterDocument.tsx (3)
packages/mobile-sdk-demo/src/hooks/useRegistration.ts (1)
  • useRegistration (18-124)
packages/mobile-sdk-demo/src/components/ScreenLayout.tsx (1)
  • ScreenLayout (18-25)
packages/mobile-sdk-demo/src/components/LogsPanel.tsx (1)
  • LogsPanel (14-32)
packages/mobile-sdk-demo/tests/lib/catalog.test.ts (1)
packages/mobile-sdk-demo/src/lib/catalog.ts (2)
  • updateAfterDelete (7-22)
  • selectDocument (24-31)
packages/mobile-sdk-demo/src/screens/QRCodeViewFinder.tsx (1)
packages/mobile-sdk-demo/src/components/PlaceholderScreen.tsx (1)
  • PlaceholderScreen (17-34)
packages/mobile-sdk-demo/src/screens/DocumentCamera.tsx (1)
packages/mobile-sdk-demo/src/components/PlaceholderScreen.tsx (1)
  • PlaceholderScreen (17-34)
packages/mobile-sdk-demo/src/screens/DocumentsList.tsx (3)
packages/mobile-sdk-demo/src/hooks/useDocuments.ts (1)
  • useDocuments (17-59)
packages/mobile-sdk-demo/src/utils/document.ts (1)
  • maskId (33-40)
packages/mobile-sdk-demo/src/components/ScreenLayout.tsx (1)
  • ScreenLayout (18-25)
packages/mobile-sdk-demo/tests/utils/document.test.ts (1)
packages/mobile-sdk-demo/src/utils/document.ts (3)
  • humanizeDocumentType (7-16)
  • formatDataPreview (18-31)
  • maskId (33-40)
🔇 Additional comments (9)
packages/mobile-sdk-demo/src/screens/HomeScreen.tsx (2)

6-10: LGTM!

Clean refactor extracting MenuButton to a reusable component. The import changes are appropriate and the component usage is correct.


39-46: LGTM!

MenuButton usage correctly maps descriptor properties to component props. The conditional logic for status and disabled is preserved from the original implementation.

packages/mobile-sdk-demo/src/utils/document.ts (2)

33-40: LGTM!

The maskId implementation correctly handles short IDs and applies appropriate masking for longer IDs with prefix/suffix preservation.


18-31: Ignore PII warning for demo
formatDataPreview only renders mock document data in this demo package—no real user PII is involved.

Likely an incorrect or invalid review comment.

packages/mobile-sdk-demo/src/screens/DocumentCamera.tsx (1)

15-25: LGTM!

Clean refactor to use the shared PlaceholderScreen component. The props accurately describe the intended camera-based document scanning functionality.

packages/mobile-sdk-demo/tests/lib/catalog.test.ts (1)

48-59: LGTM!

The selectDocument tests appropriately cover the two main branches: selecting an existing ID and attempting to select a non-existent ID.

packages/mobile-sdk-demo/src/screens/DocumentNFCScan.tsx (1)

15-26: LGTM!

Clean refactor to PlaceholderScreen. The feature list appropriately describes NFC passport reading capabilities with security protocols.

packages/mobile-sdk-demo/src/screens/QRCodeViewFinder.tsx (1)

15-26: LGTM!

Consistent refactor to PlaceholderScreen. The features accurately describe QR code scanning use cases for proof verification and partner integration.

packages/mobile-sdk-demo/src/components/LogsPanel.tsx (1)

14-32: Sanitize all log entries before rendering. Confirm the source of each log string passed to LogsPanel and mask or strip any PII (names, DOB, passport numbers), credentials, tokens, or sensitive identifiers at generation or pre-render.

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)
packages/mobile-sdk-demo/src/screens/RegisterDocument.tsx (1)

194-195: Mask or redact sensitive PII in the document data display.

The document data likely contains sensitive PII such as names, DOB, passport numbers, and addresses from the MRZ data. Even in a demo app, displaying this information unmasked in the UI poses a privacy risk and violates the coding guideline requiring redaction of sensitive data.

Consider implementing a utility function to redact sensitive fields before display, using patterns like ***-***-1234 for passport numbers and J*** D*** for names.

As per coding guidelines.

🧹 Nitpick comments (1)
packages/mobile-sdk-demo/src/screens/RegisterDocument.tsx (1)

48-59: Clarify or remove the comment on line 51.

The comment "// log via registration panel" doesn't correspond to any logging action in this function. If logging was intended, add it; otherwise, remove the misleading comment.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 072c67d and 45dc2f0.

📒 Files selected for processing (1)
  • packages/mobile-sdk-demo/src/screens/RegisterDocument.tsx (6 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,jsx,sol,nr}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{js,ts,tsx,jsx,sol,nr}: NEVER log sensitive data including PII (names, DOB, passport numbers, addresses), credentials, tokens, API keys, private keys, or session identifiers.
ALWAYS redact/mask sensitive fields in logs using consistent patterns (e.g., ***-***-1234 for passport numbers, J*** D*** for names).

Files:

  • packages/mobile-sdk-demo/src/screens/RegisterDocument.tsx
🧬 Code graph analysis (1)
packages/mobile-sdk-demo/src/screens/RegisterDocument.tsx (3)
packages/mobile-sdk-demo/src/hooks/useRegistration.ts (1)
  • useRegistration (18-124)
packages/mobile-sdk-demo/src/components/ScreenLayout.tsx (1)
  • ScreenLayout (18-25)
packages/mobile-sdk-demo/src/components/LogsPanel.tsx (1)
  • LogsPanel (14-32)
🔇 Additional comments (7)
packages/mobile-sdk-demo/src/screens/RegisterDocument.tsx (7)

5-15: LGTM! Imports align with the refactor.

The new imports (useRef, ScreenLayout, LogsPanel, useRegistration, humanizeDocumentType) support the modular architecture and hook-driven approach.


32-37: LGTM! Mounted ref prevents stale updates.

The mounted ref with cleanup effect is a standard pattern to guard against state updates after unmount, addressing part of the previous review concern.


42-45: LGTM! Clean delegation to useRegistration hook.

State variables are now derived from the centralized registration hook, improving maintainability.


90-123: LGTM! Timeout cleanup properly implemented.

The completion effect now correctly clears the timeout in the cleanup function (lines 118-122) and guards state updates with mounted.current checks (lines 97, 106), fully addressing the previous review concern about dangling updates.


132-132: LGTM! Refactored to use hook action.

The registration is now initiated via actions.start, aligning with the centralized hook pattern.


143-143: LGTM! Consistent use of shared layout component.

The screen now uses the ScreenLayout component for consistent UI structure across the app.


185-185: LGTM! Centralized log display.

The LogsPanel component cleanly handles log display with the hook-provided state and toggle action.

@transphorm transphorm merged commit 49b0e55 into dev Oct 2, 2025
14 checks passed
@transphorm transphorm deleted the justin/chore-simplify-demo-app-screens branch October 2, 2025 04:19
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.

2 participants