Conversation
…pture to add tip list etc.
|
@kellular please take a look at the screenshots. |
changelog: User-facing Improvements, Doc Auth, Document capture UI update.
@kellular , not sure, did not touch that part. May be some style changes affected this. |
app/javascript/packages/document-capture/components/document-capture-selfie-capture.jsx
Outdated
Show resolved
Hide resolved
app/javascript/packages/document-capture/components/document-capture-selfie-capture.jsx
Outdated
Show resolved
Hide resolved
kellular
left a comment
There was a problem hiding this comment.
Just had a couple translations that need updating!
| * @type {DocumentSide[]} | ||
| */ | ||
| const documentSides = selfieCaptureEnabled ? ['front', 'back', 'selfie'] : ['front', 'back']; | ||
| const documentSides = ['front', 'back']; |
There was a problem hiding this comment.
I see why you went this direction. I agree that we should be splitting things out into components. Instead of doing it this way, I'd recommend you return a component structure like this from this file. Some of my reasoning:
- With the approach I'm suggesting all the headers are in the same file.
- With this approach we avoid the need for another component that mostly passes props through.
- I think naming the various instances of is a good idea.
return (
<>
{flowpath === ...}
<PageHeading>...
<DocumentCaptureSubheader> // returns the h2 starting with "1."
<TipList>...
<DocumentFront> // a new component, wraps DocumentSideAcuantCapture
<DocumentBack> // a new component, wraps DocumentSideAcuantCapture
<SelfieCaptureSubheader> // returns the h2 starting with "2."
<Selfie> // a new component, wraps DocumentSideAcuantCapture
{isLastStep ...}
{notReadySectionEnabled ...}
{exisQuestionSectionEnabled ...}
<Cancel>
</>
)And for the <DocumentFront>, <DocumentBack>, and <Selfie> components, something like this in this same file (probably don't need a new file for each of these components):
const DocumentFront = ({registerField, onChange, onError}: {...new type...}) = {
const side: DocumentSide = 'front'
return (
<DocumentSideAcuantCapture
key={side}
side={side}
registerField={registerField}
value={value[side]}
onChange={onChange}
errors={errors}
onError={onError}
/>
)
}There was a problem hiding this comment.
@charleyf , refactored with HOC for document sides. Also I kept selfie part as a separate component, since it contains multiple parts, it feels easier to test as a whole piece.
There was a problem hiding this comment.
it feels easier to test as a whole piece
That makes sense to me. I do still think that everything in document-capture-selfie-capture.tsx should move into documents-step.jsx. I think that if you move everything up into documents-step.jsx your tests will continue to work (with minor setup changes) in documents-step-spec.jsx?
A few pieces of evidence:
- The two
h2s ( 1. ... and 2. ...) should appear in the same file since they're at the same level on the same page. - The props you're sending to
DocumentCaptureSelfieCaptureare identical to the props received byDocumentsStep. - The two tip lists have identical props:
SelfieTipListandDocumentTipList - The props for
SelfieSection(in the existing section) are identical to the props forSelfie(in the new file)
Another way I'm thinking about this: I can't describe in words what the purpose of document-capture-selfie-capture is, or how it's different from what documents-step accomplishes.
There was a problem hiding this comment.
Revert how front, back sides rendered, otherwise it cause some document active element issues during testing.
There was a problem hiding this comment.
@charleyf agree most of the bullet points, and seems backtracked from previously components etc.
Also, in general it may be callsed document-capture-selfi-section? Anyway I can pull into document-steps, separate it because later we will have it with review-issue-step page.
There was a problem hiding this comment.
@charleyf , pulled all stuff in document step.
There was a problem hiding this comment.
Nice! Having all the TipList, <h2> and <DocumentSideAcuantCapture> in the same file makes it much clearer to me.
and seems backtracked from previously components etc
I'd be interested to hear more about this. The pseudocode for my suggested component structure with an example component is earlier in this thread. I'm happy to help you implement that, but I think the way the code is currently is close enough.
There was a problem hiding this comment.
@charleyf , yes basically following is the same with the HOC withProps, where the element focus seems not behaves the same with rendering in places, I too was baffled by it since the change has nothing to do with functionality, but that feels quite elusive and can consume quite some time.
const DocumentFront = ({registerField, onChange, onError}: {...new type...}) = {
const side: DocumentSide = 'front'
return (
<DocumentSideAcuantCapture
key={side}
side={side}
registerField={registerField}
value={value[side]}
onChange={onChange}
errors={errors}
onError={onError}
/>
)
}
There was a problem hiding this comment.
✅ just approved, since I agree it doesn't necessarily make much sense to keep polishing this.
Agreed, I'm also quite surprised that extracting those components would change anything. Can you tell me what you mean about the element focus changing? Do you mean the outline or some other aspect? A screenshot would help too.
There was a problem hiding this comment.
@charleyf in the document-capture-spec test, checks for document.activeElement
app/javascript/packages/document-capture/components/documents-step.jsx
Outdated
Show resolved
Hide resolved
@kellular All updated. |
| const DocumentFront = withProps({ | ||
| key: 'front', | ||
| side: 'front', | ||
| value: value.front, | ||
| ...defaultSideProps, | ||
| })(DocumentSideAcuantCapture); |
There was a problem hiding this comment.
Nice! Can you move these outside the DocumentsStep component? When they're inline like this it's hard to trace exactly which props are required by each component.
There was a problem hiding this comment.
This caused some weird test issues on focused element. Revert to the old way.
app/javascript/packages/document-capture/components/documents-step.jsx
Outdated
Show resolved
Hide resolved
…e issues on active element on page during testing.
charleyf
left a comment
There was a problem hiding this comment.
I think this is ready to merge.
I manually verified:
- Turning off the selfie featureflag hides all of this.
- The doc auth flow continues to work with the selfie featureflag on.
- The translations match (I didn't read every line, but did look through the app and translations file together).
- The updated tests look good.
| user.document_capture_sessions.last.store_result_from_response(response) | ||
| end | ||
|
|
||
| def expect_doc_capture_page_header(text) |
There was a problem hiding this comment.
👏🏻 I know you already merged this, but I just wanted to chime in and say that these are helpful helper methods!


🎫 Ticket
LG-11577
🛠 Summary of changes
Update UI content when selfie is enabled. Screen divided into two sections with numbered section headers.
Updated the page header also.
📜 Testing Plan
Provide a checklist of steps to confirm the changes.
With selfie disabled
With selfie enabled
👀 Screenshots
English with liveness
After:
Mobile top section:
Mobile bottom section:
Mobile top with error:
Desktop:
Spanish with liveness
After:
Mobile top
Mobile bottom
Mobile top error
Desktop:
French with liveness
After:
Mobile top
Mobile bottom
Mobile top error
Desktop:
English without liveness
After:
mobile
desktop
Spanish without liveness
After:
mobile
desktop
French without liveness
After:
mobile
desktop