Skip to content

Commit acab7c7

Browse files
authored
feat: change icon navigation to go home (#1533)
* feat: change icon to navigate home Signed-off-by: Adam Setch <[email protected]> * feat: change icon to navigate home Signed-off-by: Adam Setch <[email protected]> --------- Signed-off-by: Adam Setch <[email protected]>
1 parent c889b12 commit acab7c7

File tree

5 files changed

+9
-31
lines changed

5 files changed

+9
-31
lines changed

src/components/Sidebar.test.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('components/Sidebar.tsx', () => {
6060
expect(tree).toMatchSnapshot();
6161
});
6262

63-
it('should open the gitify repository', () => {
63+
it('should navigate home when clicking the gitify logo', () => {
6464
render(
6565
<AppContext.Provider
6666
value={{
@@ -76,12 +76,8 @@ describe('components/Sidebar.tsx', () => {
7676
</AppContext.Provider>,
7777
);
7878

79-
fireEvent.click(screen.getByTestId('gitify-logo'));
80-
81-
expect(openExternalLinkMock).toHaveBeenCalledTimes(1);
82-
expect(openExternalLinkMock).toHaveBeenCalledWith(
83-
'https://github.com/gitify-app/gitify',
84-
);
79+
fireEvent.click(screen.getByTitle('Home'));
80+
expect(mockNavigate).toHaveBeenNthCalledWith(1, '/', { replace: true });
8581
});
8682

8783
describe('quick links', () => {

src/components/Sidebar.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
openGitHubIssues,
1919
openGitHubNotifications,
2020
openGitHubPulls,
21-
openGitifyRepository,
2221
} from '../utils/links';
2322
import { getNotificationCount } from '../utils/notifications';
2423
import { SidebarButton } from './buttons/SidebarButton';
@@ -77,9 +76,8 @@ export const Sidebar: FC = () => {
7776
<button
7877
type="button"
7978
className="mx-auto my-3 cursor-pointer outline-none"
80-
title="Open Gitify on GitHub"
81-
onClick={() => openGitifyRepository()}
82-
data-testid="gitify-logo"
79+
title="Home"
80+
onClick={() => navigate('/', { replace: true })}
8381
>
8482
<LogoIcon size={Size.SMALL} aria-label="Open Gitify" />
8583
</button>

src/components/__snapshots__/Sidebar.test.tsx.snap

Lines changed: 4 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/links.test.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
openGitHubParticipatingDocs,
1616
openGitHubPulls,
1717
openGitifyReleaseNotes,
18-
openGitifyRepository,
1918
openHost,
2019
openNotification,
2120
openRepository,
@@ -31,13 +30,6 @@ describe('utils/links.ts', () => {
3130
jest.clearAllMocks();
3231
});
3332

34-
it('openGitifyRepository', () => {
35-
openGitifyRepository();
36-
expect(openExternalLinkMock).toHaveBeenCalledWith(
37-
'https://github.com/gitify-app/gitify',
38-
);
39-
});
40-
4133
it('openGitifyReleaseNotes', () => {
4234
openGitifyReleaseNotes('v1.0.0');
4335
expect(openExternalLinkMock).toHaveBeenCalledWith(

src/utils/links.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import { openExternalLink } from './comms';
55
import { Constants } from './constants';
66
import { generateGitHubWebUrl } from './helpers';
77

8-
export function openGitifyRepository() {
9-
openExternalLink(`https://github.com/${Constants.REPO_SLUG}` as Link);
10-
}
11-
128
export function openGitifyReleaseNotes(version: string) {
139
openExternalLink(
1410
`https://github.com/${Constants.REPO_SLUG}/releases/tag/${version}` as Link,

0 commit comments

Comments
 (0)