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: account header toggle #1288

Merged
merged 2 commits into from
Jun 20, 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
34 changes: 18 additions & 16 deletions src/components/AccountNotifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,26 @@ export const AccountNotifications: FC<IAccountNotifications> = (
</div>
)}

{showAccountNotifications && groupByRepository
? Object.values(groupedNotifications).map((repoNotifications) => {
const repoSlug = repoNotifications[0].repository.full_name;
{showAccountNotifications
? groupByRepository
Copy link
Collaborator

Choose a reason for hiding this comment

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

As a fix, this is fine, but as code to maintain: I find this hard to reason with. i.e. What do two chained ? operators do? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you find this easier to reason with?

{showAccountNotifications && (
  <>
    {groupByRepository
      ? Object.values(groupedNotifications).map((repoNotifications) => {
        const repoSlug = repoNotifications[0].repository.full_name;

        return (
          <RepositoryNotifications
			key={repoSlug}
			repoName={repoSlug}
			repoNotifications={repoNotifications}
		  />
		);
	  })
	: notifications.map((notification) => (
	  <NotificationRow
		key={notification.id}
		notification={notification}
	  />
	))}
  </>
)}

Copy link
Member Author

Choose a reason for hiding this comment

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

? Object.values(groupedNotifications).map((repoNotifications) => {
const repoSlug = repoNotifications[0].repository.full_name;

return (
<RepositoryNotifications
key={repoSlug}
repoName={repoSlug}
repoNotifications={repoNotifications}
return (
<RepositoryNotifications
key={repoSlug}
repoName={repoSlug}
repoNotifications={repoNotifications}
/>
);
})
: notifications.map((notification) => (
<NotificationRow
key={notification.id}
notification={notification}
/>
);
})
: notifications.map((notification) => (
<NotificationRow
key={notification.id}
notification={notification}
/>
))}
))
: null}
</>
);
};
318 changes: 0 additions & 318 deletions src/components/__snapshots__/AccountNotifications.test.tsx.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.