Skip to content

refactor: move logout to accountPageItems and reduce code duplication #4481

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

omBratteng
Copy link
Member

@omBratteng omBratteng commented May 9, 2025

Changes

Moves the logout section into accountPageItems and reduce code duplication

Preview domain

https://refactor-simplify-settings-menu.preview.app.daily.dev

@omBratteng omBratteng requested a review from Copilot May 9, 2025 10:27
@omBratteng omBratteng requested a review from a team as a code owner May 9, 2025 10:27
Copy link

vercel bot commented May 9, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
daily-webapp ✅ Ready (Inspect) Visit Preview May 9, 2025 10:30am
1 Skipped Deployment
Name Status Preview Updated (UTC)
storybook ⬜️ Ignored (Inspect) May 9, 2025 10:30am

Copy link
Contributor

@Copilot Copilot AI left a comment

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 logout functionality by moving it into accountPageItems to reduce duplicated code in the profile settings menu.

  • Consolidates logout into accountPageItems.
  • Removes the separate mobile-specific logout block.
  • Adjusts the use of separators in the menu list based on item order.
Comments suppressed due to low confidence (1)

packages/shared/src/components/profile/ProfileSettingsMenu.tsx:239

  • [nitpick] The removal of the mobile-specific typography override for the logout item may affect the mobile UX. Confirm that the mobile styling has been addressed elsewhere or add appropriate styling if needed.
-          <ProfileSection
-            items={[
-              {
-                title: 'Log out',
-                icon: ExitIcon,
-                onClick: () => logout(LogoutReason.ManualLogout),
-                ...(isMobile && {
-                  typography: {
-                    type: TypographyType.Body,
-                    color: TypographyColor.Primary,
-                  },
-                }),
-              },
-            ]}
-          />

logout: {
title: 'Log out',
icon: ExitIcon,
onClick: () => logout(LogoutReason.ManualLogout),
Copy link
Member Author

Choose a reason for hiding this comment

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

logout from AuthContext is the same as the one from useAuthContext (latter just sets it in its context 🙈)

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.

1 participant