Skip to content

feat: conditionally render team selection based on user sign-in status#8668

Open
thomastayler wants to merge 1 commit intomainfrom
tommytayler/nes-1267-hide-team-selection
Open

feat: conditionally render team selection based on user sign-in status#8668
thomastayler wants to merge 1 commit intomainfrom
tommytayler/nes-1267-hide-team-selection

Conversation

@thomastayler
Copy link
Contributor

@thomastayler thomastayler commented Feb 2, 2026

  • Updated LanguageScreen component to display team selection prompts only when the user is signed in.
  • Ensured that both desktop and mobile views show the appropriate team selection text based on the sign-in state.

Summary by CodeRabbit

  • Bug Fixes
    • Team selection controls and related labels now only display when users are signed in.

✏️ Tip: You can customize this high-level summary in your review settings.

- Updated LanguageScreen component to display team selection prompts only when the user is signed in.
- Ensured that both desktop and mobile views show the appropriate team selection text based on the sign-in state.
@thomastayler thomastayler self-assigned this Feb 2, 2026
@linear
Copy link

linear bot commented Feb 2, 2026

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 2, 2026

Walkthrough

Conditional rendering logic is added to hide team selection UI elements when a user is not signed in. Typography labels and the JourneyCustomizeTeamSelect component now display exclusively for authenticated users.

Changes

Cohort / File(s) Summary
Conditional Team Selection Rendering
apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/LanguageScreen/LanguageScreen.tsx
Typography labels ("Select a team") and JourneyCustomizeTeamSelect component wrapped with isSignedIn conditional checks to hide team selection interface from unauthenticated users.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: conditionally rendering team selection based on sign-in status, which matches the core objective of the PR.
Linked Issues check ✅ Passed The changes implement the requirement from NES-1267 by conditionally rendering team selection UI only for signed-in users, directly addressing the objective to hide team selection when users are not logged in.
Out of Scope Changes check ✅ Passed All changes are scoped to conditional rendering of team selection elements based on sign-in status, with no modifications to unrelated form fields or submission logic.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 tommytayler/nes-1267-hide-team-selection

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.

@nx-cloud
Copy link

nx-cloud bot commented Feb 2, 2026

View your CI Pipeline Execution ↗ for commit c27688c

Command Status Duration Result
nx run journeys-admin-e2e:e2e ✅ Succeeded 29s View ↗
nx run-many --target=vercel-alias --projects=jo... ✅ Succeeded 2s View ↗
nx run-many --target=upload-sourcemaps --projec... ✅ Succeeded 11s View ↗
nx run-many --target=deploy --projects=journeys... ✅ Succeeded 2m 27s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-02 02:23:01 UTC

@github-actions github-actions bot temporarily deployed to Preview - journeys-admin February 2, 2026 02:16 Inactive
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 (2)
apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/LanguageScreen/LanguageScreen.tsx (2)

96-98: ⚠️ Potential issue | 🟠 Major

Validation schema requires teamSelect even when hidden.

The validationSchema requires teamSelect to be a non-empty string, but when isSignedIn is false, the team selection field is not rendered. This could prevent form submission for non-authenticated users if the initial value is empty.

Consider making the validation conditional:

🔧 Suggested fix
-  const validationSchema = object({
-    teamSelect: string().required()
-  })
+  const validationSchema = object({
+    teamSelect: isSignedIn ? string().required() : string()
+  })

113-149: ⚠️ Potential issue | 🟠 Major

Loading state not reset when user is not signed in.

If isSignedIn is false but journey is not null, setLoading(true) is called on line 114 but never reset to false, leaving the "Next" button permanently disabled.

🐛 Suggested fix
   async function handleSubmit(values: FormikValues) {
     setLoading(true)
     if (journey == null) {
       setLoading(false)
       return
     }
     if (isSignedIn) {
       // ... existing logic
     }
+    setLoading(false)
   }

Alternatively, if non-signed-in users should not reach this flow, consider adding an early return or handling this case explicitly.

🧹 Nitpick comments (1)
apps/journeys-admin/src/components/TemplateCustomization/MultiStepForm/Screens/LanguageScreen/LanguageScreen.tsx (1)

219-237: Consolidate repeated conditional checks into a single block.

The two separate {isSignedIn && ...} blocks can be combined into a single conditional with a fragment, reducing duplication and improving readability.

♻️ Suggested refactor
-                {isSignedIn && (
-                  <Typography
-                    variant="h6"
-                    display={{ xs: 'none', sm: 'block' }}
-                    sx={{ mt: 4 }}
-                  >
-                    {t('Select a team')}
-                  </Typography>
-                )}
-                {isSignedIn && (
-                  <Typography
-                    variant="body2"
-                    display={{ xs: 'block', sm: 'none' }}
-                    sx={{ mt: 4 }}
-                  >
-                    {t('Select a team')}
-                  </Typography>
-                )}
-                {isSignedIn && <JourneyCustomizeTeamSelect />}
+                {isSignedIn && (
+                  <>
+                    <Typography
+                      variant="h6"
+                      display={{ xs: 'none', sm: 'block' }}
+                      sx={{ mt: 4 }}
+                    >
+                      {t('Select a team')}
+                    </Typography>
+                    <Typography
+                      variant="body2"
+                      display={{ xs: 'block', sm: 'none' }}
+                      sx={{ mt: 4 }}
+                    >
+                      {t('Select a team')}
+                    </Typography>
+                    <JourneyCustomizeTeamSelect />
+                  </>
+                )}

@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys-admin ✅ Ready journeys-admin preview Mon Feb 2 15:19:59 NZDT 2026

@thomastayler thomastayler requested a review from csiyang February 2, 2026 02:24
>
{t('Select a team')}
</Typography>
{isSignedIn && (
Copy link
Contributor

Choose a reason for hiding this comment

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

Just combine these so the isSignedIn comparison is only called once instead of 3 times. You will probably need to wrap it in a fragment

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