Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pid setup fix #220

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions apps/easypid/src/features/pid/FunkePidSetupScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,12 @@ export function FunkePidSetupScreen() {
{
step: 'id-card-start',
progress: 20,
screen: () => <PidSetupStartSlide {...getPidSetupSlideContent('id-card-start')} />,
screen: <PidSetupStartSlide {...getPidSetupSlideContent('id-card-start')} />,
},
{
step: 'id-card-pin',
progress: 30,
screen: () => (
screen: (
<PidWalletPinSlide
title="Enter your app PIN code"
subtitle="Enter the PIN code you use to unlock your wallet."
Expand All @@ -345,7 +345,7 @@ export function FunkePidSetupScreen() {
step: 'id-card-requested-attributes',
progress: 40,
backIsCancel: true,
screen: () => (
screen: (
<PidReviewRequestSlide
{...getPidSetupSlideContent('id-card-requested-attributes')}
requestedAttributes={eidCardRequestedAccessRights}
Expand All @@ -356,7 +356,7 @@ export function FunkePidSetupScreen() {
step: 'id-card-pin',
progress: 50,
backIsCancel: true,
screen: () => (
screen: (
<PidEidCardPinSlide
{...getPidSetupSlideContent('id-card-pin')}
onEnterPin={onIdCardPinReEnter ?? onIdCardPinEnter}
Expand All @@ -367,7 +367,7 @@ export function FunkePidSetupScreen() {
step: 'id-card-start-scan',
progress: 60,
backIsCancel: true,
screen: () => (
screen: (
<PidCardScanSlide
{...getPidSetupSlideContent('id-card-start-scan')}
progress={idCardScanningState.progress}
Expand All @@ -386,7 +386,7 @@ export function FunkePidSetupScreen() {
step: 'id-card-fetch',
progress: 80,
backIsCancel: true,
screen: () => (
screen: (
<PidIdCardFetchSlide
{...getPidSetupSlideContent('id-card-fetch')}
userName={userName}
Expand Down
8 changes: 8 additions & 0 deletions apps/easypid/src/features/pid/PidEidCardFetchSlide.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Heading, Paragraph, YStack } from '@package/ui'
import { useWizard } from 'packages/app/src'
import { useEffect } from 'react'
import { OnboardingIdCardFetch } from '../onboarding/screens/id-card-fetch'

Expand All @@ -11,13 +12,20 @@ interface PidIdCardFetchSlideProps {
}

export function PidIdCardFetchSlide({ title, subtitle, userName, onFetch, onComplete }: PidIdCardFetchSlideProps) {
const { completeProgressBar } = useWizard()
// biome-ignore lint/correctness/useExhaustiveDependencies: We fetch when this slide is mounted
useEffect(() => {
// We can't navigate to the next step from the SlideWizard, so we start the fetching of the credential
// when this slide is mounted.
void onFetch()
}, [])

useEffect(() => {
if (userName) {
completeProgressBar()
}
}, [completeProgressBar, userName])

return (
<YStack fg={1} gap="$6">
<YStack gap="$3">
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/components/SlideWizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { WizardProvider } from './WizardContext'
export type SlideStep = {
step: string
progress: number
screen: () => React.ReactNode
screen: (() => React.ReactNode) | React.ReactElement
backIsCancel?: boolean
}

Expand Down Expand Up @@ -161,7 +161,7 @@ export function SlideWizard({ steps, onCancel, isError, errorScreen, confirmatio
fg={1}
px="$4"
>
<Screen />
{typeof Screen === 'function' ? <Screen /> : Screen}
</ScrollableStack>
</AnimatedStack>
</FlexPage>
Expand Down