Skip to content

Conversation

@jianwei1
Copy link
Contributor

@jianwei1 jianwei1 commented Sep 19, 2025

Summary by CodeRabbit

  • New Features

    • Sign-in now uses a full-page redirect with an encoded return URL, preserving the current page and createNew parameter where applicable.
    • “Login” and “Create account” actions redirect directly to the sign-in page.
  • Bug Fixes

    • No redirect after logout when viewing templates; elsewhere, users are returned to their previous page post-sign-in.
  • Changes

    • Logout flow updated: sign out first, then clear local data; success message removed for a smoother experience.

@linear
Copy link

linear bot commented Sep 19, 2025

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 19, 2025

Walkthrough

Authentication-related behaviors were updated: pages now use default withUser options; UserMenu’s logout flow now signs out, clears store, and conditionally redirects via window.location.assign; CreateJourneyButton switches to full-page sign-in redirects with encoded redirect URLs. Corresponding unit tests were updated to mock and assert window.location.assign.

Changes

Cohort / File(s) Summary of Changes
Auth HOC default behavior on admin pages
apps/journeys-admin/pages/index.tsx, apps/journeys-admin/pages/publisher/index.tsx
Removed explicit withUser option whenUnauthedAfterInit: REDIRECT_TO_LOGIN; now passing an empty options object (commented out line).
UserMenu logout flow and tests
apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.tsx, .../UserMenu/UserMenu.spec.tsx
Logout now: signOut -> clearStore -> conditional full-page redirect to /users/sign-in?redirect= unless pathname starts with /templates. Removed snackbar and setActiveTeam(null). Tests now mock window.location.assign, remove TeamProvider and GraphQL team mocks, assert conditional redirect and store clearing.
CreateJourneyButton sign-in redirect and tests
libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx, .../CreateJourneyButton/CreateJourneyButton.spec.tsx
Replaced router prefetch/push with window.location.assign to /users/sign-in?redirect=&login=. Ensures journey URL includes createNew=true when missing. Tests updated to mock location.assign and assert exact redirect URLs; removed pre-render/prefetch expectations.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant UM as UserMenu
  participant Auth as Auth Client
  participant Apollo as Apollo Client
  participant Win as window.location

  U->>UM: Click "Sign out"
  UM->>Auth: signOut()
  Auth-->>UM: resolved
  UM->>Apollo: clearStore()
  alt pathname startsWith("/templates")
    UM-->>U: No redirect
  else
    UM->>Win: assign("/users/sign-in?redirect=<encoded current URL>")
  end
Loading
sequenceDiagram
  autonumber
  actor U as User
  participant CJB as CreateJourneyButton
  participant Win as window.location

  U->>CJB: Click "Create journey"
  CJB->>CJB: Build journey URL (ensure createNew=true)
  CJB->>CJB: Encode redirect URL
  CJB->>Win: assign("/users/sign-in?redirect=<encoded>&login=<bool>")
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • csiyang
  • edmonday
  • tanflem

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 PR title "fix: previous teams appear after logging into new user" directly describes the bug being fixed by this changeset. The modifications across multiple files—including changes to the logout flow in UserMenu, removal of explicit redirect configurations, switching to full-page redirects via window.location.assign, and Apollo store clearing—are all specifically designed to address this team persistence issue. The title is clear, concise, uses standard PR format, and a teammate scanning history would understand that this PR fixes a bug related to team state appearing after logging into a different account. The title accurately conveys the primary user-facing problem being resolved.
✨ 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 jianweichong/nes-100-when-logging-into-a-different-account-the-discover-page

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 Sep 19, 2025

View your CI Pipeline Execution ↗ for commit f512927

Command Status Duration Result
nx run journeys-admin-e2e:e2e ✅ Succeeded 34s View ↗
nx run watch-e2e:e2e ✅ Succeeded 11s View ↗
nx run journeys-e2e:e2e ✅ Succeeded 15s View ↗
nx run videos-admin-e2e:e2e ✅ Succeeded 4s View ↗
nx run-many --target=vercel-alias --projects=jo... ✅ Succeeded 2s View ↗
nx run-many --target=upload-sourcemaps --projec... ✅ Succeeded 12s View ↗
nx run-many --target=deploy --projects=journeys... ✅ Succeeded 3m 33s View ↗
nx run-many --target=vercel-alias --projects=watch ✅ Succeeded 2s View ↗
Additional runs (8) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2025-09-19 04:12:33 UTC

@github-actions github-actions bot temporarily deployed to Preview - videos-admin September 19, 2025 03:13 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys September 19, 2025 03:13 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys-admin September 19, 2025 03:13 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Sep 19, 2025

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys ✅ Ready journeys preview Fri Sep 19 16:07:18 NZST 2025

@github-actions
Copy link
Contributor

github-actions bot commented Sep 19, 2025

The latest updates on your projects.

Name Status Preview Updated (UTC)
videos-admin ✅ Ready videos-admin preview Fri Sep 19 16:07:40 NZST 2025

@github-actions
Copy link
Contributor

github-actions bot commented Sep 19, 2025

The latest updates on your projects.

Name Status Preview Updated (UTC)
watch ✅ Ready watch preview Fri Sep 19 16:08:22 NZST 2025

@github-actions
Copy link
Contributor

github-actions bot commented Sep 19, 2025

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys-admin ✅ Ready journeys-admin preview Fri Sep 19 16:10:17 NZST 2025

@jianwei1 jianwei1 self-assigned this Sep 19, 2025
@jianwei1 jianwei1 marked this pull request as ready for review September 19, 2025 03:58
@github-actions github-actions bot requested a deployment to Preview - journeys-admin September 19, 2025 03:59 Pending
@github-actions github-actions bot temporarily deployed to Preview - journeys September 19, 2025 03:59 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin September 19, 2025 03:59 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys September 19, 2025 04:05 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys-admin September 19, 2025 04:05 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin September 19, 2025 04:05 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

🧹 Nitpick comments (5)
apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.tsx (2)

103-110: Make intent explicit and capture URL before sign-out.

  • Non-awaited client.clearStore(): prefix with void to document intent and avoid unhandled rejections.
  • Use a preSignOutUrl snapshot to ensure redirect targets the page the user actually logged out from.
-          onClick={async () => {
-            await user.signOut()
-            client.clearStore()
-            if (!router.pathname.startsWith('/templates')) {
-              const redirectUrl = `/users/sign-in?redirect=${encodeURIComponent(window.location.href)}`
-              window.location.assign(redirectUrl)
-            }
-          }}
+          onClick={async () => {
+            const preSignOutUrl = window.location.href
+            await user.signOut()
+            void client.clearStore()
+            if (!router.pathname.startsWith('/templates')) {
+              const redirectUrl =
+                `/users/sign-in?redirect=${encodeURIComponent(preSignOutUrl)}`
+              window.location.assign(redirectUrl)
+            }
+          }}

39-44: Remove unused hooks to satisfy lint and reduce bundle.

enqueueSnackbar and setActiveTeam are no longer used; drop useSnackbar import/variable and useTeam/setActiveTeam usage.

libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx (1)

179-185: Build URLs with URL/URLSearchParams for robustness; drop redundant nullish coalescing.

  • String includes('createNew') can false-positive and is brittle for future params; prefer URL APIs.
  • login is already boolean in the signature; remove ?? false.
-    const redirectUrl = url.includes('createNew')
-      ? url
-      : `${url}?createNew=true`
-    const signInUrl = `${domain}/users/sign-in?redirect=${encodeURIComponent(redirectUrl)}&login=${login ?? false}`
-
-    window.location.assign(signInUrl)
+    const templateUrl = new URL(`/templates/${journey?.id ?? ''}`, domain)
+    if (templateUrl.searchParams.get('createNew') !== 'true') {
+      templateUrl.searchParams.set('createNew', 'true')
+    }
+    const signInUrl = new URL('/users/sign-in', domain)
+    signInUrl.searchParams.set('redirect', templateUrl.toString())
+    signInUrl.searchParams.set('login', String(login))
+    window.location.assign(signInUrl.toString())
libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx (1)

266-276: Solid redirect assertions; add window.location restore to prevent test bleed.

The helper is good. To avoid cross-test pollution, snapshot and restore window.location in beforeEach/afterEach.

 describe('CreateJourneyButton', () => {
   const prefetch = jest.fn()
   const push = jest.fn().mockResolvedValue('')
   const originalEnv = process.env
+  // Preserve original window.location
+  const originalLocation = window.location

   beforeEach(() => {
     jest.clearAllMocks()
     teamResult.mockClear()
     journeyDuplicateMock.result.mockClear()
+    Object.defineProperty(window, 'location', { value: originalLocation })
   })

+  afterEach(() => {
+    // Restore original window.location after each test
+    Object.defineProperty(window, 'location', { value: originalLocation })
+  })

Optionally, extract a small helper to build the expected sign-in URL to keep expectations DRY across tests.

Also applies to: 464-478, 483-497, 523-537, 542-556, 582-596, 601-615

apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.spec.tsx (1)

30-41: Great helper; also restore window.location after tests.

Like above, snapshot and restore window.location to avoid affecting other tests.

 describe('UserMenu', () => {
   const handleProfileClose = jest.fn()
   const signOut = jest.fn()
+  const originalLocation = window.location
@@
   beforeEach(() => {
     jest.clearAllMocks()
+    Object.defineProperty(window, 'location', { value: originalLocation })
   })
+  afterEach(() => {
+    Object.defineProperty(window, 'location', { value: originalLocation })
+  })
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 245218b and 50cf7d2.

📒 Files selected for processing (6)
  • apps/journeys-admin/pages/index.tsx (1 hunks)
  • apps/journeys-admin/pages/publisher/index.tsx (1 hunks)
  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.spec.tsx (2 hunks)
  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.tsx (1 hunks)
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx (4 hunks)
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/base.mdc)

**/*.{ts,tsx,js,jsx}: Use early returns whenever possible to make the code more readable.
Use descriptive variable and function/const names.
Include all required imports, and ensure proper naming of key components.

Files:

  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.spec.tsx
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx
  • apps/journeys-admin/pages/index.tsx
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx
  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.tsx
  • apps/journeys-admin/pages/publisher/index.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/base.mdc)

Define a type if possible.

Files:

  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.spec.tsx
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx
  • apps/journeys-admin/pages/index.tsx
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx
  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.tsx
  • apps/journeys-admin/pages/publisher/index.tsx
apps/**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/apps.mdc)

apps/**/*.{js,jsx,ts,tsx}: Always use MUI over HTML elements; avoid using CSS or tags.
Use descriptive variable and function/const names. Also, event functions should be named with a “handle” prefix, like “handleClick” for onClick and “handleKeyDown” for onKeyDown.
Implement accessibility features on elements. For example, a tag should have a tabindex=“0”, aria-label, on:click, and on:keydown, and similar attributes.

Files:

  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.spec.tsx
  • apps/journeys-admin/pages/index.tsx
  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.tsx
  • apps/journeys-admin/pages/publisher/index.tsx
🧬 Code graph analysis (2)
apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.spec.tsx (1)
apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.tsx (1)
  • UserMenu (32-119)
libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx (1)
apps/journeys-admin-e2e/src/pages/login-page.ts (1)
  • login (56-64)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Deploy Preview (videos-admin, 7729/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (journeys-admin, 7729/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (journeys, 7729/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (watch, 7729/merge, pull_request, 22)
  • GitHub Check: build (22)
  • GitHub Check: lint (22)
🔇 Additional comments (3)
apps/journeys-admin/pages/publisher/index.tsx (1)

137-139: Double-check CSR unauthenticated flow on Publisher.

Mirrors the Index change; please verify that navigating client-side while signed out still redirects as expected and does not flash content.

You can quickly validate in dev by starting signed-out and hitting this route via Link from another page, ensuring a redirect to /users/sign-in occurs and no content is rendered beforehand.

apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.spec.tsx (1)

126-178: Logout flow tests align with new behavior.

Assertions for signOut, clearStore, and conditional redirect look correct and match the implementation.

Please also run these in watch mode to ensure no flakiness due to the non-awaited clearStore promise.

Also applies to: 180-229

apps/journeys-admin/pages/index.tsx (1)

99-101: Confirm CSR redirect or re-enable whenUnauthedAfterInit

apps/journeys-admin/pages/index.tsx has whenUnauthedAfterInit commented out (≈lines 99–101); getServerSideProps still uses withUserTokenSSR and returns a redirect when user == null, so SSR (and Next's client-side navigation that fetches props) should redirect — either restore whenUnauthedAfterInit here or add a client-side useEffect to router.replace('/users/sign-in') when user is unauthenticated; verify clicking a Link to this page while signed out redirects.

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

🧹 Nitpick comments (5)
apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.tsx (1)

105-109: Harden logout: clear cache even if signOut fails; use early return for readability.

Wrap signOut/clearStore in try/finally so the Apollo cache is always cleared, and use an early return to skip redirect on /templates. Optionally consider location.replace to avoid the user navigating back into an authed page after logout.

-            await user.signOut()
-            await client.clearStore()
-            if (!router.pathname.startsWith('/templates')) {
-              const redirectUrl = `/users/sign-in?redirect=${encodeURIComponent(window.location.href)}`
-              window.location.assign(redirectUrl)
-            }
+            try {
+              await user.signOut()
+            } finally {
+              await client.clearStore()
+            }
+            if (router.pathname.startsWith('/templates')) return
+            const redirectUrl = `/users/sign-in?redirect=${encodeURIComponent(window.location.href)}`
+            window.location.assign(redirectUrl) // or window.location.replace(redirectUrl)
libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx (1)

179-185: Build URLs with the URL API to avoid edge-case bugs and ensure proper encoding.

Safer with existing/extra query params and clearer intent.

Confirm NEXT_PUBLIC_JOURNEYS_ADMIN_URL is set in all consuming apps; otherwise the redirect will use the host project’s origin.

-    const redirectUrl = url.includes('createNew')
-      ? url
-      : `${url}?createNew=true`
-    const signInUrl = `${domain}/users/sign-in?redirect=${encodeURIComponent(redirectUrl)}&login=${login ?? false}`
-
-    window.location.assign(signInUrl)
+    const target = new URL(url)
+    if (!target.searchParams.has('createNew')) {
+      target.searchParams.set('createNew', 'true')
+    }
+    const signIn = new URL(`${domain}/users/sign-in`)
+    signIn.searchParams.set('redirect', target.toString())
+    signIn.searchParams.set('login', String(!!login))
+    window.location.assign(signIn.toString())
libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx (1)

266-277: DRY the window.location.assign mock and ensure cleanup between tests.

This helper is duplicated in other specs; extract to a shared test util and restore window.location after each test to avoid cross-test contamination.

+// At top-level (near other consts)
+const originalLocation = window.location
+
+afterEach(() => {
+  Object.defineProperty(window, 'location', { value: originalLocation, writable: true })
+})

Consider moving mockWindowLocationAssign to a shared helper, e.g. test/utils/mockWindow.ts:

export function mockWindowLocationAssign(origin: string) {
  const mockAssign = jest.fn()
  Object.defineProperty(window, 'location', {
    value: { ...window.location, origin, assign: mockAssign },
    writable: true
  })
  return mockAssign
}
apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.spec.tsx (2)

30-41: Share the location.assign mock and restore window.location after each test.

Mirror the shared helper suggested in CreateJourneyButton.spec and restore the original location to prevent leaks.

+const originalLocation = window.location
+afterEach(() => {
+  Object.defineProperty(window, 'location', { value: originalLocation, writable: true })
+})

126-178: Good: verifies signOut → clearStore → redirect, and no-redirect on /templates.

Consider adding one negative-path test where signOut rejects to ensure we still clear the cache and avoid redirect once you adopt the try/finally change.

I can add that test once the logout try/finally refactor lands.

Also applies to: 180-229

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 245218b and f512927.

📒 Files selected for processing (6)
  • apps/journeys-admin/pages/index.tsx (1 hunks)
  • apps/journeys-admin/pages/publisher/index.tsx (1 hunks)
  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.spec.tsx (2 hunks)
  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.tsx (1 hunks)
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx (4 hunks)
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/base.mdc)

**/*.{ts,tsx,js,jsx}: Use early returns whenever possible to make the code more readable.
Use descriptive variable and function/const names.
Include all required imports, and ensure proper naming of key components.

Files:

  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx
  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.tsx
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx
  • apps/journeys-admin/pages/index.tsx
  • apps/journeys-admin/pages/publisher/index.tsx
  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.spec.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/base.mdc)

Define a type if possible.

Files:

  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx
  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.tsx
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx
  • apps/journeys-admin/pages/index.tsx
  • apps/journeys-admin/pages/publisher/index.tsx
  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.spec.tsx
apps/**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/apps.mdc)

apps/**/*.{js,jsx,ts,tsx}: Always use MUI over HTML elements; avoid using CSS or tags.
Use descriptive variable and function/const names. Also, event functions should be named with a “handle” prefix, like “handleClick” for onClick and “handleKeyDown” for onKeyDown.
Implement accessibility features on elements. For example, a tag should have a tabindex=“0”, aria-label, on:click, and on:keydown, and similar attributes.

Files:

  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.tsx
  • apps/journeys-admin/pages/index.tsx
  • apps/journeys-admin/pages/publisher/index.tsx
  • apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.spec.tsx
🧬 Code graph analysis (1)
apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.spec.tsx (1)
apps/journeys-admin/src/components/PageWrapper/NavigationDrawer/UserNavigation/UserMenu/UserMenu.tsx (1)
  • UserMenu (32-119)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Deploy Preview (videos-admin, 7729/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (journeys-admin, 7729/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (watch, 7729/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (journeys, 7729/merge, pull_request, 22)
  • GitHub Check: test (22, 3/3)
  • GitHub Check: test (22, 2/3)
  • GitHub Check: build (22)
  • GitHub Check: test (22, 1/3)
  • GitHub Check: lint (22)
🔇 Additional comments (3)
apps/journeys-admin/pages/index.tsx (1)

99-101: LGTM: client-side auto-redirect removed; SSR guard remains.

With withUserTokenSSR({ whenUnauthed: AuthAction.REDIRECT_TO_LOGIN }) still in place, behavior stays protected.

Please sanity-check for any client-side flicker of unauthed content on slow networks.

apps/journeys-admin/pages/publisher/index.tsx (1)

137-139: LGTM: aligned with index page; SSR still enforces auth.

Consistent removal of whenUnauthedAfterInit looks good.

libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx (1)

464-478: Assertions look solid; keep using encoded expectations.

Good coverage of both login/create-account and cross-origin cases.

Also applies to: 483-499, 523-537, 542-556, 582-596, 601-615

@jianwei1 jianwei1 requested a review from tataihono September 19, 2025 04:13
@github-actions
Copy link
Contributor

This pull request has been marked stale due to 28 days without activity. It will be closed in 14 days unless updated.

@github-actions github-actions bot added the stale label Oct 18, 2025
@github-actions github-actions bot removed the stale label Oct 19, 2025
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