Skip to content

Story/am 849 toegangscode alleen voor bepaalde schermen zetten - #538

Open
WouterAms wants to merge 11 commits into
mainfrom
story/AM-849-toegangscode-alleen-voor-bepaalde-schermen-zetten
Open

Story/am 849 toegangscode alleen voor bepaalde schermen zetten#538
WouterAms wants to merge 11 commits into
mainfrom
story/AM-849-toegangscode-alleen-voor-bepaalde-schermen-zetten

Conversation

@WouterAms

Copy link
Copy Markdown
Contributor

Changes

Test instructions

Other notes

GitHub Copilot was used in writing the code

@WouterAms
WouterAms requested review from a team and Copilot July 26, 2026 20:41
@github-actions github-actions Bot added module:access-code Module touched based on changed src/modules folder(s). module:boat-charging Module touched based on changed src/modules folder(s). module:parking Module touched based on changed src/modules folder(s). labels Jul 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the access-code gating flow so the access code is enforced only for specific screens (opt-in per screen), instead of always gating an entire module stack.

Changes:

  • Introduces a per-screen accessCodeGate option via AppStackNavigationOptions.
  • Refactors useAccessCodeGate to support wrapping individual Stack.Screen elements with a proxy gate flow.
  • Applies the per-screen access-code gate to selected Boat Charging screens and updates Parking stack configuration.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/modules/parking/Stack.tsx Passes screenOptions into useAccessCodeGate configuration for the Parking module.
src/modules/boat-charging/Stack.tsx Wraps Boat Charging stack screens with useAccessCodeGate so gating can be applied per screen.
src/modules/boat-charging/screenConfig.ts Flags specific Boat Charging routes with accessCodeGate: true.
src/modules/access-code/types.ts Adds stack element typing helpers used by the updated gate implementation.
src/modules/access-code/screens/ForgotAccessCode.screen.tsx Adds a fallback Forgot Access Code wrapper screen.
src/modules/access-code/routes.ts Adds forgotAccessCode route to access-code routing types.
src/modules/access-code/hooks/useAccessCodeGateState.ts Introduces centralized access-code gate state derivation.
src/modules/access-code/hooks/useAccessCodeGate.tsx Refactors gating logic to support per-screen protection via proxy screens.
src/modules/access-code/constants/forgotAccessCodeScreenConfig.ts Adds default forgot-code screen configuration constant.
src/modules/access-code/constants/accessCodeScreenMap.ts Centralizes mapping from gate state to stack screen configs.
src/modules/access-code/components/AccessCodeGateProxyScreen.tsx Adds nested navigator that renders access-code flow or protected screen depending on gate state.
src/app/navigation/types.ts Introduces AppStackNavigationOptions and the accessCodeGate option on screen configs.
Comments suppressed due to low confidence (1)

src/modules/access-code/components/AccessCodeGateProxyScreen.tsx:96

  • AccessCodeGateStateName.fallback is a possible state (e.g. when attemptsLeft becomes negative), but this navigator renders no screens for it. Rendering a stack navigator with zero screens can crash at runtime; add an explicit fallback screen.
          <AccessCodeGateStack.Screen {...ACCESS_CODE_SCREEN_MAP.setup} />
          <AccessCodeGateStack.Screen {...ACCESS_CODE_SCREEN_MAP.confirm} />
        </AccessCodeGateStack.Group>
      )}
    </AccessCodeGateStack.Navigator>

Comment thread src/modules/access-code/types.ts Outdated
Comment thread src/modules/access-code/components/AccessCodeGateProxyScreen.tsx
Comment thread src/modules/access-code/hooks/useAccessCodeGateState.ts Outdated
@github-actions github-actions Bot added the Copilot ready All Copilot comments are resolved label Jul 26, 2026
@WouterAms
WouterAms enabled auto-merge July 26, 2026 20:51
@RikSchefferAmsterdam RikSchefferAmsterdam self-assigned this Jul 28, 2026
@RikSchefferAmsterdam

Copy link
Copy Markdown
Contributor

Als ik bij boot laden inlog krijg ik niet direct de toegangscode aanmaak stappen. Die stappen verschijnen pas wanneer ik naar de laadgeschiedenis navigeer.

@github-actions github-actions Bot added the module:city-pass Module touched based on changed src/modules folder(s). label Jul 29, 2026
@WouterAms
WouterAms requested a review from Copilot July 29, 2026 15:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 28 out of 29 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

src/modules/access-code/hooks/useAccessCodeGate.tsx:113

  • When additionalGateCondition is omitted, meetsAdditionalConditions becomes undefined, which makes accessCodeGate: true screens not gated. Default the condition to true when it’s not provided.
        const meetsAdditionalConditions =
          typeof additionalGateCondition === 'boolean'
            ? additionalGateCondition
            : additionalGateCondition?.(entry)

        if (entry.props.options?.accessCodeGate && meetsAdditionalConditions) {
          return (

src/modules/access-code/hooks/useIsInAccessCodeGate.ts:12

  • The thrown error message here is not actionable, and the boolean type-check is redundant because the context is typed as boolean and always defaults to false outside the provider.
  if (typeof isInsideGate !== 'boolean') {
    throw new Error('Something is wrong here...')
  }

Comment thread src/modules/access-code/providers/AccessCodeGate.provider.tsx
WouterAms and others added 10 commits July 30, 2026 15:12
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@WouterAms
WouterAms force-pushed the story/AM-849-toegangscode-alleen-voor-bepaalde-schermen-zetten branch from 1ccb1a0 to 25489ab Compare July 30, 2026 13:17
Comment thread src/modules/boat-charging/screenConfig.ts
onPress={() =>
navigate(ModuleSlug['boat-charging'], {
screen: BoatChargingRouteName.login,
params: {shouldNavigateBack: false},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

deze mag op true :)

Suggested change
params: {shouldNavigateBack: false},
params: {shouldNavigateBack: true},

Comment thread src/modules/boat-charging/components/BoatChargingGuestEmailForm.tsx
@github-actions github-actions Bot added the Code reviewed PR has been reviewed by a team member. label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code reviewed PR has been reviewed by a team member. Copilot ready All Copilot comments are resolved module:access-code Module touched based on changed src/modules folder(s). module:boat-charging Module touched based on changed src/modules folder(s). module:city-pass Module touched based on changed src/modules folder(s). module:parking Module touched based on changed src/modules folder(s).

Development

Successfully merging this pull request may close these issues.

3 participants